Merge pull request #29308 from hbina/fixing_undo_2d_particles

added ability to undo conversion of Particles2D to CPUParticles2D
This commit is contained in:
Rémi Verschelde 2019-05-30 14:14:21 +02:00 committed by GitHub
commit 0c74aae576
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}