diff options
author | Juan Linietsky <reduzio@gmail.com> | 2019-01-14 13:41:54 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2019-01-14 13:41:54 -0300 |
commit | 6f884cc88409fa1eb25b95f0fe91fc848c1b1481 (patch) | |
tree | 751d96196a16bb693566f38bf4d157c2f6ac43e0 /editor/plugins | |
parent | ed9b230744eb5dbb3a5e956c32ea87791abed68c (diff) |
Use SceneTreeDock to replace particles node properly, fixes #24162
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/particles_2d_editor_plugin.cpp | 9 | ||||
-rw-r--r-- | editor/plugins/particles_editor_plugin.cpp | 9 |
2 files changed, 2 insertions, 16 deletions
diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index 6a674760b7..a944674cbd 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -85,8 +85,6 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) { } break; case MENU_OPTION_CONVERT_TO_CPU_PARTICLES: { - UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); - CPUParticles2D *cpu_particles = memnew(CPUParticles2D); cpu_particles->convert_from_particles(particles); cpu_particles->set_name(particles->get_name()); @@ -94,12 +92,7 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) { cpu_particles->set_visible(particles->is_visible()); cpu_particles->set_pause_mode(particles->get_pause_mode()); - undo_redo->create_action("Replace Particles by CPUParticles"); - undo_redo->add_do_method(particles, "replace_by", cpu_particles); - undo_redo->add_undo_method(cpu_particles, "replace_by", particles); - undo_redo->add_do_reference(cpu_particles); - undo_redo->add_undo_reference(particles); - undo_redo->commit_action(); + EditorNode::get_singleton()->get_scene_tree_dock()->replace_node(particles, cpu_particles, false); } break; } diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 7e35e30a89..95828064ac 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -305,8 +305,6 @@ void ParticlesEditor::_menu_option(int p_option) { } break; case MENU_OPTION_CONVERT_TO_CPU_PARTICLES: { - UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); - CPUParticles *cpu_particles = memnew(CPUParticles); cpu_particles->convert_from_particles(node); cpu_particles->set_name(node->get_name()); @@ -314,12 +312,7 @@ void ParticlesEditor::_menu_option(int p_option) { cpu_particles->set_visible(node->is_visible()); cpu_particles->set_pause_mode(node->get_pause_mode()); - undo_redo->create_action("Replace Particles by CPUParticles"); - undo_redo->add_do_method(node, "replace_by", cpu_particles); - undo_redo->add_undo_method(cpu_particles, "replace_by", node); - undo_redo->add_do_reference(cpu_particles); - undo_redo->add_undo_reference(node); - undo_redo->commit_action(); + EditorNode::get_singleton()->get_scene_tree_dock()->replace_node(node, cpu_particles, false); } break; } |