Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions com.unity.render-pipelines.core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [10.1.0] - 2019-08-04

Version Updated
The version number for this package has increased due to a version update of a related graphics package.
### Added
- Added context options "Move to Top", "Move to Bottom", "Expand All" and "Collapse All" for volume components.

### Fixed
- Fixed the scene view to scale correctly when hardware dynamic resolution is enabled (case 1158661)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,30 @@ void OnContextClick(Vector2 position, VolumeComponent targetComponent, int id)
var menu = new GenericMenu();

if (id == 0)
{
menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Move Up"));
menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Move to Top"));
}
else
{
menu.AddItem(EditorGUIUtility.TrTextContent("Move to Top"), false, () => MoveComponent(id, -id));
menu.AddItem(EditorGUIUtility.TrTextContent("Move Up"), false, () => MoveComponent(id, -1));
}

if (id == m_Editors.Count - 1)
{
menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Move to Bottom"));
menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Move Down"));
}
else
{
menu.AddItem(EditorGUIUtility.TrTextContent("Move to Bottom"), false, () => MoveComponent(id, (m_Editors.Count -1) - id));
menu.AddItem(EditorGUIUtility.TrTextContent("Move Down"), false, () => MoveComponent(id, 1));
}

menu.AddSeparator(string.Empty);
menu.AddItem(EditorGUIUtility.TrTextContent("Collapse All"), false, () => CollapseComponents());
menu.AddItem(EditorGUIUtility.TrTextContent("Expand All"), false, () => ExpandComponents());
menu.AddSeparator(string.Empty);
menu.AddItem(EditorGUIUtility.TrTextContent("Reset"), false, () => ResetComponent(targetComponent.GetType(), id));
menu.AddItem(EditorGUIUtility.TrTextContent("Remove"), false, () => RemoveComponent(id));
Expand Down Expand Up @@ -419,11 +434,44 @@ internal void MoveComponent(int id, int offset)
m_ComponentsProperty.MoveArrayElement(id, id + offset);
m_SerializedObject.ApplyModifiedProperties();

// We need to keep track of what was expanded before to set it afterwards.
bool targetExpanded = m_Editors[id + offset].baseProperty.isExpanded;
bool sourceExpanded = m_Editors[id].baseProperty.isExpanded;

// Move editors
var prev = m_Editors[id + offset];
m_Editors[id + offset] = m_Editors[id];
m_Editors[id] = prev;

// Set the expansion values
m_Editors[id + offset].baseProperty.isExpanded = targetExpanded;
m_Editors[id].baseProperty.isExpanded = sourceExpanded;
}

internal void CollapseComponents()
{
// Move components
m_SerializedObject.Update();
int numEditors = m_Editors.Count;
for (int i = 0; i < numEditors; ++i)
{
m_Editors[i].baseProperty.isExpanded = false;
}
m_SerializedObject.ApplyModifiedProperties();
}

internal void ExpandComponents()
{
// Move components
m_SerializedObject.Update();
int numEditors = m_Editors.Count;
for (int i = 0; i < numEditors; ++i)
{
m_Editors[i].baseProperty.isExpanded = true;
}
m_SerializedObject.ApplyModifiedProperties();
}


static bool CanPaste(VolumeComponent targetComponent)
{
Expand Down