|
@@ -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);
|
|
|
}
|
|
|
|