diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-05-31 10:05:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-31 10:05:09 +0200 |
commit | ca6a2669df43b73fe3f017d4b643cdf22a9dcdb9 (patch) | |
tree | 3546b4b05944ec480e66d29dc860216ba582bd59 | |
parent | 6b27b7d11304eca4d76c616792215c66d5d5d70e (diff) | |
parent | 1141ab8b25a836278f244f4270163271395d475c (diff) |
Merge pull request #29328 from KoBeWi/undo_cpuparticles_too
Allow undo of conversion to CPUParticles
-rw-r--r-- | editor/plugins/particles_2d_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/particles_editor_plugin.cpp | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index 4c354b8002..6fabdc93c6 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -94,7 +94,7 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) { cpu_particles->set_z_index(particles->get_z_index()); UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Convert from Particles2D")); + 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_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, particles, false, false); diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 09180edf2a..66cecf7068 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -312,7 +312,13 @@ void ParticlesEditor::_menu_option(int p_option) { cpu_particles->set_visible(node->is_visible()); cpu_particles->set_pause_mode(node->get_pause_mode()); - EditorNode::get_singleton()->get_scene_tree_dock()->replace_node(node, cpu_particles, false); + 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_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, node, false, false); + ur->add_undo_reference(this); + ur->commit_action(); } break; } |