1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-21 09:46:03 +08:00

Added undo support and default graph name to SceneGraph

This commit is contained in:
Thor Brigsted 2020-04-03 15:01:44 +02:00
parent f3b211ed83
commit f899e48ee0

View File

@ -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";
} }
} }
} }