summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatrim <maly@kinet.cz>2018-08-16 11:24:49 +0200
committerNatrim <maly@kinet.cz>2018-08-16 15:35:12 +0200
commite11e080fa25c118a0d2f56d80633301a7d949bcc (patch)
tree7ce251dfc208cddc6331cf2bb2c7a77b1ac3a05d
parent1c17c2b9b39d9c6e7440d25251ac8b1a1fede5bb (diff)
Particles2D: set emitting if not set before generating Visibility Rect
and removed not needed running zeroing in ParticlesEditor::_generate_aabb
-rw-r--r--editor/plugins/particles_2d_editor_plugin.cpp15
-rw-r--r--editor/plugins/particles_editor_plugin.cpp1
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) {