Merge pull request #30905 from clayjohn/set-cpuparticles2d-visible

Toggle CPUParticles2D visibility when redrawing
This commit is contained in:
Rémi Verschelde 2019-08-01 18:13:28 +02:00 committed by GitHub
commit 77e8947687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

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