diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-08-16 18:27:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-16 18:27:23 +0200 |
commit | e06825ba4b207346902ddb54a29f45f82ec6f8a2 (patch) | |
tree | a3856e17eb34306d3eee251dd8bb3292bf85aeb8 /editor | |
parent | b83f72ce12ad2765ca7c8180b8f1760bd57cc277 (diff) | |
parent | e11e080fa25c118a0d2f56d80633301a7d949bcc (diff) |
Merge pull request #21067 from natrim/Particles2D_AABB
Particles2D: set emitting if not set before generating Visibility Rect
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/particles_2d_editor_plugin.cpp | 15 | ||||
-rw-r--r-- | editor/plugins/particles_editor_plugin.cpp | 1 |
2 files changed, 15 insertions, 1 deletions
diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index c2b17189ef..b50e0dfe88 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -68,6 +68,11 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) { switch (p_idx) { case MENU_GENERATE_VISIBILITY_RECT: { + float gen_time = particles->get_lifetime(); + if (gen_time < 1.0) + generate_seconds->set_value(1.0); + else + generate_seconds->set_value(trunc(gen_time) + 1.0); generate_aabb->popup_centered_minsize(); } break; case MENU_LOAD_EMISSION_MASK: { @@ -90,6 +95,12 @@ void Particles2DEditorPlugin::_generate_visibility_rect() { EditorProgress ep("gen_aabb", TTR("Generating AABB"), int(time)); + bool was_emitting = particles->is_emitting(); + if (!was_emitting) { + particles->set_emitting(true); + OS::get_singleton()->delay_usec(1000); + } + Rect2 rect; while (running < time) { @@ -106,6 +117,10 @@ void Particles2DEditorPlugin::_generate_visibility_rect() { running += (OS::get_singleton()->get_ticks_usec() - ticks) / 1000000.0; } + if (!was_emitting) { + particles->set_emitting(false); + } + particles->set_visibility_rect(rect); } diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 7732103220..6a99dcb9a5 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -335,7 +335,6 @@ void ParticlesEditor::_generate_aabb() { OS::get_singleton()->delay_usec(1000); } - running = 0.0; AABB rect; while (running < time) { |