diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-06-24 12:08:28 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2019-06-24 12:08:30 +0200 |
commit | ed504753f45c1dd4a5bedd0902e4e8c4d1f5b6bc (patch) | |
tree | 52bb8a351bc7584d352761b1e18257dfe78f8b1e | |
parent | 5e213103438c65134b75f9cd3b352502bada0c6d (diff) |
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.
-rw-r--r-- | editor/plugins/particles_2d_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | 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; |