Skip to content

Fixes for 3 cases of undo not working #259

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 4 commits 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 @@ -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/)

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 @@ -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<ShaderInput>.Get())
{
foreach (var property in m_Properties.SelectValue())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<MaterialNodeView>().ToList();
m_ColorManager.SetNodesDirty(nodeList);
graph.ValidateGraph();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

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