From 48f5fbfcbb259ce1709c0a6c91779b507dc081e5 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 8 Mar 2022 12:12:14 +0100 Subject: [PATCH] Also added undo redo support fro the gradient editor's interpolation type dropdown. --- .../widgets/gradient_editor/gradient_editor.gd | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/game/addons/mat_maker_gd/widgets/gradient_editor/gradient_editor.gd b/game/addons/mat_maker_gd/widgets/gradient_editor/gradient_editor.gd index 26fe9355..180a2cd1 100644 --- a/game/addons/mat_maker_gd/widgets/gradient_editor/gradient_editor.gd +++ b/game/addons/mat_maker_gd/widgets/gradient_editor/gradient_editor.gd @@ -267,7 +267,15 @@ func update_preview() -> void: call_deferred("generate_preview_image") func _on_Interpolation_item_selected(ID) -> void: - value.interpolation_type = ID + ignore_changes(true) + + _undo_redo.create_action("MMGD: gradient interpolation_type changed") + _undo_redo.add_do_method(value, "set_interpolation_type", ID) + _undo_redo.add_undo_method(value, "set_interpolation_type", value.interpolation_type) + _undo_redo.commit_action() + + ignore_changes(false) + update_preview() func on_resized() -> void: