#How to make control node inside a container smaller?
1 messages · Page 1 of 1 (latest)
You mean that even their minimum size is too small or you can't figure out how to resize them?
I mean they are too big with their minimum size set to 0, 0 and I can't figure out how to make them smaller
this is how it looks right now and I can't seem to find a way to make it smaller
The theme has its own minimum size for some elements. You'd have to modify it.
I think that constants and StyleBoxes are the main sources of those lower limits.
Do I need to modify theme of container or elements specifically?
I tried editing default base scale in theme settings and it didn't work, and stylebox doesn't have any useful size settings. Is it all ways I can potentially edit elements size?
I replaced the style boxes and textures and it lets me make it as small as 1 pixel
Then ig im doing something wrong can you show where you edited that?
In my case i used theme overrides to do it faster, but here:
The PlaceHolderTexture is 1x1
oh but is it possible to use default icons but make it smaller? or not really
also with it texture of checkbox is 1x1 but text stays like its same size still
First i have to ask: Is the checkbox in a container that affects its size?
But the text size is controlled from the font size override.
Checkbox is child of vboxcontainer with anchor preset set to full rect, I set font size to small enough size but it aligns like this on checkbox because checkbox is big
If it has the anchors set to full, then it will always take up all the space it can.
You'd have to reduce its anchors.
setting them to center top or center wide checkbox still same size
may it be its smallest size is just so big and can't be made smaller?
uh i can't seem to find them
it doesn't have this field
The property is on the CheckBox
That field only appears for Control nodes inside a Container.
checkbox is set like this
Both options would need to be set to Shrink so it tries to stay at the smallest possible size
There's still a texture that's not been replaced, that's why there is a rounded dark square in there.
But i imagine that some StyleBox may also still not be replaced
That would be the next step to further reduce the size.
problem is do i now need to make textures for its being enabled/disabled or is there a way to use default ones
You'd have to make a new theme.
Once you add the CheckBox item to your theme, you can just copy the original textures (before replacing them) and make new smaller ones.
OR do it trough code (just set an override that uses the original texture of the theme but scaled down.)
Texture2D.get_image() returns an object that you can modify and transform back into an ImageTexture
Example: the bottom one has not been replaced, so i can copy the original, press the + button to replace it and then paste it back in.
i can't seem to understand how to make it smaller in gui
Yeah, i don't think there is a way to do it from Godot outside of doing it from code.
You'd need an image editor.
why its so hard to just scale down a checkbox xd, so how do i do it from code?
Ik, oddly annoying. I think Control nodes are just for quickly making menus and are not very robust.
I haven't tried in a while, but i imagine something like this:
var icon_names: Array[StringName] = ["icon","checked","unchecked","etc"]
for icon: StringName in icon_names:
var icon_texture: Texture2D = get_theme_icon(icon)
var image: Image = icon_texture.get_image()
var new_size := Vector2(image.get_width()/2, image.get_height()/2)
var image.resize(new_size.x, new_size.y)
var new_tex: ImageTexture = ImageTexture.create_from_image(image)
add_theme_icon_override(icon, new_tex)