summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-01-19 16:12:00 +0100
committerGitHub <noreply@github.com>2017-01-19 16:12:00 +0100
commit8e84e53ebb676e43adc7ac4b3e8791790f555695 (patch)
treee13ca90f359d9ef9365e421c491f3c940d995b2f /tools/editor
parent3a7923a857fdf7d93e43cd493a7c9c29d1eec753 (diff)
parentfaa13adad3bd5fd2bd387399623c0b99ed4c4fe9 (diff)
Merge pull request #7574 from RayKoopa/canvas_item_fix_is_hidden
Fix Spatial::is_visible and editor calls to CanvasItem/Spatial::is_visible
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/scene_tree_editor.cpp37
1 files changed, 18 insertions, 19 deletions
diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp
index 77640b9c80..f92cfa00c1 100644
--- a/tools/editor/scene_tree_editor.cpp
+++ b/tools/editor/scene_tree_editor.cpp
@@ -208,14 +208,15 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item,int p_column,int p_id)
if (n->is_class("Spatial")) {
- bool v = !bool(n->call("is_hidden"));
+ bool v = bool(n->call("is_visible"));
undo_redo->create_action(TTR("Toggle Spatial Visible"));
- undo_redo->add_do_method(n,"_set_visible_",!v);
- undo_redo->add_undo_method(n,"_set_visible_",v);
+ undo_redo->add_do_method(n,"set_visible",!v);
+ undo_redo->add_undo_method(n,"set_visible",v);
undo_redo->commit_action();
+
} else if (n->is_class("CanvasItem")) {
- bool v = !bool(n->call("is_hidden"));
+ bool v = bool(n->call("is_visible"));
undo_redo->create_action(TTR("Toggle CanvasItem Visible"));
undo_redo->add_do_method(n,v?"hide":"show");
undo_redo->add_undo_method(n,v?"show":"hide");
@@ -393,11 +394,11 @@ bool SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) {
if (is_grouped)
item->add_button(0,get_icon("Group", "EditorIcons"), BUTTON_GROUP);
- bool h = p_node->call("is_hidden");
- if (h)
- item->add_button(0,get_icon("Hidden","EditorIcons"),BUTTON_VISIBILITY);
- else
+ bool v = p_node->call("is_visible");
+ if (v)
item->add_button(0,get_icon("Visible","EditorIcons"),BUTTON_VISIBILITY);
+ else
+ item->add_button(0,get_icon("Hidden","EditorIcons"),BUTTON_VISIBILITY);
if (!p_node->is_connected("visibility_changed",this,"_node_visibility_changed"))
p_node->connect("visibility_changed",this,"_node_visibility_changed",varray(p_node));
@@ -405,11 +406,11 @@ bool SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) {
_update_visibility_color(p_node, item);
} else if (p_node->is_class("Spatial")) {
- bool h = p_node->call("is_hidden");
- if (h)
- item->add_button(0,get_icon("Hidden","EditorIcons"),BUTTON_VISIBILITY);
- else
+ bool v = p_node->call("is_visible");
+ if (v)
item->add_button(0,get_icon("Visible","EditorIcons"),BUTTON_VISIBILITY);
+ else
+ item->add_button(0,get_icon("Hidden","EditorIcons"),BUTTON_VISIBILITY);
if (!p_node->is_connected("visibility_changed",this,"_node_visibility_changed"))
p_node->connect("visibility_changed",this,"_node_visibility_changed",varray(p_node));
@@ -469,16 +470,14 @@ void SceneTreeEditor::_node_visibility_changed(Node *p_node) {
bool visible=false;
- if (p_node->is_class("CanvasItem")) {
- visible = !p_node->call("is_hidden");
- } else if (p_node->is_class("Spatial")) {
- visible = !p_node->call("is_hidden");
+ if (p_node->is_class("CanvasItem") || p_node->is_class("Spatial")) {
+ visible = p_node->call("is_visible");
}
- if (!visible)
- item->set_button(0,idx,get_icon("Hidden","EditorIcons"));
- else
+ if (visible)
item->set_button(0,idx,get_icon("Visible","EditorIcons"));
+ else
+ item->set_button(0,idx,get_icon("Hidden","EditorIcons"));
_update_visibility_color(p_node, item);
}