Use switch consistently in _notification (scene folder)

This commit is contained in:
Rémi Verschelde 2022-02-15 18:06:48 +01:00
parent 171021145d
commit 0f5455230c
No known key found for this signature in database
GPG key ID: C3336907360768E1
127 changed files with 2853 additions and 2601 deletions

View file

@ -66,23 +66,25 @@ void SpriteBase3D::_propagate_color_changed() {
}
void SpriteBase3D::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
if (!pending_update) {
_im_update();
}
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
if (!pending_update) {
_im_update();
}
parent_sprite = Object::cast_to<SpriteBase3D>(get_parent());
if (parent_sprite) {
pI = parent_sprite->children.push_back(this);
}
}
parent_sprite = Object::cast_to<SpriteBase3D>(get_parent());
if (parent_sprite) {
pI = parent_sprite->children.push_back(this);
}
} break;
if (p_what == NOTIFICATION_EXIT_TREE) {
if (parent_sprite) {
parent_sprite->children.erase(pI);
pI = nullptr;
parent_sprite = nullptr;
}
case NOTIFICATION_EXIT_TREE: {
if (parent_sprite) {
parent_sprite->children.erase(pI);
pI = nullptr;
parent_sprite = nullptr;
}
} break;
}
}