diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-02-15 20:48:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-15 20:48:18 +0100 |
commit | 98b97d34df7f3ab2cafc3847358c231c3d357b40 (patch) | |
tree | 431aa6f107e860aa1e1f4ae8864f9b06e8ace169 /scene/3d/visible_on_screen_notifier_3d.cpp | |
parent | 6d575873969609e6ed58dee5052d23512b104498 (diff) | |
parent | 0f5455230c8955be0c6533574bd3d5b6f50792b6 (diff) |
Merge pull request #58151 from akien-mga/notification-switch-scene
Diffstat (limited to 'scene/3d/visible_on_screen_notifier_3d.cpp')
-rw-r--r-- | scene/3d/visible_on_screen_notifier_3d.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/scene/3d/visible_on_screen_notifier_3d.cpp b/scene/3d/visible_on_screen_notifier_3d.cpp index 44d2a3e03f..11367d7ca9 100644 --- a/scene/3d/visible_on_screen_notifier_3d.cpp +++ b/scene/3d/visible_on_screen_notifier_3d.cpp @@ -71,8 +71,11 @@ bool VisibleOnScreenNotifier3D::is_on_screen() const { } void VisibleOnScreenNotifier3D::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_EXIT_TREE) { - on_screen = false; + switch (p_what) { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_EXIT_TREE: { + on_screen = false; + } break; } } @@ -161,21 +164,23 @@ void VisibleOnScreenEnabler3D::_update_enable_mode(bool p_enable) { } } void VisibleOnScreenEnabler3D::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE) { - if (Engine::get_singleton()->is_editor_hint()) { - return; - } + switch (p_what) { + case NOTIFICATION_ENTER_TREE: { + if (Engine::get_singleton()->is_editor_hint()) { + return; + } - node_id = ObjectID(); - Node *node = get_node(enable_node_path); - if (node) { - node_id = node->get_instance_id(); - node->set_process_mode(PROCESS_MODE_DISABLED); - } - } + node_id = ObjectID(); + Node *node = get_node(enable_node_path); + if (node) { + node_id = node->get_instance_id(); + node->set_process_mode(PROCESS_MODE_DISABLED); + } + } break; - if (p_what == NOTIFICATION_EXIT_TREE) { - node_id = ObjectID(); + case NOTIFICATION_EXIT_TREE: { + node_id = ObjectID(); + } break; } } |