diff --git a/com.unity.shadergraph/CHANGELOG.md b/com.unity.shadergraph/CHANGELOG.md index 31df09a876b..e63dcb2631c 100644 --- a/com.unity.shadergraph/CHANGELOG.md +++ b/com.unity.shadergraph/CHANGELOG.md @@ -15,6 +15,7 @@ The version number for this package has increased due to a version update of a r ### Changed ### Fixed + - Fixed bug where an exception was thrown on undo operation after adding properties to a category [1348910] (https://fogbugz.unity3d.com/f/cases/1348910/) - Fixed bug where it was not possible to switch to Graph Settings tab in Inspector if multiple nodes and an edge was selected [1357648] (https://fogbugz.unity3d.com/f/cases/1357648/) - Fixed an incorrect direction transform from view to world space [1362034] (https://issuetracker.unity3d.com/product/unity/issues/guid/1362034/) - Fixed ShaderGraph HDRP master preview disappearing for a few seconds when graph is modified [1330289] (https://issuetracker.unity3d.com/issues/shadergraph-hdrp-main-preview-is-invisible-until-moved) diff --git a/com.unity.shadergraph/Editor/Drawing/Blackboard/SGBlackboardCategory.cs b/com.unity.shadergraph/Editor/Drawing/Blackboard/SGBlackboardCategory.cs index 545f85969d8..c5811bbf649 100644 --- a/com.unity.shadergraph/Editor/Drawing/Blackboard/SGBlackboardCategory.cs +++ b/com.unity.shadergraph/Editor/Drawing/Blackboard/SGBlackboardCategory.cs @@ -292,6 +292,15 @@ void OnMouseDownEvent(MouseDownEvent e) OpenTextEditor(); e.PreventDefault(); } + else if (e.clickCount == 1 && e.button == (int)MouseButton.LeftMouse && IsRenamable()) + { + // Select the child elements within this category (the field views) + var fieldViews = this.Query(); + foreach (var child in fieldViews.ToList()) + { + this.AddToSelection(child); + } + } } internal void OpenTextEditor() @@ -664,12 +673,6 @@ public override void Select(VisualElement selectionContainer, bool additive) public override void OnSelected() { AddToClassList("selected"); - // Select the child elements within this category (the field views) - var fieldViews = this.Query(); - foreach (var child in fieldViews.ToList()) - { - this.AddToSelection(child); - } } public override void OnUnselected() diff --git a/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs b/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs index 27bb9b9e5d8..c409da146a1 100644 --- a/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs +++ b/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs @@ -684,6 +684,9 @@ public void HandleGraphChanges(bool wasUndoRedoPerformed) previewManager.RenderPreviews(m_EditorWindow); + + m_GraphView.wasUndoRedoPerformed = wasUndoRedoPerformed; + if (wasUndoRedoPerformed || m_InspectorView.doesInspectorNeedUpdate) m_InspectorView.Update(); diff --git a/com.unity.shadergraph/Editor/Drawing/Views/MaterialGraphView.cs b/com.unity.shadergraph/Editor/Drawing/Views/MaterialGraphView.cs index 363883bea00..17c08fb6257 100644 --- a/com.unity.shadergraph/Editor/Drawing/Views/MaterialGraphView.cs +++ b/com.unity.shadergraph/Editor/Drawing/Views/MaterialGraphView.cs @@ -141,6 +141,8 @@ void ChangePrecision(GraphPrecision newGraphDefaultPrecision) public Action onConvertToSubgraphClick { get; set; } public Vector2 cachedMousePosition { get; private set; } + public bool wasUndoRedoPerformed { get; set; } + // GraphView has UQueryState nodes built in to query for Nodes // We need this for Contexts but we might as well cast it to a list once public List contexts { get; set; } @@ -1076,6 +1078,7 @@ void DeleteSelectionImplementation(string operationName, GraphView.AskUser askUs // Updates selected graph elements after undo/redo internal void RestorePersistentSelectionAfterUndoRedo() { + wasUndoRedoPerformed = true; m_UndoRedoPerformedMethodInfo?.Invoke(this, new object[] { }); }