Merge pull request #2922 from romulox-x/set_hidden
Added set_hidden method to Spatial and CanvasItem
This commit is contained in:
commit
b6d6c2220f
4 changed files with 22 additions and 0 deletions
|
@ -309,6 +309,15 @@ 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 {
|
||||
|
||||
|
@ -1043,6 +1052,7 @@ void CanvasItem::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("is_hidden"),&CanvasItem::is_hidden);
|
||||
ObjectTypeDB::bind_method(_MD("show"),&CanvasItem::show);
|
||||
ObjectTypeDB::bind_method(_MD("hide"),&CanvasItem::hide);
|
||||
ObjectTypeDB::bind_method(_MD("set_hidden","hidden"),&CanvasItem::set_hidden);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("update"),&CanvasItem::update);
|
||||
|
||||
|
|
|
@ -190,6 +190,7 @@ public:
|
|||
bool is_hidden() const;
|
||||
void show();
|
||||
void hide();
|
||||
void set_hidden(bool p_hidden);
|
||||
|
||||
void update();
|
||||
|
||||
|
|
|
@ -594,6 +594,15 @@ 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) {
|
||||
|
||||
if (p_visible)
|
||||
|
@ -742,6 +751,7 @@ void Spatial::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("hide"), &Spatial::hide);
|
||||
ObjectTypeDB::bind_method(_MD("is_visible"), &Spatial::is_visible);
|
||||
ObjectTypeDB::bind_method(_MD("is_hidden"), &Spatial::is_hidden);
|
||||
ObjectTypeDB::bind_method(_MD("set_hidden","hidden"), &Spatial::set_hidden);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("_set_visible_"), &Spatial::_set_visible_);
|
||||
ObjectTypeDB::bind_method(_MD("_is_visible_"), &Spatial::_is_visible_);
|
||||
|
|
|
@ -191,6 +191,7 @@ public:
|
|||
void hide();
|
||||
bool is_visible() const;
|
||||
bool is_hidden() const;
|
||||
void set_hidden(bool p_hidden);
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
void set_import_transform(const Transform& p_transform) ;
|
||||
|
|
Loading…
Reference in a new issue