mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-21 17:56:06 +08:00
Added undo support and default graph name to SceneGraph
This commit is contained in:
parent
f3b211ed83
commit
f899e48ee0
@ -37,6 +37,7 @@ namespace XNodeEditor {
|
|||||||
GUI.color = new Color(1, 0.8f, 0.8f);
|
GUI.color = new Color(1, 0.8f, 0.8f);
|
||||||
if (GUILayout.Button("Remove")) {
|
if (GUILayout.Button("Remove")) {
|
||||||
removeSafely = false;
|
removeSafely = false;
|
||||||
|
Undo.RecordObject(sceneGraph, "Removed graph");
|
||||||
sceneGraph.graph = null;
|
sceneGraph.graph = null;
|
||||||
}
|
}
|
||||||
GUI.color = Color.white;
|
GUI.color = Color.white;
|
||||||
@ -68,9 +69,9 @@ namespace XNodeEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void CreateGraph(Type type) {
|
public void CreateGraph(Type type) {
|
||||||
serializedObject.Update();
|
Undo.RecordObject(sceneGraph, "Create graph");
|
||||||
sceneGraph.graph = ScriptableObject.CreateInstance(type) as NodeGraph;
|
sceneGraph.graph = ScriptableObject.CreateInstance(type) as NodeGraph;
|
||||||
serializedObject.ApplyModifiedProperties();
|
sceneGraph.graph.name = sceneGraph.name + "-graph";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user