Added show and hide methods and updated doc API.
(cherry picked from commit 160ee4ef8e
)
This commit is contained in:
parent
cb7c2db4e4
commit
2ed43f940b
3 changed files with 24 additions and 0 deletions
|
@ -18,6 +18,18 @@
|
|||
Returns the RID of the canvas used by this layer.
|
||||
</description>
|
||||
</method>
|
||||
<method name="hide">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Hides any [CanvasItem] under this [CanvasLayer]. This is equivalent to setting [member visible] to [code]false[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="show">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Shows any [CanvasItem] under this [CanvasLayer]. This is equivalent to setting [member visible] to [code]true[/code].
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="custom_viewport" type="Node" setter="set_custom_viewport" getter="get_custom_viewport">
|
||||
|
|
|
@ -65,6 +65,14 @@ void CanvasLayer::set_visible(bool p_visible) {
|
|||
}
|
||||
}
|
||||
|
||||
void CanvasLayer::show() {
|
||||
set_visible(true);
|
||||
}
|
||||
|
||||
void CanvasLayer::hide() {
|
||||
set_visible(false);
|
||||
}
|
||||
|
||||
bool CanvasLayer::is_visible() const {
|
||||
return visible;
|
||||
}
|
||||
|
@ -294,6 +302,8 @@ void CanvasLayer::_bind_methods() {
|
|||
|
||||
ClassDB::bind_method(D_METHOD("set_visible", "visible"), &CanvasLayer::set_visible);
|
||||
ClassDB::bind_method(D_METHOD("is_visible"), &CanvasLayer::is_visible);
|
||||
ClassDB::bind_method(D_METHOD("show"), &CanvasLayer::show);
|
||||
ClassDB::bind_method(D_METHOD("hide"), &CanvasLayer::hide);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_transform", "transform"), &CanvasLayer::set_transform);
|
||||
ClassDB::bind_method(D_METHOD("get_transform"), &CanvasLayer::get_transform);
|
||||
|
|
|
@ -72,6 +72,8 @@ public:
|
|||
|
||||
void set_visible(bool p_visible);
|
||||
bool is_visible() const;
|
||||
void show();
|
||||
void hide();
|
||||
|
||||
void set_transform(const Transform2D &p_xform);
|
||||
Transform2D get_transform() const;
|
||||
|
|
Loading…
Reference in a new issue