Update visibility icon properly
This commit is contained in:
parent
bb6e73f9c1
commit
6ed2b0eabc
2 changed files with 6 additions and 9 deletions
|
@ -472,7 +472,7 @@ void SceneTreeEditor::_node_visibility_changed(Node *p_node) {
|
||||||
void SceneTreeEditor::_update_visibility_color(Node *p_node, TreeItem *p_item) {
|
void SceneTreeEditor::_update_visibility_color(Node *p_node, TreeItem *p_item) {
|
||||||
if (p_node->is_class("CanvasItem") || p_node->is_class("Spatial")) {
|
if (p_node->is_class("CanvasItem") || p_node->is_class("Spatial")) {
|
||||||
Color color(1, 1, 1, 1);
|
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) {
|
if (!visible_on_screen) {
|
||||||
color = Color(0.6, 0.6, 0.6, 1);
|
color = Color(0.6, 0.6, 0.6, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -541,10 +541,7 @@ void Spatial::show() {
|
||||||
if (!is_inside_tree())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!data.parent || is_visible_in_tree()) {
|
|
||||||
|
|
||||||
_propagate_visibility_changed();
|
_propagate_visibility_changed();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spatial::hide() {
|
void Spatial::hide() {
|
||||||
|
@ -552,14 +549,14 @@ void Spatial::hide() {
|
||||||
if (!data.visible)
|
if (!data.visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool was_visible = is_visible_in_tree();
|
|
||||||
data.visible = false;
|
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 {
|
bool Spatial::is_visible_in_tree() const {
|
||||||
|
|
||||||
const Spatial *s = this;
|
const Spatial *s = this;
|
||||||
|
|
Loading…
Reference in a new issue