diff --git a/com.unity.shadergraph/CHANGELOG.md b/com.unity.shadergraph/CHANGELOG.md index b341bc62ca1..967c614853b 100644 --- a/com.unity.shadergraph/CHANGELOG.md +++ b/com.unity.shadergraph/CHANGELOG.md @@ -6,8 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] -Version Updated -The version number for this package has increased due to a version update of a related graphics package. +### Fixed +- Fixed undo not being recorded properly for setting active master node, graph precision, and node defaults. ## [8.1.0] - 2020-04-21 diff --git a/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs b/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs index 39fca7414be..7d3d76f1e7d 100644 --- a/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs +++ b/com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs @@ -1059,6 +1059,9 @@ public void ReplaceWith(GraphData other) if (other == null) throw new ArgumentException("Can only replace with another AbstractMaterialGraph", "other"); + concretePrecision = other.concretePrecision; + m_ActiveOutputNodeGuid = other.m_ActiveOutputNodeGuid; + using (var removedInputsPooledObject = ListPool.GetDisposable()) { var removedInputGuids = removedInputsPooledObject.value; diff --git a/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs b/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs index 87fdfdca02f..ea369eb039a 100644 --- a/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs +++ b/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs @@ -164,10 +164,12 @@ public GraphEditorView(EditorWindow editorWindow, GraphData graph, MessageManage EditorGUI.BeginChangeCheck(); GUILayout.Label("Precision"); - graph.concretePrecision = (ConcretePrecision)EditorGUILayout.EnumPopup(graph.concretePrecision, GUILayout.Width(100f)); - GUILayout.Space(4); + 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 e0928f2e2a4..dd3be5f1331 100644 --- a/com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs +++ b/com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs @@ -335,6 +335,7 @@ public override void BuildContextualMenu(ContextualMenuPopulateEvent evt) void SetMasterAsActive(DropdownMenuAction action) { + node.owner.owner.RegisterCompleteObjectUndo("Change Active Master"); node.owner.activeOutputNodeGuid = node.guid; } 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); } }