Skip to content

Commit d3c89e8

Browse files
committed
Fix finished signal on GPU particles
1 parent be3ecae commit d3c89e8

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

scene/2d/gpu_particles_2d.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ void GPUParticles2D::set_lifetime(double p_lifetime) {
8181
}
8282

8383
void GPUParticles2D::set_one_shot(bool p_enable) {
84+
if (one_shot == p_enable) {
85+
return;
86+
}
8487
one_shot = p_enable;
8588
RS::get_singleton()->particles_set_one_shot(particles, one_shot);
8689

@@ -90,8 +93,11 @@ void GPUParticles2D::set_one_shot(bool p_enable) {
9093
RenderingServer::get_singleton()->particles_restart(particles);
9194
}
9295
}
93-
94-
if (!one_shot) {
96+
if (one_shot) {
97+
active = true;
98+
emission_time = lifetime;
99+
active_time = lifetime * (2 - explosiveness_ratio);
100+
} else {
95101
set_process_internal(false);
96102
}
97103
}

scene/3d/gpu_particles_3d.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ void GPUParticles3D::set_interp_to_end(float p_interp) {
8989
}
9090

9191
void GPUParticles3D::set_one_shot(bool p_one_shot) {
92+
if (one_shot == p_one_shot) {
93+
return;
94+
}
9295
one_shot = p_one_shot;
9396
RS::get_singleton()->particles_set_one_shot(particles, one_shot);
9497

@@ -97,6 +100,11 @@ void GPUParticles3D::set_one_shot(bool p_one_shot) {
97100
RenderingServer::get_singleton()->particles_restart(particles);
98101
}
99102
}
103+
if (one_shot) {
104+
active = true;
105+
emission_time = lifetime;
106+
active_time = lifetime * (2 - explosiveness_ratio);
107+
}
100108
}
101109

102110
void GPUParticles3D::set_use_fixed_seed(bool p_use_fixed_seed) {

0 commit comments

Comments
 (0)