Skip to content

Commit efc6353

Browse files
Fixes for 3 cases of undo not working (#369)
Co-authored-by: Marc Templin <marcte@unity3d.com>
1 parent 75644fd commit efc6353

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

com.unity.shadergraph/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased]
88

9-
Version Updated
10-
The version number for this package has increased due to a version update of a related graphics package.
9+
### Fixed
10+
- Fixed undo not being recorded properly for setting active master node, graph precision, and node defaults.
1111

1212
## [8.1.0] - 2020-04-21
1313

com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,9 @@ public void ReplaceWith(GraphData other)
10591059
if (other == null)
10601060
throw new ArgumentException("Can only replace with another AbstractMaterialGraph", "other");
10611061

1062+
concretePrecision = other.concretePrecision;
1063+
m_ActiveOutputNodeGuid = other.m_ActiveOutputNodeGuid;
1064+
10621065
using (var removedInputsPooledObject = ListPool<Guid>.GetDisposable())
10631066
{
10641067
var removedInputGuids = removedInputsPooledObject.value;

com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,12 @@ public GraphEditorView(EditorWindow editorWindow, GraphData graph, MessageManage
164164

165165
EditorGUI.BeginChangeCheck();
166166
GUILayout.Label("Precision");
167-
graph.concretePrecision = (ConcretePrecision)EditorGUILayout.EnumPopup(graph.concretePrecision, GUILayout.Width(100f));
168-
GUILayout.Space(4);
167+
var precision = (ConcretePrecision)EditorGUILayout.EnumPopup(graph.concretePrecision, GUILayout.Width(100f));
169168
if (EditorGUI.EndChangeCheck())
170169
{
170+
m_Graph.owner.RegisterCompleteObjectUndo("Changed Graph Precision");
171+
graph.concretePrecision = precision;
172+
171173
var nodeList = m_GraphView.Query<MaterialNodeView>().ToList();
172174
m_ColorManager.SetNodesDirty(nodeList);
173175
graph.ValidateGraph();

com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ public override void BuildContextualMenu(ContextualMenuPopulateEvent evt)
335335

336336
void SetMasterAsActive(DropdownMenuAction action)
337337
{
338+
node.owner.owner.RegisterCompleteObjectUndo("Change Active Master");
338339
node.owner.activeOutputNodeGuid = node.guid;
339340
}
340341

com.unity.shadergraph/Editor/Drawing/Views/Slots/MultiFloatSlotControlView.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ void AddField(Vector4 initialValue, int index, string subLabel)
7070
m_Node.Dirty(ModificationScope.Node);
7171
}
7272
});
73-
// Reset UndoGroup when done editing input field
73+
// Reset UndoGroup when done editing input field & update title
7474
field.Q("unity-text-input").RegisterCallback<FocusOutEvent>(evt =>
75-
{
76-
m_UndoGroup = -1;
77-
});
75+
{
76+
m_Node.owner.owner.isDirty = true;
77+
m_UndoGroup = -1;
78+
});
7879
Add(field);
7980
}
8081
}

0 commit comments

Comments
 (0)