Merge pull request #21067 from natrim/Particles2D_AABB
Particles2D: set emitting if not set before generating Visibility Rect
This commit is contained in:
commit
e06825ba4b
2 changed files with 15 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -335,7 +335,6 @@ void ParticlesEditor::_generate_aabb() {
|
|||
OS::get_singleton()->delay_usec(1000);
|
||||
}
|
||||
|
||||
running = 0.0;
|
||||
AABB rect;
|
||||
|
||||
while (running < time) {
|
||||
|
|
Loading…
Reference in a new issue