Expose CanvasItem.get_canvas_layer()
to GDScript/C#
#8863
Labels
Milestone
CanvasItem.get_canvas_layer()
to GDScript/C#
#8863
Describe the project you are working on
An alternate UI solution implemented with scripts based on Node2D.
Describe the problem or limitation you are having in your project
While handling inputs, I need to calculate the order of my custom control roots in the viewport to properly propagate input events from Viewport to my custom control roots.
Because
CanvasItem.get_canvas_layer()
is not exposed to GDScript/C#, It's impossible to do that like how Godot Controls do that.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Expose
get_canvas_layer()
to GDScript.It's also great to have a method to get which CanvasLayer node the CanvasItem node is in, just like you can get Viewport node using
CanvasItem.get_viewport()
.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
If this enhancement will not be used often, can it be worked around with a few lines of script?
As far as I know, there's no way to get the CanvasLayer from CanvasItem via script, since it's not exposed.
The only thing you can get is canvas RIDs, but you can't pull viewport canvas stacking layer data from RenderingServer.
Is there a reason why this should be core and not an add-on in the asset library?
It's basic Viewport/CanvasLayer functions in CanvasItem nodes.
The text was updated successfully, but these errors were encountered: