You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Remove animation loop from ParticlesMaterial + improvements to CPUParticles2D
Remove animation loop from ParticlesMaterial and move it to SpatialMaterial for 3D particles and Particles2D for the 2D case. Added animation to CPUParticles2D as well as the "Convert to CPUParticles2D" to the PAarticles2D menu.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "canvas_item_editor_plugin.h"
|
||||
#include "core/io/image_loader.h"
|
||||
#include "scene/2d/cpu_particles_2d.h"
|
||||
#include "scene/gui/separator.h"
|
||||
#include "scene/resources/particles_material.h"
|
||||
|
||||
@@ -82,6 +83,25 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) {
|
||||
|
||||
emission_mask->popup_centered_minsize();
|
||||
} 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());
|
||||
cpu_particles->set_transform(particles->get_transform());
|
||||
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();
|
||||
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,6 +375,8 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) {
|
||||
menu->get_popup()->add_separator();
|
||||
menu->get_popup()->add_item(TTR("Load Emission Mask"), MENU_LOAD_EMISSION_MASK);
|
||||
// menu->get_popup()->add_item(TTR("Clear Emission Mask"), MENU_CLEAR_EMISSION_MASK);
|
||||
menu->get_popup()->add_separator();
|
||||
menu->get_popup()->add_item(TTR("Convert to CPUParticles"), MENU_OPTION_CONVERT_TO_CPU_PARTICLES);
|
||||
menu->set_text(TTR("Particles"));
|
||||
toolbar->add_child(menu);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user