Merge pull request #46536 from likeich/master

Refactored cpu_particles_2d.cpp _notification Method
This commit is contained in:
Rémi Verschelde 2021-03-01 09:42:08 +01:00 committed by GitHub
commit d9c7dd910f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1032,15 +1032,14 @@ void CPUParticles2D::_update_render_thread() {
}
void CPUParticles2D::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
set_process_internal(emitting);
}
if (p_what == NOTIFICATION_EXIT_TREE) {
} break;
case NOTIFICATION_EXIT_TREE: {
_set_redraw(false);
}
if (p_what == NOTIFICATION_DRAW) {
} break;
case NOTIFICATION_DRAW: {
// first update before rendering to avoid one frame delay after emitting starts
if (emitting && (time == 0)) {
_update_internal();
@ -1056,13 +1055,11 @@ void CPUParticles2D::_notification(int p_what) {
}
RS::get_singleton()->canvas_item_add_multimesh(get_canvas_item(), multimesh, texrid);
}
if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
} break;
case NOTIFICATION_INTERNAL_PROCESS: {
_update_internal();
}
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
inv_emission_transform = get_global_transform().affine_inverse();
if (!local_coords) {
@ -1092,6 +1089,7 @@ void CPUParticles2D::_notification(int p_what) {
ptr += 16;
}
}
} break;
}
}