Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Fix 3D editor visibility problems

kobewi04dbdaa226a2
diff --git a/editor/scene/3d/node_3d_editor_plugin.cpp b/editor/scene/3d/node_3d_editor_plugin.cpp
index fa905547572..e0bf361afea 100644
--- a/editor/scene/3d/node_3d_editor_plugin.cpp
+++ b/editor/scene/3d/node_3d_editor_plugin.cpp
@@ -2473,6 +2473,17 @@ void Node3DEditor::_notification(int p_what) {
environ_title->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("title_font"), SNAME("Window")));
} break;
+ case NOTIFICATION_VISIBILITY_CHANGED: {
+ if (is_visible_in_tree()) {
+ set_process(true);
+ set_physics_process(true);
+ refresh_dirty_gizmos();
+ } else {
+ set_process(false);
+ set_physics_process(false);
+ }
+ } break;
+
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
if (EditorSettings::get_singleton()->check_changed_settings_in_group("editors/3d")) {
const Color selection_box_color = EDITOR_GET("editors/3d/selection_box_color");
@@ -3955,13 +3966,6 @@ void Node3DEditorPlugin::edited_scene_changed() {
void Node3DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
spatial_editor->make_visible();
- spatial_editor->set_process(true);
- spatial_editor->set_physics_process(true);
- spatial_editor->refresh_dirty_gizmos();
- } else {
- spatial_editor->hide();
- spatial_editor->set_process(false);
- spatial_editor->set_physics_process(false);
}
}
diff --git a/editor/scene/3d/node_3d_editor_viewport.cpp b/editor/scene/3d/node_3d_editor_viewport.cpp
index 605601cc725..a191fcc7ce2 100644
--- a/editor/scene/3d/node_3d_editor_viewport.cpp
+++ b/editor/scene/3d/node_3d_editor_viewport.cpp
@@ -5008,7 +5008,7 @@ void Node3DEditorViewport::switch_preview_camera(Camera3D *p_new_camera) {
}
void Node3DEditorViewport::update_transform_gizmo_view() {
- if (!is_visible_in_tree()) {
+ if (!camera->is_inside_tree()) {
return;
}