From 6ed2b0eabcae025117118e8db40fe045620fc9be Mon Sep 17 00:00:00 2001 From: volzhs Date: Mon, 3 Jul 2017 00:27:27 +0900 Subject: [PATCH] Update visibility icon properly --- editor/scene_tree_editor.cpp | 2 +- scene/3d/spatial.cpp | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index d4e5714c0d1..fcc3c7f6eb3 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -472,7 +472,7 @@ void SceneTreeEditor::_node_visibility_changed(Node *p_node) { void SceneTreeEditor::_update_visibility_color(Node *p_node, TreeItem *p_item) { if (p_node->is_class("CanvasItem") || p_node->is_class("Spatial")) { Color color(1, 1, 1, 1); - bool visible_on_screen = p_node->call("is_visible"); + bool visible_on_screen = p_node->call("is_visible_in_tree"); if (!visible_on_screen) { color = Color(0.6, 0.6, 0.6, 1); } diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index 3debbf02c35..20c2cc1eb50 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -541,10 +541,7 @@ void Spatial::show() { if (!is_inside_tree()) return; - if (!data.parent || is_visible_in_tree()) { - - _propagate_visibility_changed(); - } + _propagate_visibility_changed(); } void Spatial::hide() { @@ -552,14 +549,14 @@ void Spatial::hide() { if (!data.visible) return; - bool was_visible = is_visible_in_tree(); data.visible = false; - if (!data.parent || was_visible) { + if (!is_inside_tree()) + return; - _propagate_visibility_changed(); - } + _propagate_visibility_changed(); } + bool Spatial::is_visible_in_tree() const { const Spatial *s = this;