Explorar o código

toggle CPUParticles2D visibility when redrawing

clayjohn %!s(int64=6) %!d(string=hai) anos
pai
achega
cb4d145c22
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      scene/2d/cpu_particles_2d.cpp

+ 4 - 0
scene/2d/cpu_particles_2d.cpp

@@ -962,9 +962,13 @@ void CPUParticles2D::_set_redraw(bool p_redraw) {
 	if (redraw) {
 		VS::get_singleton()->connect("frame_pre_draw", this, "_update_render_thread");
 		VS::get_singleton()->canvas_item_set_update_when_visible(get_canvas_item(), true);
+
+		VS::get_singleton()->multimesh_set_visible_instances(multimesh, -1);
 	} else {
 		VS::get_singleton()->disconnect("frame_pre_draw", this, "_update_render_thread");
 		VS::get_singleton()->canvas_item_set_update_when_visible(get_canvas_item(), false);
+
+		VS::get_singleton()->multimesh_set_visible_instances(multimesh, 0);
 	}
 #ifndef NO_THREADS
 	update_mutex->unlock();