Merge pull request #87095 from TML233/expose_get_canvas_layer
Add `CanvasItem::get_canvas_layer_node()`
This commit is contained in:
commit
4d6d2d1f8b
3 changed files with 13 additions and 0 deletions
|
@ -411,6 +411,12 @@
|
|||
Returns the canvas item RID used by [RenderingServer] for this item.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_canvas_layer_node" qualifiers="const">
|
||||
<return type="CanvasLayer" />
|
||||
<description>
|
||||
Returns the [CanvasLayer] that contains this node, or [code]null[/code] if the node is not in any [CanvasLayer].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_canvas_transform" qualifiers="const">
|
||||
<return type="Transform2D" />
|
||||
<description>
|
||||
|
|
|
@ -1169,6 +1169,7 @@ void CanvasItem::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_local_mouse_position"), &CanvasItem::get_local_mouse_position);
|
||||
ClassDB::bind_method(D_METHOD("get_global_mouse_position"), &CanvasItem::get_global_mouse_position);
|
||||
ClassDB::bind_method(D_METHOD("get_canvas"), &CanvasItem::get_canvas);
|
||||
ClassDB::bind_method(D_METHOD("get_canvas_layer_node"), &CanvasItem::get_canvas_layer_node);
|
||||
ClassDB::bind_method(D_METHOD("get_world_2d"), &CanvasItem::get_world_2d);
|
||||
//ClassDB::bind_method(D_METHOD("get_viewport"),&CanvasItem::get_viewport);
|
||||
|
||||
|
@ -1325,6 +1326,11 @@ int CanvasItem::get_canvas_layer() const {
|
|||
}
|
||||
}
|
||||
|
||||
CanvasLayer *CanvasItem::get_canvas_layer_node() const {
|
||||
ERR_READ_THREAD_GUARD_V(nullptr);
|
||||
return canvas_layer;
|
||||
}
|
||||
|
||||
void CanvasItem::set_visibility_layer(uint32_t p_visibility_layer) {
|
||||
ERR_THREAD_GUARD;
|
||||
visibility_layer = p_visibility_layer;
|
||||
|
|
|
@ -363,6 +363,7 @@ public:
|
|||
virtual Rect2 get_anchorable_rect() const { return Rect2(0, 0, 0, 0); };
|
||||
|
||||
int get_canvas_layer() const;
|
||||
CanvasLayer *get_canvas_layer_node() const;
|
||||
|
||||
CanvasItem();
|
||||
~CanvasItem();
|
||||
|
|
Loading…
Reference in a new issue