diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-13 10:45:50 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-01-13 10:45:50 -0300 |
commit | 04c749a1f034c0b2256fdca0ca2675f696b490e8 (patch) | |
tree | c908a64edf3f61bba725051c8f60c6a108acbb84 /scene | |
parent | a2903fc51d1d20eba4dc451bdacbe477d6670163 (diff) |
New API for visibility in both CanvasItem and Spatial
visible (property) - access set_visible(bool) is_visible()
is_visible_in_tree() - true when visible and parents visible
show() hide() - for convenience
Diffstat (limited to 'scene')
39 files changed, 130 insertions, 170 deletions
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index d48cfb1b15..0a3e06602b 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -182,7 +182,7 @@ CanvasItemMaterial::~CanvasItemMaterial(){ -bool CanvasItem::is_visible() const { +bool CanvasItem::is_visible_in_tree() const { if (!is_inside_tree()) return false; @@ -190,7 +190,7 @@ bool CanvasItem::is_visible() const { const CanvasItem *p=this; while(p) { - if (p->hidden) + if (!p->visible) return false; p=p->get_parent_item(); } @@ -199,13 +199,6 @@ bool CanvasItem::is_visible() const { return true; } -bool CanvasItem::is_hidden() const { - - /*if (!is_inside_scene()) - return false;*/ - - return hidden; -} void CanvasItem::_propagate_visibility_changed(bool p_visible) { @@ -221,7 +214,7 @@ void CanvasItem::_propagate_visibility_changed(bool p_visible) { CanvasItem *c=get_child(i)->cast_to<CanvasItem>(); - if (c && !c->hidden) //should the toplevels stop propagation? i think so but.. + if (c && c->visible) //should the toplevels stop propagation? i think so but.. c->_propagate_visibility_changed(p_visible); } @@ -231,10 +224,10 @@ void CanvasItem::_propagate_visibility_changed(bool p_visible) { void CanvasItem::show() { - if (!hidden) + if (visible) return; - hidden=false; + visible=true; VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,true); if (!is_inside_tree()) @@ -247,10 +240,10 @@ void CanvasItem::show() { void CanvasItem::hide() { - if (hidden) + if (!visible) return; - hidden=true; + visible=false; VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,false); if (!is_inside_tree()) @@ -260,16 +253,6 @@ void CanvasItem::hide() { _change_notify("visibility/visible"); } -void CanvasItem::set_hidden(bool p_hidden) { - - if (hidden == p_hidden) { - return; - } - - _set_visible_(!p_hidden); -} - - Variant CanvasItem::edit_get_state() const { @@ -306,7 +289,7 @@ void CanvasItem::_update_callback() { VisualServer::get_singleton()->canvas_item_clear(get_canvas_item()); //todo updating = true - only allow drawing here - if (is_visible()) { //todo optimize this!! + if (is_visible_in_tree()) { //todo optimize this!! if (first_draw) { notification(NOTIFICATION_VISIBILITY_CHANGED); first_draw=false; @@ -495,16 +478,16 @@ void CanvasItem::_notification(int p_what) { } } -void CanvasItem::_set_visible_(bool p_visible) { +void CanvasItem::set_visible(bool p_visible) { if (p_visible) show(); else hide(); } -bool CanvasItem::_is_visible_() const { +bool CanvasItem::is_visible() const { - return !is_hidden(); + return visible; } @@ -924,8 +907,6 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(_MD("_toplevel_raise_self"),&CanvasItem::_toplevel_raise_self); ClassDB::bind_method(_MD("_update_callback"),&CanvasItem::_update_callback); - ClassDB::bind_method(_MD("_set_visible_"),&CanvasItem::_set_visible_); - ClassDB::bind_method(_MD("_is_visible_"),&CanvasItem::_is_visible_); ClassDB::bind_method(_MD("edit_set_state","state"),&CanvasItem::edit_set_state); ClassDB::bind_method(_MD("edit_get_state:Variant"),&CanvasItem::edit_get_state); @@ -938,11 +919,11 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(_MD("get_canvas_item"),&CanvasItem::get_canvas_item); + ClassDB::bind_method(_MD("set_visible"),&CanvasItem::set_visible); ClassDB::bind_method(_MD("is_visible"),&CanvasItem::is_visible); - ClassDB::bind_method(_MD("is_hidden"),&CanvasItem::is_hidden); + ClassDB::bind_method(_MD("is_visible_in_tree"),&CanvasItem::is_visible_in_tree); ClassDB::bind_method(_MD("show"),&CanvasItem::show); ClassDB::bind_method(_MD("hide"),&CanvasItem::hide); - ClassDB::bind_method(_MD("set_hidden","hidden"),&CanvasItem::set_hidden); ClassDB::bind_method(_MD("update"),&CanvasItem::update); @@ -1010,7 +991,7 @@ void CanvasItem::_bind_methods() { BIND_VMETHOD(MethodInfo("_draw")); ADD_GROUP("Visibility",""); - ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"visible"), _SCS("_set_visible_"),_SCS("_is_visible_") ); + ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"visible"), _SCS("set_visible"),_SCS("is_visible") ); ADD_PROPERTYNO( PropertyInfo(Variant::COLOR,"modulate"), _SCS("set_modulate"),_SCS("get_modulate") ); ADD_PROPERTYNO( PropertyInfo(Variant::COLOR,"self_modulate"), _SCS("set_self_modulate"),_SCS("get_self_modulate") ); ADD_PROPERTYNZ( PropertyInfo(Variant::BOOL,"show_behind_parent"), _SCS("set_draw_behind_parent"),_SCS("is_draw_behind_parent_enabled") ); @@ -1125,7 +1106,7 @@ CanvasItem::CanvasItem() : xform_change(this) { canvas_item=VisualServer::get_singleton()->canvas_item_create(); - hidden=false; + visible=true; pending_update=false; modulate=Color(1,1,1,1); self_modulate=Color(1,1,1,1); diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index 9865ad04a0..9688b873c0 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -109,7 +109,7 @@ private: int light_mask; bool first_draw; - bool hidden; + bool visible; bool pending_update; bool toplevel; bool drawing; @@ -129,8 +129,6 @@ private: void _propagate_visibility_changed(bool p_visible); - void _set_visible_(bool p_visible); - bool _is_visible_() const; void _update_callback(); @@ -174,11 +172,11 @@ public: /* VISIBILITY */ + void set_visible(bool p_visible); bool is_visible() const; - bool is_hidden() const; + bool is_visible_in_tree() const; void show(); void hide(); - void set_hidden(bool p_hidden); void update(); diff --git a/scene/2d/canvas_modulate.cpp b/scene/2d/canvas_modulate.cpp index 583f03eab1..138589651c 100644 --- a/scene/2d/canvas_modulate.cpp +++ b/scene/2d/canvas_modulate.cpp @@ -33,7 +33,7 @@ void CanvasModulate::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_CANVAS) { - if (is_visible()) { + if (is_visible_in_tree()) { VS::get_singleton()->canvas_set_modulate(get_canvas(),color); add_to_group("_canvas_modulate_"+itos(get_canvas().get_id())); } @@ -42,13 +42,13 @@ void CanvasModulate::_notification(int p_what) { } else if (p_what==NOTIFICATION_EXIT_CANVAS) { - if (is_visible()) { + if (is_visible_in_tree()) { VS::get_singleton()->canvas_set_modulate(get_canvas(),Color(1,1,1,1)); remove_from_group("_canvas_modulate_"+itos(get_canvas().get_id())); } } else if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { - if (is_visible()) { + if (is_visible_in_tree()) { VS::get_singleton()->canvas_set_modulate(get_canvas(),color); add_to_group("_canvas_modulate_"+itos(get_canvas().get_id())); } else { @@ -83,7 +83,7 @@ Color CanvasModulate::get_color() const { String CanvasModulate::get_configuration_warning() const { - if (!is_visible() || !is_inside_tree()) + if (!is_visible_in_tree() || !is_inside_tree()) return String(); List<Node*> nodes; diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index af070dc825..e90bf8b96e 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -212,7 +212,7 @@ void CollisionObject2D::_mouse_exit() { void CollisionObject2D::_update_pickable() { if (!is_inside_tree()) return; - bool pickable = this->pickable && is_inside_tree() && is_visible(); + bool pickable = this->pickable && is_inside_tree() && is_visible_in_tree(); if (area) Physics2DServer::get_singleton()->area_set_pickable(rid,pickable); else diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index 07fce58fc0..2935f6b9f7 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -83,7 +83,7 @@ void Light2D::_update_light_visibility() { } #endif - VS::get_singleton()->canvas_light_set_enabled(canvas_light,enabled && is_visible() && editor_ok); + VS::get_singleton()->canvas_light_set_enabled(canvas_light,enabled && is_visible_in_tree() && editor_ok); } void Light2D::set_enabled( bool p_enabled) { diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index a9e654e699..77c9b8184a 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -123,7 +123,7 @@ void LightOccluder2D::_notification(int p_what) { VS::get_singleton()->canvas_light_occluder_attach_to_canvas(occluder,get_canvas()); VS::get_singleton()->canvas_light_occluder_set_transform(occluder,get_global_transform()); - VS::get_singleton()->canvas_light_occluder_set_enabled(occluder,is_visible()); + VS::get_singleton()->canvas_light_occluder_set_enabled(occluder,is_visible_in_tree()); } if (p_what==NOTIFICATION_TRANSFORM_CHANGED) { @@ -132,7 +132,7 @@ void LightOccluder2D::_notification(int p_what) { } if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { - VS::get_singleton()->canvas_light_occluder_set_enabled(occluder,is_visible()); + VS::get_singleton()->canvas_light_occluder_set_enabled(occluder,is_visible_in_tree()); } if (p_what==NOTIFICATION_DRAW) { diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index 26047a7426..b91b2d4f56 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -459,7 +459,7 @@ void NavigationPolygonInstance::_navpoly_changed() { String NavigationPolygonInstance::get_configuration_warning() const { - if (!is_visible() || !is_inside_tree()) + if (!is_visible_in_tree() || !is_inside_tree()) return String(); if (!navpoly.is_valid()) { diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 0508a715eb..e1d1920cc5 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -239,7 +239,7 @@ void PathFollow2D::_get_property_list( List<PropertyInfo> *p_list) const{ String PathFollow2D::get_configuration_warning() const { - if (!is_visible() || !is_inside_tree()) + if (!is_visible_in_tree() || !is_inside_tree()) return String(); if (!get_parent() || !get_parent()->cast_to<Path2D>()) { diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp index 3aacd7091a..99147b0a39 100644 --- a/scene/2d/screen_button.cpp +++ b/scene/2d/screen_button.cpp @@ -236,7 +236,7 @@ void TouchScreenButton::_input(const InputEvent& p_event) { if (p_event.screen_touch.pressed) { - if (!is_visible()) + if (!is_visible_in_tree()) return; if (finger_pressed!=-1) diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp index dab8ad1ea1..96d8d13a29 100644 --- a/scene/3d/collision_object.cpp +++ b/scene/3d/collision_object.cpp @@ -206,7 +206,7 @@ void CollisionObject::_mouse_exit() { void CollisionObject::_update_pickable() { if (!is_inside_tree()) return; - bool pickable = ray_pickable && is_inside_tree() && is_visible(); + bool pickable = ray_pickable && is_inside_tree() && is_visible_in_tree(); if (area) PhysicsServer::get_singleton()->area_set_ray_pickable(rid,pickable); else diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 50ee3482c3..d685cd8ce7 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -164,7 +164,7 @@ void Light::_update_visibility() { } #endif - //VS::get_singleton()->instance_light_set_enabled(get_instance(),is_visible() && editor_ok); + //VS::get_singleton()->instance_light_set_enabled(get_instance(),is_visible_in_tree() && editor_ok); _change_notify("geometry/visible"); } diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp index 69c18da429..4018045390 100644 --- a/scene/3d/navigation_mesh.cpp +++ b/scene/3d/navigation_mesh.cpp @@ -373,7 +373,7 @@ Ref<NavigationMesh> NavigationMeshInstance::get_navigation_mesh() const{ String NavigationMeshInstance::get_configuration_warning() const { - if (!is_visible() || !is_inside_tree()) + if (!is_visible_in_tree() || !is_inside_tree()) return String(); if (!navmesh.is_valid()) { diff --git a/scene/3d/scenario_fx.cpp b/scene/3d/scenario_fx.cpp index 95ba2c990a..bda7d43570 100644 --- a/scene/3d/scenario_fx.cpp +++ b/scene/3d/scenario_fx.cpp @@ -83,7 +83,7 @@ Ref<Environment> WorldEnvironment::get_environment() const { String WorldEnvironment::get_configuration_warning() const { - if (!is_visible() || !is_inside_tree() || !environment.is_valid()) + if (!is_visible_in_tree() || !is_inside_tree() || !environment.is_valid()) return String(); List<Node*> nodes; diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index 3cd29a1342..7c452f90af 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -482,7 +482,7 @@ void Spatial::_update_gizmo() { data.gizmo_dirty=false; if (data.gizmo.is_valid()) { - if (is_visible()) + if (is_visible_in_tree()) data.gizmo->redraw(); else data.gizmo->clear(); @@ -573,7 +573,7 @@ void Spatial::show() { if (!is_inside_tree()) return; - if (!data.parent || is_visible()) { + if (!data.parent || is_visible_in_tree()) { _propagate_visibility_changed(); } @@ -584,7 +584,7 @@ void Spatial::hide(){ if (!data.visible) return; - bool was_visible = is_visible(); + bool was_visible = is_visible_in_tree(); data.visible=false; if (!data.parent || was_visible) { @@ -593,7 +593,7 @@ void Spatial::hide(){ } } -bool Spatial::is_visible() const{ +bool Spatial::is_visible_in_tree() const{ const Spatial *s=this; @@ -608,21 +608,7 @@ bool Spatial::is_visible() const{ } -bool Spatial::is_hidden() const{ - - return !data.visible; -} - -void Spatial::set_hidden(bool p_hidden) { - - if (data.visible != p_hidden) { - return; - } - - _set_visible_(!p_hidden); -} - -void Spatial::_set_visible_(bool p_visible) { +void Spatial::set_visible(bool p_visible) { if (p_visible) show(); @@ -630,9 +616,9 @@ void Spatial::_set_visible_(bool p_visible) { hide(); } -bool Spatial::_is_visible_() const { +bool Spatial::is_visible() const { - return !is_hidden(); + return !data.visible; } void Spatial::rotate(const Vector3& p_normal,float p_radians) { @@ -787,14 +773,11 @@ void Spatial::_bind_methods() { ClassDB::bind_method(_MD("set_gizmo","gizmo:SpatialGizmo"), &Spatial::set_gizmo); ClassDB::bind_method(_MD("get_gizmo:SpatialGizmo"), &Spatial::get_gizmo); + ClassDB::bind_method(_MD("set_visible"), &Spatial::set_visible); + ClassDB::bind_method(_MD("is_visible"), &Spatial::is_visible); + ClassDB::bind_method(_MD("is_visible_in_tree"), &Spatial::is_visible_in_tree); ClassDB::bind_method(_MD("show"), &Spatial::show); ClassDB::bind_method(_MD("hide"), &Spatial::hide); - ClassDB::bind_method(_MD("is_visible"), &Spatial::is_visible); - ClassDB::bind_method(_MD("is_hidden"), &Spatial::is_hidden); - ClassDB::bind_method(_MD("set_hidden","hidden"), &Spatial::set_hidden); - - ClassDB::bind_method(_MD("_set_visible_"), &Spatial::_set_visible_); - ClassDB::bind_method(_MD("_is_visible_"), &Spatial::_is_visible_); ClassDB::bind_method(_MD("set_notify_local_transform","enable"), &Spatial::set_notify_local_transform); ClassDB::bind_method(_MD("is_local_transform_notification_enabled"), &Spatial::is_local_transform_notification_enabled); diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h index d3cab0539c..72daa472bd 100644 --- a/scene/3d/spatial.h +++ b/scene/3d/spatial.h @@ -127,8 +127,6 @@ protected: void _notification(int p_what); static void _bind_methods(); - void _set_visible_(bool p_visible); - bool _is_visible_() const; public: enum { @@ -194,11 +192,11 @@ public: void orthonormalize(); void set_identity(); + void set_visible(bool p_visible); + bool is_visible() const; void show(); void hide(); - bool is_visible() const; - bool is_hidden() const; - void set_hidden(bool p_hidden); + bool is_visible_in_tree() const; #ifdef TOOLS_ENABLED void set_import_transform(const Transform& p_transform) ; diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index e708c83545..ca78f8e21f 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -45,7 +45,7 @@ void VisualInstance::_update_visibility() { return; _change_notify("visible"); - VS::get_singleton()->instance_set_visible(get_instance(),is_visible()); + VS::get_singleton()->instance_set_visible(get_instance(),is_visible_in_tree()); } diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 45c491cd74..e161906775 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -297,7 +297,7 @@ void BaseButton::_notification(int p_what) { } - if (p_what==NOTIFICATION_VISIBILITY_CHANGED && !is_visible()) { + if (p_what==NOTIFICATION_VISIBILITY_CHANGED && !is_visible_in_tree()) { if (!toggle_mode) { status.pressed = false; @@ -453,7 +453,7 @@ Ref<ShortCut> BaseButton:: get_shortcut() const { void BaseButton::_unhandled_input(InputEvent p_event) { - if (!is_disabled() && is_visible() && p_event.is_pressed() && !p_event.is_echo() && shortcut.is_valid() && shortcut->is_shortcut(p_event)) { + if (!is_disabled() && is_visible_in_tree() && p_event.is_pressed() && !p_event.is_echo() && shortcut.is_valid() && shortcut->is_shortcut(p_event)) { if (get_viewport()->get_modal_stack_top() && !get_viewport()->get_modal_stack_top()->is_a_parent_of(this)) return; //ignore because of modal window diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp index f31f51a5cd..600b6141c5 100644 --- a/scene/gui/box_container.cpp +++ b/scene/gui/box_container.cpp @@ -55,7 +55,7 @@ void BoxContainer::_resort() { for(int i=0;i<get_child_count();i++) { Control *c=get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; if (c->is_set_as_toplevel()) continue; @@ -108,7 +108,7 @@ void BoxContainer::_resort() { for(int i=0;i<get_child_count();i++) { Control *c=get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; if (c->is_set_as_toplevel()) continue; @@ -164,7 +164,7 @@ void BoxContainer::_resort() { for(int i=0;i<get_child_count();i++) { Control *c=get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; if (c->is_set_as_toplevel()) continue; @@ -227,7 +227,7 @@ Size2 BoxContainer::get_minimum_size() const { if (c->is_set_as_toplevel()) continue; - if (c->is_hidden()) { + if (!c->is_visible()) { continue; } diff --git a/scene/gui/center_container.cpp b/scene/gui/center_container.cpp index 4a42695c3a..4d4abb6484 100644 --- a/scene/gui/center_container.cpp +++ b/scene/gui/center_container.cpp @@ -42,7 +42,7 @@ Size2 CenterContainer::get_minimum_size() const { continue; if (c->is_set_as_toplevel()) continue; - if (c->is_hidden()) + if (!c->is_visible()) continue; Size2 minsize = c->get_combined_minimum_size(); ms.width = MAX(ms.width , minsize.width); diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index a5a5c61082..de5f35933c 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -147,7 +147,7 @@ void Container::_notification(int p_what) { } break; case NOTIFICATION_VISIBILITY_CHANGED: { - if (is_visible()) { + if (is_visible_in_tree()) { queue_sort(); } } break; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 054622668b..3322469397 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -565,7 +565,7 @@ void Control::_notification(int p_notification) { } break; case NOTIFICATION_VISIBILITY_CHANGED: { - if (!is_visible()) { + if (!is_visible_in_tree()) { if(get_viewport() != NULL) get_viewport()->_gui_hid_control(this); @@ -1660,7 +1660,7 @@ static Control *_next_control(Control *p_from) { for(int i=(next+1);i<parent->get_child_count();i++) { Control *c = parent->get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible() || c->is_set_as_toplevel()) + if (!c || !c->is_visible_in_tree() || c->is_set_as_toplevel()) continue; return c; @@ -1685,7 +1685,7 @@ Control *Control::find_next_valid_focus() const { for(int i=0;i<from->get_child_count();i++) { Control *c = from->get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible() || c->is_set_as_toplevel()) { + if (!c || !c->is_visible_in_tree() || c->is_set_as_toplevel()) { continue; } @@ -1751,7 +1751,7 @@ static Control *_prev_control(Control *p_from) { for(int i=p_from->get_child_count()-1;i>=0;i--) { Control *c = p_from->get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible() || c->is_set_as_toplevel()) + if (!c || !c->is_visible_in_tree() || c->is_set_as_toplevel()) continue; child=c; @@ -1791,7 +1791,7 @@ Control *Control::find_prev_valid_focus() const { Control *c = from->get_parent()->get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible() || c->is_set_as_toplevel()) { + if (!c || !c->is_visible_in_tree() || c->is_set_as_toplevel()) { continue; } @@ -1875,7 +1875,7 @@ void Control::show_modal(bool p_exclusive) { ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND(!data.SI); - if (is_visible()) + if (is_visible_in_tree()) hide(); ERR_FAIL_COND( data.MI!=NULL ); @@ -2053,7 +2053,7 @@ Control *Control::_get_focus_neighbour(Margin p_margin,int p_count) { return NULL; } bool valid=true; - if (c->is_hidden()) + if (!c->is_visible()) valid=false; if (c->get_focus_mode()==FOCUS_NONE) valid=false; @@ -2126,7 +2126,7 @@ void Control::_window_find_focus_neighbour(const Vector2& p_dir, Node *p_at,cons Control *c = p_at->cast_to<Control>(); - if (c && c !=this && c->get_focus_mode()==FOCUS_ALL && c->is_visible()) { + if (c && c !=this && c->get_focus_mode()==FOCUS_ALL && c->is_visible_in_tree()) { Point2 points[4]; diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 1cd04551c5..393f14bee2 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -615,7 +615,7 @@ void FileDialog::set_access(Access p_access) { void FileDialog::invalidate() { - if (is_visible()) { + if (is_visible_in_tree()) { update_file_list(); invalidated=false; } else { diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index b919f0649d..2a73e32864 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -1054,7 +1054,7 @@ void GraphEdit::set_zoom(float p_zoom) { _update_scroll(); connections_layer->update(); - if (is_visible()) { + if (is_visible_in_tree()) { Vector2 ofs = sbofs*zoom - get_size()/2; h_scroll->set_value( ofs.x ); diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp index 7dffaa2fd5..7c67d443af 100644 --- a/scene/gui/grid_container.cpp +++ b/scene/gui/grid_container.cpp @@ -53,7 +53,7 @@ void GridContainer::_notification(int p_what) { for(int i=0;i<get_child_count();i++) { Control *c = get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; int row = idx / columns; @@ -112,7 +112,7 @@ void GridContainer::_notification(int p_what) { for(int i=0;i<get_child_count();i++) { Control *c = get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; int row = idx / columns; int col = idx % columns; @@ -191,7 +191,7 @@ Size2 GridContainer::get_minimum_size() const { for(int i=0;i<get_child_count();i++) { Control *c = get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; int row = idx / columns; int col = idx % columns; diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index ece6171b6e..a3ed0a91cf 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -801,7 +801,7 @@ void ItemList::_notification(int p_what) { float page = size.height-bg->get_minimum_size().height; int width = size.width-bg->get_minimum_size().width; - if (!scroll_bar->is_hidden()){ + if (scroll_bar->is_visible()){ width-=mw+bg->get_margin(MARGIN_RIGHT); } scroll_bar->set_page(page); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index e75785b1ff..89a937a301 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -853,7 +853,7 @@ void LineEdit::_reset_caret_blink_timer() { void LineEdit::_toggle_draw_caret() { draw_caret = !draw_caret; - if (is_visible() && has_focus() && window_has_focus) { + if (is_visible_in_tree() && has_focus() && window_has_focus) { update(); } } diff --git a/scene/gui/margin_container.cpp b/scene/gui/margin_container.cpp index 883364b2fd..be27c40117 100644 --- a/scene/gui/margin_container.cpp +++ b/scene/gui/margin_container.cpp @@ -45,7 +45,7 @@ Size2 MarginContainer::get_minimum_size() const { continue; if (c->is_set_as_toplevel()) continue; - if (c->is_hidden()) + if (!c->is_visible()) continue; Size2 s = c->get_combined_minimum_size(); diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 755b296666..4fed40f4ac 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -36,7 +36,7 @@ void MenuButton::_unhandled_key_input(InputEvent p_event) { if (p_event.is_pressed() && !p_event.is_echo() && (p_event.type==InputEvent::KEY || p_event.type==InputEvent::ACTION || p_event.type==InputEvent::JOYPAD_BUTTON)) { - if (!get_parent() || !is_visible() || is_disabled()) + if (!get_parent() || !is_visible_in_tree() || is_disabled()) return; bool global_only = (get_viewport()->get_modal_stack_top() && !get_viewport()->get_modal_stack_top()->is_a_parent_of(this)); @@ -67,7 +67,7 @@ void MenuButton::_gui_input(InputEvent p_event) { /*if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index==BUTTON_LEFT) { clicked=p_event.mouse_button.pressed; } - if (clicked && p_event.type==InputEvent::MOUSE_MOTION && popup->is_visible()) { + if (clicked && p_event.type==InputEvent::MOUSE_MOTION && popup->is_visible_in_tree()) { Point2 gt = Point2(p_event.mouse_motion.x,p_event.mouse_motion.y); gt = get_global_transform().xform(gt); diff --git a/scene/gui/panel_container.cpp b/scene/gui/panel_container.cpp index 451a85cf48..48270d12c7 100644 --- a/scene/gui/panel_container.cpp +++ b/scene/gui/panel_container.cpp @@ -43,7 +43,7 @@ Size2 PanelContainer::get_minimum_size() const { for(int i=0;i<get_child_count();i++) { Control *c = get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; if (c->is_set_as_toplevel()) continue; @@ -98,7 +98,7 @@ void PanelContainer::_notification(int p_what) { for(int i=0;i<get_child_count();i++) { Control *c = get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; if (c->is_set_as_toplevel()) continue; diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 5126568e5f..3f0f76f184 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -39,7 +39,7 @@ void Popup::_gui_input(InputEvent p_event) { void Popup::_notification(int p_what) { if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { - if (popped_up && !is_visible()) { + if (popped_up && !is_visible_in_tree()) { popped_up=false; notification(NOTIFICATION_POPUP_HIDE); emit_signal("popup_hide"); @@ -103,7 +103,7 @@ void Popup::set_as_minsize() { Control *c=get_child(i)->cast_to<Control>(); if (!c) continue; - if (c->is_hidden()) + if (!c->is_visible()) continue; Size2 minsize = c->get_combined_minimum_size(); @@ -144,7 +144,7 @@ void Popup::popup_centered_minsize(const Size2& p_minsize) { Control *c=get_child(i)->cast_to<Control>(); if (!c) continue; - if (c->is_hidden()) + if (!c->is_visible()) continue; Size2 minsize = c->get_combined_minimum_size(); @@ -283,7 +283,7 @@ Popup::Popup() { String Popup::get_configuration_warning() const { - if (is_visible()) { + if (is_visible_in_tree()) { return TTR("Popups will hide by default unless you call popup() or any of the popup*() functions. Making them visible for editing is fine though, but they will hide upon running."); } diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 9eaf393a21..c5ac6778a9 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -174,7 +174,7 @@ void PopupMenu::_activate_submenu(int over) { Popup *pm = n->cast_to<Popup>(); ERR_EXPLAIN("item subnode is not a Popup: "+items[over].submenu); ERR_FAIL_COND(!pm); - if (pm->is_visible()) + if (pm->is_visible_in_tree()) return; //already visible! diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 790b7500ea..434fb36e24 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -852,32 +852,32 @@ void RichTextLabel::_gui_input(InputEvent p_event) { switch(k.scancode) { case KEY_PAGEUP: { - if (vscroll->is_visible()) + if (vscroll->is_visible_in_tree()) vscroll->set_value( vscroll->get_value() - vscroll->get_page() ); } break; case KEY_PAGEDOWN: { - if (vscroll->is_visible()) + if (vscroll->is_visible_in_tree()) vscroll->set_value( vscroll->get_value() + vscroll->get_page() ); } break; case KEY_UP: { - if (vscroll->is_visible()) + if (vscroll->is_visible_in_tree()) vscroll->set_value( vscroll->get_value() - get_font("normal_font")->get_height() ); } break; case KEY_DOWN: { - if (vscroll->is_visible()) + if (vscroll->is_visible_in_tree()) vscroll->set_value( vscroll->get_value() + get_font("normal_font")->get_height() ); } break; case KEY_HOME: { - if (vscroll->is_visible()) + if (vscroll->is_visible_in_tree()) vscroll->set_value( 0 ); } break; case KEY_END: { - if (vscroll->is_visible()) + if (vscroll->is_visible_in_tree()) vscroll->set_value( vscroll->get_max() ); } break; case KEY_INSERT: @@ -1429,7 +1429,7 @@ bool RichTextLabel::is_scroll_active() const { void RichTextLabel::set_scroll_follow(bool p_follow) { scroll_follow=p_follow; - if (!vscroll->is_visible() || vscroll->get_value()>=(vscroll->get_max()-vscroll->get_page())) + if (!vscroll->is_visible_in_tree() || vscroll->get_value()>=(vscroll->get_max()-vscroll->get_page())) scroll_following=true; } diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 43c214b0be..b3ed9b209a 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -59,10 +59,10 @@ Size2 ScrollContainer::get_minimum_size() const { } } - if (h_scroll->is_visible()) { + if (h_scroll->is_visible_in_tree()) { min_size.y+=h_scroll->get_minimum_size().y; } - if (v_scroll->is_visible()) { + if (v_scroll->is_visible_in_tree()) { min_size.x+=v_scroll->get_minimum_size().x; } return min_size; @@ -89,19 +89,19 @@ void ScrollContainer::_gui_input(const InputEvent& p_gui_input) { const InputEventMouseButton &mb=p_gui_input.mouse_button; if (mb.button_index==BUTTON_WHEEL_UP && mb.pressed) { - if (h_scroll->is_visible() && !v_scroll->is_visible()){ + if (h_scroll->is_visible_in_tree() && !v_scroll->is_visible_in_tree()){ // only horizontal is enabled, scroll horizontally h_scroll->set_value( h_scroll->get_value()-h_scroll->get_page()/8 ); - } else if (v_scroll->is_visible()) { + } else if (v_scroll->is_visible_in_tree()) { v_scroll->set_value( v_scroll->get_value()-v_scroll->get_page()/8 ); } } if (mb.button_index==BUTTON_WHEEL_DOWN && mb.pressed) { - if (h_scroll->is_visible() && !v_scroll->is_visible()){ + if (h_scroll->is_visible_in_tree() && !v_scroll->is_visible_in_tree()){ // only horizontal is enabled, scroll horizontally h_scroll->set_value( h_scroll->get_value()+h_scroll->get_page()/8 ); - } else if (v_scroll->is_visible()) { + } else if (v_scroll->is_visible_in_tree()) { v_scroll->set_value( v_scroll->get_value()+v_scroll->get_page()/8 ); } } @@ -216,10 +216,10 @@ void ScrollContainer::_notification(int p_what) { child_max_size = Size2(0, 0); Size2 size = get_size(); - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) size.y-=h_scroll->get_minimum_size().y; - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) size.x-=h_scroll->get_minimum_size().x; for(int i=0;i<get_child_count();i++) { @@ -236,14 +236,14 @@ void ScrollContainer::_notification(int p_what) { child_max_size.y = MAX(child_max_size.y, minsize.y); Rect2 r = Rect2(-scroll,minsize); - if (!(scroll_h || h_scroll->is_visible())) { + if (!(scroll_h || h_scroll->is_visible_in_tree())) { r.pos.x=0; if (c->get_h_size_flags()&SIZE_EXPAND) r.size.width=MAX(size.width,minsize.width); else r.size.width=minsize.width; } - if (!(scroll_v || v_scroll->is_visible())) { + if (!(scroll_v || v_scroll->is_visible_in_tree())) { r.pos.y=0; r.size.height=size.height; if (c->get_v_size_flags()&SIZE_EXPAND) diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp index aae3b3fffa..a39ad2fe99 100644 --- a/scene/gui/split_container.cpp +++ b/scene/gui/split_container.cpp @@ -47,7 +47,7 @@ Control *SplitContainer::_getch(int p_idx) const { for(int i=0;i<get_child_count();i++) { Control *c=get_child(i)->cast_to<Control>(); - if (!c || !c->is_visible()) + if (!c || !c->is_visible_in_tree()) continue; if (c->is_set_as_toplevel()) continue; diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 11045eaafd..52d26b29de 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -680,7 +680,7 @@ Size2 TabContainer::get_minimum_size() const { if (c->is_set_as_toplevel()) continue; - if (!c->is_visible()) + if (!c->is_visible_in_tree()) continue; Size2 cms = c->get_combined_minimum_size(); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index cbc0c283de..46939765b0 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3036,7 +3036,7 @@ void TextEdit::adjust_viewport_to_cursor() { cursor.line_ofs=cursor.line; int visible_width=cache.size.width-cache.style_normal->get_minimum_size().width-cache.line_number_w-cache.breakpoint_gutter_width; - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) visible_width-=v_scroll->get_combined_minimum_size().width; visible_width-=20; // give it a little more space @@ -3044,7 +3044,7 @@ void TextEdit::adjust_viewport_to_cursor() { //printf("rowofs %i, visrows %i, cursor.line %i\n",cursor.line_ofs,get_visible_rows(),cursor.line); int visible_rows = get_visible_rows(); - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) visible_rows-=((h_scroll->get_combined_minimum_size().height-1)/get_row_height()); if (cursor.line>=(cursor.line_ofs+visible_rows)) @@ -3078,12 +3078,12 @@ void TextEdit::center_viewport_to_cursor() { cursor.line_ofs=cursor.line; int visible_width=cache.size.width-cache.style_normal->get_minimum_size().width-cache.line_number_w-cache.breakpoint_gutter_width; - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) visible_width-=v_scroll->get_combined_minimum_size().width; visible_width-=20; // give it a little more space int visible_rows = get_visible_rows(); - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) visible_rows-=((h_scroll->get_combined_minimum_size().height-1)/get_row_height()); int max_ofs = text.size()-(scroll_past_end_of_file_enabled?1:visible_rows); @@ -3205,9 +3205,9 @@ void TextEdit::_scroll_moved(double p_to_val) { if (updating_scrolls) return; - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) cursor.x_ofs=h_scroll->get_value(); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) cursor.line_ofs=v_scroll->get_value(); update(); } @@ -3458,7 +3458,7 @@ void TextEdit::_reset_caret_blink_timer() { void TextEdit::_toggle_draw_caret() { draw_caret = !draw_caret; - if (is_visible() && has_focus() && window_has_focus) { + if (is_visible_in_tree() && has_focus() && window_has_focus) { update(); } } diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 9f5b9f710d..19bb515bea 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1115,7 +1115,7 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2& } else { cache.selected->draw(ci,r ); } - if (text_editor->is_visible()){ + if (text_editor->is_visible_in_tree()){ text_editor->set_pos(get_global_pos() + r.pos); } } @@ -2277,9 +2277,9 @@ void Tree::_gui_input(InputEvent p_event) { mpos.y-=_get_title_button_height(); if (mpos.y>=0) { - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) mpos.x+=h_scroll->get_value(); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) mpos.y+=v_scroll->get_value(); int col,h,section; @@ -3069,7 +3069,7 @@ int Tree::get_column_width(int p_column) const { int expand_area=get_size().width-(bg->get_margin(MARGIN_LEFT)+bg->get_margin(MARGIN_RIGHT)); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) expand_area-=v_scroll->get_combined_minimum_size().width; int expanding_columns=0; @@ -3254,9 +3254,9 @@ String Tree::get_column_title(int p_column) const { Point2 Tree::get_scroll() const { Point2 ofs; - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) ofs.x=h_scroll->get_value(); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) ofs.y=v_scroll->get_value(); return ofs; @@ -3395,9 +3395,9 @@ int Tree::get_column_at_pos(const Point2& p_pos) const { if (pos.y<0) return -1; - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) pos.x+=h_scroll->get_value(); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) pos.y+=v_scroll->get_value(); int col,h,section; @@ -3422,9 +3422,9 @@ int Tree::get_drop_section_at_pos(const Point2& p_pos) const { if (pos.y<0) return -100; - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) pos.x+=h_scroll->get_value(); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) pos.y+=v_scroll->get_value(); int col,h,section; @@ -3449,9 +3449,9 @@ TreeItem* Tree::get_item_at_pos(const Point2& p_pos) const { if (pos.y<0) return NULL; - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) pos.x+=h_scroll->get_value(); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) pos.y+=v_scroll->get_value(); int col,h,section; @@ -3477,9 +3477,9 @@ String Tree::get_tooltip(const Point2& p_pos) const { if (pos.y<0) return Control::get_tooltip(p_pos); - if (h_scroll->is_visible()) + if (h_scroll->is_visible_in_tree()) pos.x+=h_scroll->get_value(); - if (v_scroll->is_visible()) + if (v_scroll->is_visible_in_tree()) pos.y+=v_scroll->get_value(); int col,h,section; diff --git a/scene/gui/viewport_container.cpp b/scene/gui/viewport_container.cpp index 37ecd3cb2f..9e89de66dd 100644 --- a/scene/gui/viewport_container.cpp +++ b/scene/gui/viewport_container.cpp @@ -63,7 +63,7 @@ void ViewportContainer::_notification(int p_what) { continue; - if (is_visible()) + if (is_visible_in_tree()) c->set_update_mode(Viewport::UPDATE_ALWAYS); else c->set_update_mode(Viewport::UPDATE_DISABLED); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index fe363d97f7..30476b2f76 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -272,7 +272,7 @@ void Viewport::_parent_visibility_changed() { if (parent_control) { Control *c = parent_control; - VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,c->is_visible()); + VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,c->is_visible_in_tree()); _update_listener(); _update_listener_2d(); @@ -782,7 +782,7 @@ Size2 Viewport::get_size() const { void Viewport::_update_listener() { - if (is_inside_tree() && audio_listener && (camera || listener) && (!get_parent() || (get_parent()->cast_to<Control>() && get_parent()->cast_to<Control>()->is_visible()))) { + if (is_inside_tree() && audio_listener && (camera || listener) && (!get_parent() || (get_parent()->cast_to<Control>() && get_parent()->cast_to<Control>()->is_visible_in_tree()))) { SpatialSoundServer::get_singleton()->listener_set_space(internal_listener, find_world()->get_sound_space()); } else { SpatialSoundServer::get_singleton()->listener_set_space(internal_listener, RID()); @@ -793,7 +793,7 @@ void Viewport::_update_listener() { void Viewport::_update_listener_2d() { - if (is_inside_tree() && audio_listener && (!get_parent() || (get_parent()->cast_to<Control>() && get_parent()->cast_to<Control>()->is_visible()))) + if (is_inside_tree() && audio_listener && (!get_parent() || (get_parent()->cast_to<Control>() && get_parent()->cast_to<Control>()->is_visible_in_tree()))) SpatialSound2DServer::get_singleton()->listener_set_space(internal_listener_2d, find_world_2d()->get_sound_space()); else SpatialSound2DServer::get_singleton()->listener_set_space(internal_listener_2d, RID()); @@ -1521,7 +1521,7 @@ void Viewport::_vp_unhandled_input(const InputEvent& p_ev) { } #endif -// if (parent_control && !parent_control->is_visible()) +// if (parent_control && !parent_control->is_visible_in_tree()) // return; if (to_screen_rect==Rect2()) @@ -1696,7 +1696,7 @@ Control* Viewport::_gui_find_control(const Point2& p_global) { for (List<Control*>::Element *E=gui.subwindows.back();E;E=E->prev()) { Control *sw = E->get(); - if (!sw->is_visible()) + if (!sw->is_visible_in_tree()) continue; Transform2D xform; @@ -1716,7 +1716,7 @@ Control* Viewport::_gui_find_control(const Point2& p_global) { for (List<Control*>::Element *E=gui.roots.back();E;E=E->prev()) { Control *sw = E->get(); - if (!sw->is_visible()) + if (!sw->is_visible_in_tree()) continue; Transform2D xform; @@ -1750,7 +1750,7 @@ Control* Viewport::_gui_find_control_at_pos(CanvasItem* p_node,const Point2& p_g //subwindows first!! - if (p_node->is_hidden()) { + if (!p_node->is_visible()) { //return _find_next_visible_control_at_pos(p_node,p_global,r_inv_xform); return NULL; //canvas item hidden, discard } @@ -2150,7 +2150,7 @@ void Viewport::_gui_input_event(InputEvent p_event) { case InputEvent::KEY: { - if (gui.key_focus && !gui.key_focus->is_visible()) { + if (gui.key_focus && !gui.key_focus->is_visible_in_tree()) { gui.key_focus->release_focus(); } @@ -2282,7 +2282,7 @@ void Viewport::_gui_remove_from_modal_stack(List<Control*>::Element *MI,ObjectID if (!pfoc) return; - if (!pfoc->is_inside_tree() || !pfoc->is_visible()) + if (!pfoc->is_inside_tree() || !pfoc->is_visible_in_tree()) return; pfoc->grab_focus(); } else { |