Skip to content

Commit

Permalink
Update GPUParticles2D/3D speed scale on ENTER_TREE
Browse files Browse the repository at this point in the history
Fix for godotengine#75218

Pause notifications are not sent when a node is added as a child. So GPUParticles2D should also obey its can_process status on ENTER_TREE, not just PAUSED/UNPAUSED.
  • Loading branch information
newobj committed Mar 27, 2023
1 parent 6ef2f35 commit 4652fbd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scene/2d/gpu_particles_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,11 @@ void GPUParticles2D::_notification(int p_what) {
if (sub_emitter != NodePath()) {
_attach_sub_emitter();
}
if (can_process()) {
RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
} else {
RS::get_singleton()->particles_set_speed_scale(particles, 0);
}
} break;

case NOTIFICATION_EXIT_TREE: {
Expand Down
5 changes: 5 additions & 0 deletions scene/3d/gpu_particles_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,11 @@ void GPUParticles3D::_notification(int p_what) {
if (sub_emitter != NodePath()) {
_attach_sub_emitter();
}
if (can_process()) {
RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
} else {
RS::get_singleton()->particles_set_speed_scale(particles, 0);
}
} break;

case NOTIFICATION_EXIT_TREE: {
Expand Down

0 comments on commit 4652fbd

Please sign in to comment.