Add a Window visibility toggle button to the Scene tree
This commit is contained in:
parent
ad9a8e70f4
commit
42373df2d4
@ -390,7 +390,7 @@ void SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
|
||||
}
|
||||
|
||||
_update_visibility_color(p_node, item);
|
||||
} else if (p_node->is_class("CanvasLayer")) {
|
||||
} else if (p_node->is_class("CanvasLayer") || p_node->is_class("Window")) {
|
||||
bool v = p_node->call("is_visible");
|
||||
if (v) {
|
||||
item->add_button(0, get_theme_icon(SNAME("GuiVisibilityVisible"), SNAME("EditorIcons")), BUTTON_VISIBILITY, false, TTR("Toggle Visibility"));
|
||||
@ -480,10 +480,7 @@ void SceneTreeEditor::_node_visibility_changed(Node *p_node) {
|
||||
|
||||
bool visible = false;
|
||||
|
||||
if (p_node->is_class("CanvasItem")) {
|
||||
visible = p_node->call("is_visible");
|
||||
CanvasItemEditor::get_singleton()->get_viewport_control()->update();
|
||||
} else if (p_node->is_class("CanvasLayer")) {
|
||||
if (p_node->is_class("CanvasItem") || p_node->is_class("CanvasLayer") || p_node->is_class("Window")) {
|
||||
visible = p_node->call("is_visible");
|
||||
CanvasItemEditor::get_singleton()->get_viewport_control()->update();
|
||||
} else if (p_node->is_class("Node3D")) {
|
||||
@ -529,7 +526,7 @@ void SceneTreeEditor::_node_removed(Node *p_node) {
|
||||
p_node->disconnect("script_changed", callable_mp(this, &SceneTreeEditor::_node_script_changed));
|
||||
}
|
||||
|
||||
if (p_node->is_class("Node3D") || p_node->is_class("CanvasItem") || p_node->is_class("CanvasLayer")) {
|
||||
if (p_node->is_class("Node3D") || p_node->is_class("CanvasItem") || p_node->is_class("CanvasLayer") || p_node->is_class("Window")) {
|
||||
if (p_node->is_connected("visibility_changed", callable_mp(this, &SceneTreeEditor::_node_visibility_changed))) {
|
||||
p_node->disconnect("visibility_changed", callable_mp(this, &SceneTreeEditor::_node_visibility_changed));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user