You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Add emission shape gizmos to Particles2D
This commit is contained in:
@@ -291,22 +291,29 @@ Particles2DEditorPlugin::Particles2DEditorPlugin() {
|
||||
emission_mask->connect(SceneStringName(confirmed), callable_mp(this, &Particles2DEditorPlugin::_generate_emission_mask));
|
||||
}
|
||||
|
||||
void GPUParticles2DEditorPlugin::_selection_changed() {
|
||||
void Particles2DEditorPlugin::_selection_changed() {
|
||||
List<Node *> selected_nodes = EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list();
|
||||
if (selected_particles.is_empty() && selected_nodes.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (GPUParticles2D *particles : selected_particles) {
|
||||
particles->set_show_visibility_rect(false);
|
||||
for (Node *particles : selected_particles) {
|
||||
if (GPUParticles2D *gpu_particles = Object::cast_to<GPUParticles2D>(particles)) {
|
||||
gpu_particles->set_show_gizmos(false);
|
||||
} else if (CPUParticles2D *cpu_particles = Object::cast_to<CPUParticles2D>(particles)) {
|
||||
cpu_particles->set_show_gizmos(false);
|
||||
}
|
||||
}
|
||||
|
||||
selected_particles.clear();
|
||||
|
||||
for (Node *node : selected_nodes) {
|
||||
GPUParticles2D *selected_particle = Object::cast_to<GPUParticles2D>(node);
|
||||
if (selected_particle) {
|
||||
selected_particle->set_show_visibility_rect(true);
|
||||
selected_particles.push_back(selected_particle);
|
||||
if (GPUParticles2D *selected_gpu_particle = Object::cast_to<GPUParticles2D>(node)) {
|
||||
selected_gpu_particle->set_show_gizmos(true);
|
||||
selected_particles.push_back(selected_gpu_particle);
|
||||
} else if (CPUParticles2D *selected_cpu_particle = Object::cast_to<CPUParticles2D>(node)) {
|
||||
selected_cpu_particle->set_show_gizmos(true);
|
||||
selected_particles.push_back(selected_cpu_particle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -353,10 +360,10 @@ void GPUParticles2DEditorPlugin::_generate_visibility_rect() {
|
||||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
void GPUParticles2DEditorPlugin::_notification(int p_what) {
|
||||
void Particles2DEditorPlugin::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed", callable_mp(this, &GPUParticles2DEditorPlugin::_selection_changed));
|
||||
EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed", callable_mp(this, &Particles2DEditorPlugin::_selection_changed));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user