Refactored cpu_particles_2d.cpp _notification Method
Refactors the _notification method in cpu_particles_2d.cpp to use a switch statement for readability and to bring it inline with other classes like node.cpp and timer.cpp.
This commit is contained in:
parent
165d77a496
commit
821591a95b
1 changed files with 57 additions and 59 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue