From 51151678213ff82e9e38f62834f7454904c38638 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 22 Jan 2022 01:31:11 +0100 Subject: [PATCH] Also added undo redo support for creating and removing nodes in mat_maker_gd's addon. --- .../mat_maker_gd/editor/MatMakerGDEditor.gd | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/game/addons/mat_maker_gd/editor/MatMakerGDEditor.gd b/game/addons/mat_maker_gd/editor/MatMakerGDEditor.gd index 3ac69f95..cc696407 100644 --- a/game/addons/mat_maker_gd/editor/MatMakerGDEditor.gd +++ b/game/addons/mat_maker_gd/editor/MatMakerGDEditor.gd @@ -173,7 +173,14 @@ func on_graph_node_close_request(node : GraphNode) -> void: ignore_changes(true) _material.cancel_render_and_wait() - _material.remove_node(node._node) + + #_material.remove_node(node._node) + + _undo_redo.create_action("MMGD: Remove Node") + _undo_redo.add_do_method(_material, "remove_node", node._node) + _undo_redo.add_undo_method(_material, "add_node", node._node) + _undo_redo.commit_action() + recreate() ignore_changes(false) @@ -198,7 +205,12 @@ func _on_AddPopup_ok_pressed(script_path : String): ignore_changes(true) - _material.add_node(nnode) + #_material.add_node(nnode) + + _undo_redo.create_action("MMGD: Add Node") + _undo_redo.add_do_method(_material, "add_node", nnode) + _undo_redo.add_undo_method(_material, "remove_node", nnode) + _undo_redo.commit_action() var gn : GraphNode = MMGraphNode.new() gn.slot_colors = slot_colors