diff --git a/com.unity.shadergraph/CHANGELOG.md b/com.unity.shadergraph/CHANGELOG.md index 2efee0c481a..0f6341ab73a 100644 --- a/com.unity.shadergraph/CHANGELOG.md +++ b/com.unity.shadergraph/CHANGELOG.md @@ -55,6 +55,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an issue where users can't create multiple Boolean or Enum keywords on the blackboard. [1329021](https://issuetracker.unity3d.com/issues/shadergraph-cant-create-multiple-boolean-or-enum-keywords) - Fixed an issue where generated property reference names could conflict with Shader Graph reserved keywords [1328762] (https://issuetracker.unity3d.com/product/unity/issues/guid/1328762/) - Fixed a ShaderGraph issue where ObjectField focus and Node selections would both capture deletion commands [1313943]. +- Fixed a ShaderGraph issue where the right click menu doesn't work when a stack block node is selected [1320212]. diff --git a/com.unity.shadergraph/Editor/Drawing/Views/MaterialGraphView.cs b/com.unity.shadergraph/Editor/Drawing/Views/MaterialGraphView.cs index 71328b4bd1f..e7d9d399f00 100644 --- a/com.unity.shadergraph/Editor/Drawing/Views/MaterialGraphView.cs +++ b/com.unity.shadergraph/Editor/Drawing/Views/MaterialGraphView.cs @@ -197,12 +197,20 @@ public override List GetCompatiblePorts(Port startAnchor, NodeAdapter node internal bool ResetSelectedBlockNodes() { + bool anyNodesWereReset = false; var selectedBlocknodes = selection.FindAll(e => e is MaterialNodeView && ((MaterialNodeView)e).node is BlockNode).Cast().ToArray(); foreach (var mNode in selectedBlocknodes) { var bNode = mNode.node as BlockNode; var context = GetContext(bNode.contextData); + // Check if the node is currently floating (it's parent isn't the context view that owns it). + // If the node's not floating then the block doesn't need to be reset. + bool isFloating = mNode.parent != context; + if (!isFloating) + continue; + + anyNodesWereReset = true; RemoveElement(mNode); context.InsertBlock(mNode); @@ -212,7 +220,7 @@ internal bool ResetSelectedBlockNodes() } if (selectedBlocknodes.Length > 0) graph.ValidateCustomBlockLimit(); - return selectedBlocknodes.Length > 0; + return anyNodesWereReset; } public override void BuildContextualMenu(ContextualMenuPopulateEvent evt)