godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.05k stars 65 forks source link

Expose CanvasItem RID of Window node background (or material slot) #9317

Open FireCatMagic opened 2 months ago

FireCatMagic commented 2 months ago

Describe the project you are working on

3D Platformer, but this case is just a thing with stylizing a settings menu.

Describe the problem or limitation you are having in your project

image Windows can have styleboxes, which makes them display the said stylebox. I'd like to add a material to this purple panel to give it stripes for some extra stylization. Problem is, I can't access the CanvasItem that is drawing it. If I could get the RID, i could use RenderingServer.canvas_item_set_material to set the material.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Exposing the CanvasItem RID would at the minimum allow me to put a material on it.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

There could be a "get_canvas_item_rid" function or something that returns it, but only if the window is embedded to display a stylebox.

If this enhancement will not be used often, can it be worked around with a few lines of script?

I've searched through the Window class to see if I could somehow grab the RID of the displayed CanvasItem, but to my knowledge I cannot.

Is there a reason why this should be core and not an add-on in the asset library?

There isn't a way to access the drawn CanvasItem of a window

AThousandShips commented 2 months ago

What stylebox are you talking about being displayed? I can't find anything like this, and window doesn't have a canvas item like this

FireCatMagic commented 2 months ago

What stylebox are you talking about being displayed? I can't find anything like this, and window doesn't have a canvas item like this

image "embedded_border" and "embedded_focus_border" image It allows you to draw a stylebox under the window I assume that internally there is a canvasitem to render this, unless for some reason there isn't and i'm dumb

AThousandShips commented 2 months ago

There isn't an item for it like that, it's handled by the parent viewport and entirely internal, window doesn't know about it

FireCatMagic commented 2 months ago

There isn't an item for it like that, it's handled by the parent viewport and entirely internal, window doesn't know about it

I guess then this proposal thing is just a way to somehow get access to it I'm not sure how it's drawn if it doesn't have a canvasitem RID

AThousandShips commented 2 months ago

The window itself doesn't have any RID, the RID is in the viewport that embeds it, so the window can't access it, it's internal to the viewport that contains it, extracting it would be complicated