DaveTheCoder How to use it?
TextureRect
- Edited
Place it in the Godot project folder, and drag it from the FileSystem dock into the TextureRect's texture field in the Inspector. You can also load the texture using code.
DaveTheCoder Maybe I put it wrong , I need to round the edges of a square picture ! How to do it?
DaveTheCoder Example
- Edited
Use an application such as Gimp or Inkscape to round the corners.
As far as I know, Godot can't do that, unless someone has created an addon that does it.
DaveTheCoder It can't be done in Godot ?
A PanelContainer can have round corners when creating a theme for it so earlier I tried using one with a texture rect as its content but I found no way to clip the image. Maybe one could use a shader for that but I am no shader expert.
A styleboxflat (like with panelcontainer) can have its corners rounded, you can then use clip in canvasitem to confine a children node to it. It's that simple!
You NEED themes if you use UI, it's the way of working in godot and it's really good, so look into it.
You can do this by adding the TextureRect as a child of a PanelContainer.
Add a StyleBoxFlat to the PanelContainer in "Theme overrides -> Styles -> Panel". Then set the corner radius to whatever values you like best.
Then, in PanelContainer go to "Visibility -> Clip children" and set it to "Clip only" or "Clip + Draw".
Caseyftw Thanks!