1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-21 01:36: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);
if (GUILayout.Button("Remove")) {
removeSafely = false;
Undo.RecordObject(sceneGraph, "Removed graph");
sceneGraph.graph = null;
}
GUI.color = Color.white;
@ -68,9 +69,9 @@ namespace XNodeEditor {
}
public void CreateGraph(Type type) {
serializedObject.Update();
Undo.RecordObject(sceneGraph, "Create graph");
sceneGraph.graph = ScriptableObject.CreateInstance(type) as NodeGraph;
serializedObject.ApplyModifiedProperties();
sceneGraph.graph.name = sceneGraph.name + "-graph";
}
}
}