summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorBrian Long <newobj@gmail.com>2023-03-27 09:15:59 -0700
committerYuri Sizov <yuris@humnom.net>2023-03-30 19:15:47 +0200
commit838a82f8858c859a9ceda4049904bf263604cbd4 (patch)
tree6019058d607aca123d37b67bd4d2ca0dbcc1cfbc /scene
parentdc100cbebb5ebe557fc23e1902a4288d509dda97 (diff)
Update GPUParticles2D/3D speed scale on ENTER_TREE
Fix for https://github.com/godotengine/godot/issues/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. (cherry picked from commit 4652fbd09e81741a146c7dd1dcc89bf4235bdb75)
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/gpu_particles_2d.cpp5
-rw-r--r--scene/3d/gpu_particles_3d.cpp5
2 files changed, 10 insertions, 0 deletions
diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp
index 3f887ae9f3..08c7b8e131 100644
--- a/scene/2d/gpu_particles_2d.cpp
+++ b/scene/2d/gpu_particles_2d.cpp
@@ -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: {
diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp
index 8eb1820cf8..b4131ff4b2 100644
--- a/scene/3d/gpu_particles_3d.cpp
+++ b/scene/3d/gpu_particles_3d.cpp
@@ -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: {