diff --git a/com.unity.shadergraph/CHANGELOG.md b/com.unity.shadergraph/CHANGELOG.md index 669bdd2079c..48072033a76 100644 --- a/com.unity.shadergraph/CHANGELOG.md +++ b/com.unity.shadergraph/CHANGELOG.md @@ -107,6 +107,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an issue where `Keywords` on the Blackboard would not duplicate with the same `Default` value. - Shader Graph now requests preview shader compilation asynchronously. [1209047](https://issuetracker.unity3d.com/issues/shader-graph-unresponsive-editor-when-using-large-graphs) - Fixed an issue where Shader Graph would not compile master previews after an assembly reload. +- Fixed undo not being recorded properly for setting active master node, graph precision, and node defaults. - Fixed an issue where Custum Function nodes and Sub Graph Output nodes could no longer rename slots. - Fixed a bug where searcher entries would not repopulate correctly after an undo was perfromed (https://fogbugz.unity3d.com/f/cases/1241018/) diff --git a/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs b/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs index cd303a02de1..c022c19ece6 100644 --- a/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs +++ b/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs @@ -973,6 +973,9 @@ public void ReplaceWith(GraphData other) if (other == null) throw new ArgumentException("Can only replace with another AbstractMaterialGraph", "other"); + concretePrecision = other.concretePrecision; + m_OutputNode = other.m_OutputNode; + using (var inputsToRemove = PooledList.Get()) { foreach (var property in m_Properties.SelectValue()) diff --git a/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs b/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs index 36974390f13..859abc2f2d2 100644 --- a/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs +++ b/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs @@ -172,9 +172,12 @@ public GraphEditorView(EditorWindow editorWindow, GraphData graph, MessageManage EditorGUI.BeginChangeCheck(); GUILayout.Label("Precision"); - graph.concretePrecision = (ConcretePrecision)EditorGUILayout.EnumPopup(graph.concretePrecision, GUILayout.Width(100f)); + var precision = (ConcretePrecision)EditorGUILayout.EnumPopup(graph.concretePrecision, GUILayout.Width(100f)); if (EditorGUI.EndChangeCheck()) { + m_Graph.owner.RegisterCompleteObjectUndo("Changed Graph Precision"); + graph.concretePrecision = precision; + var nodeList = m_GraphView.Query().ToList(); m_ColorManager.SetNodesDirty(nodeList); graph.ValidateGraph(); diff --git a/com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs b/com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs index 00c381ca66e..2aead237eaf 100644 --- a/com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs +++ b/com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs @@ -341,6 +341,7 @@ public override void BuildContextualMenu(ContextualMenuPopulateEvent evt) void SetMasterAsActive(DropdownMenuAction action) { + node.owner.owner.RegisterCompleteObjectUndo("Change Active Master"); node.owner.outputNode = node; } diff --git a/com.unity.shadergraph/Editor/Drawing/Views/Slots/MultiFloatSlotControlView.cs b/com.unity.shadergraph/Editor/Drawing/Views/Slots/MultiFloatSlotControlView.cs index 323c7538696..9a82903ce18 100644 --- a/com.unity.shadergraph/Editor/Drawing/Views/Slots/MultiFloatSlotControlView.cs +++ b/com.unity.shadergraph/Editor/Drawing/Views/Slots/MultiFloatSlotControlView.cs @@ -70,11 +70,12 @@ void AddField(Vector4 initialValue, int index, string subLabel) m_Node.Dirty(ModificationScope.Node); } }); - // Reset UndoGroup when done editing input field + // Reset UndoGroup when done editing input field & update title field.Q("unity-text-input").RegisterCallback(evt => - { - m_UndoGroup = -1; - }); + { + m_Node.owner.owner.isDirty = true; + m_UndoGroup = -1; + }); Add(field); } }