summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scene/3d/particles.cpp7
-rw-r--r--servers/visual/visual_server_raster.h2
-rw-r--r--servers/visual/visual_server_wrap_mt.h2
-rw-r--r--servers/visual_server.cpp2
-rw-r--r--servers/visual_server.h2
5 files changed, 15 insertions, 0 deletions
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index 241eb7d1ca..06b5613eb8 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -331,6 +331,13 @@ void Particles::_notification(int p_what) {
set_process_internal(false);
}
}
+
+ if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
+ // make sure particles are updated before rendering occurs if they were active before
+ if (is_visible_in_tree() && !VS::get_singleton()->particles_is_inactive(particles)) {
+ VS::get_singleton()->particles_request_process(particles);
+ }
+ }
}
void Particles::_bind_methods() {
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index 0df228457e..06096781fe 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -409,6 +409,8 @@ public:
BIND2(particles_set_process_material, RID, RID)
BIND2(particles_set_fixed_fps, RID, int)
BIND2(particles_set_fractional_delta, RID, bool)
+ BIND1R(bool, particles_is_inactive, RID)
+ BIND1(particles_request_process, RID)
BIND1(particles_restart, RID)
BIND2(particles_set_draw_order, RID, VS::ParticlesDrawOrder)
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index 273cf728c1..59df51ff19 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -343,6 +343,8 @@ public:
FUNC2(particles_set_process_material, RID, RID)
FUNC2(particles_set_fixed_fps, RID, int)
FUNC2(particles_set_fractional_delta, RID, bool)
+ FUNC1R(bool, particles_is_inactive, RID)
+ FUNC1(particles_request_process, RID)
FUNC1(particles_restart, RID)
FUNC2(particles_set_draw_order, RID, VS::ParticlesDrawOrder)
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index 4bab9b76ba..b095f24212 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -1844,6 +1844,8 @@ void VisualServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("particles_set_process_material", "particles", "material"), &VisualServer::particles_set_process_material);
ClassDB::bind_method(D_METHOD("particles_set_fixed_fps", "particles", "fps"), &VisualServer::particles_set_fixed_fps);
ClassDB::bind_method(D_METHOD("particles_set_fractional_delta", "particles", "enable"), &VisualServer::particles_set_fractional_delta);
+ ClassDB::bind_method(D_METHOD("particles_is_inactive", "particles"), &VisualServer::particles_is_inactive);
+ ClassDB::bind_method(D_METHOD("particles_request_process", "particles"), &VisualServer::particles_request_process);
ClassDB::bind_method(D_METHOD("particles_restart", "particles"), &VisualServer::particles_restart);
ClassDB::bind_method(D_METHOD("particles_set_draw_order", "particles", "order"), &VisualServer::particles_set_draw_order);
ClassDB::bind_method(D_METHOD("particles_set_draw_passes", "particles", "count"), &VisualServer::particles_set_draw_passes);
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 5e6c4d9b1e..1c1b04f198 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -560,6 +560,8 @@ public:
virtual void particles_set_process_material(RID p_particles, RID p_material) = 0;
virtual void particles_set_fixed_fps(RID p_particles, int p_fps) = 0;
virtual void particles_set_fractional_delta(RID p_particles, bool p_enable) = 0;
+ virtual bool particles_is_inactive(RID p_particles) = 0;
+ virtual void particles_request_process(RID p_particles) = 0;
virtual void particles_restart(RID p_particles) = 0;
enum ParticlesDrawOrder {