From ed504753f45c1dd4a5bedd0902e4e8c4d1f5b6bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 24 Jun 2019 12:08:28 +0200 Subject: [PATCH] Fix undo references for conversion to CPUParticles The 'undo' reference should be the node to free when the undo history is lost, i.e. the original (GPU) Particles node. Similarly, the 'do' reference should point to the CPUParticles (result of the 'do' call). Fixes #29742. --- editor/plugins/particles_2d_editor_plugin.cpp | 4 ++-- editor/plugins/particles_editor_plugin.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index 6fabdc93c6..0147ce2a4e 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -96,9 +96,9 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) { UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); ur->create_action(TTR("Convert to CPUParticles")); ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", particles, cpu_particles, true, false); - ur->add_do_reference(particles); + ur->add_do_reference(cpu_particles); ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, particles, false, false); - ur->add_undo_reference(this); + ur->add_undo_reference(particles); ur->commit_action(); } break; diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 3f4f66a26d..ddcd332a1d 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -315,9 +315,9 @@ void ParticlesEditor::_menu_option(int p_option) { UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); ur->create_action(TTR("Convert to CPUParticles")); ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", node, cpu_particles, true, false); - ur->add_do_reference(node); + ur->add_do_reference(cpu_particles); ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, node, false, false); - ur->add_undo_reference(this); + ur->add_undo_reference(node); ur->commit_action(); } break;