Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | vonflyhighace2 | |
Old Version | Published before Godot 3 was released. |
I have a box container with buttons as child nodes. The buttons are larger than the container so I tried scaling them down but the buttons do not respect the scale value. Is there a way to scale buttons inside a container?
Not sure I understand the problem you’re describing. What kind of container are you using? The plain one I think doesn’t enforce any sizing.
Have you tried using a ButtonGroup, HBox, or VBox?
avencherus | 2016-11-05 21:34
I’ve tried everything from buttonGroups to gridContainer. The base Container class is really nothing but a disguised control node. The problem is that the child nodes scale is linked to the parents scale. Try changing the child’s scale will only result in it being overridden by the parents scale. the only way to change the scale of the child is to change the parent container scale which will then change all child node. That is a problem if you only want to change a single child node.
vonflyhighace2 | 2016-11-05 22:41
If that’s your problem I would say turn off the size flags. (The horizontal/vertical fills and expands.) Then set the minimum size property to scale it up to what you’d want.
avencherus | 2016-11-05 23:13
Unfortunately that was one of the first things I tried. The problem with that it only changes the size {width/height} of the node not its scale. That would be good if you have say a texture button/Frame you wanted to resize. But if that texture button had any children then they would not be resized causing a weird issue and trying to resize all child nodes is not practical when on the other hand they scale accordingly. I find that only the container nodes have this issue.
vonflyhighace2 | 2016-11-05 23:41
You may need need to set custom minimum size and try with the various size flags and values of controls.
I’ve had a lot of problems with scroll container because sets everything to minimum size and reset all resizes.
eons | 2016-11-06 00:09
There is no current option to set a minimum scale size for nodes like you can do for its size property. That’s the problem I have. My node has child nodes that need to be resized accordingly with the parent node. Just resizing the parent does nothing for the child nodes and trying to manually resize all child node proportionally to the parent is not practical. I can achieve this using every other node that’s not apart of the container class. The reason I wanted to use one of the containers is that they have organizational properties build-in to help with child nodes. This lead me to believe the container class is fundamentally broken.
vonflyhighace2 | 2016-11-06 00:26
Actually You would need a Maximum property so that the node knows not to go over the set parameter since it will default to the parents scale.
vonflyhighace2 | 2016-11-06 00:30