summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-05-30 14:14:21 +0200
committerGitHub <noreply@github.com>2019-05-30 14:14:21 +0200
commit0c74aae57616fb91dd348cb485404486a95a2064 (patch)
treeeeb7494c5216f389f072e2b61aeccc7bd6e8fc90 /editor/plugins
parent19e5d21e115ee1900cae8d5bb386ade57ecc87a2 (diff)
parent21078621dd1323115f6a96cac1565b0d030f30ae (diff)
Merge pull request #29308 from hbina/fixing_undo_2d_particles
added ability to undo conversion of Particles2D to CPUParticles2D
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/particles_2d_editor_plugin.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp
index 50bdf4512b..4c354b8002 100644
--- a/editor/plugins/particles_2d_editor_plugin.cpp
+++ b/editor/plugins/particles_2d_editor_plugin.cpp
@@ -93,7 +93,13 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) {
cpu_particles->set_pause_mode(particles->get_pause_mode());
cpu_particles->set_z_index(particles->get_z_index());
- EditorNode::get_singleton()->get_scene_tree_dock()->replace_node(particles, cpu_particles, false);
+ UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ ur->create_action(TTR("Convert from Particles2D"));
+ 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);
+ ur->add_undo_reference(this);
+ ur->commit_action();
} break;
}