Skip to content

[7.x.x][Shader Graph] Fixes for 3 cases of undo not working #370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.shadergraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed
- Fixed a bug where the `Position` node would change coordinate spaces from `World` to `Absolute World` when shaders recompile. [1184617](https://issuetracker.unity3d.com/product/unity/issues/guid/1184617/)
- Fixed a bug where `Scene Depth` nodes would stop working after adding a keyword on the blackboard. [1203333](https://issuetracker.unity3d.com/product/unity/issues/guid/1203333/)
- Fixed undo not being recorded properly for setting active master node, graph precision, and node defaults.

## [7.3.0] - 2020-03-11

Expand Down
3 changes: 3 additions & 0 deletions com.unity.shadergraph/Editor/Data/Graphs/GraphData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Guid>.GetDisposable())
{
var removedInputGuids = removedInputsPooledObject.value;
Expand Down
6 changes: 4 additions & 2 deletions com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,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<MaterialNodeView>().ToList();
m_ColorManager.SetNodesDirty(nodeList);
graph.ValidateGraph();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<FocusOutEvent>(evt =>
{
m_UndoGroup = -1;
});
{
m_Node.owner.owner.isDirty = true;
m_UndoGroup = -1;
});
Add(field);
}
}
Expand Down