
Publisher
nif
Flex Container
An adjustable flex container. It moves from left to right and top to bottom. By applying max rows and columns, blocks can be added as placeholder for control nodes. Sizing for blocks are represented by row(x) and column(y). See included test scene for implementation example.
This plugin has been mirrored from the Godot Asset Library.
The plugin author is in no way affiliated with Gadget.
If you are the author of this plugin and would like this mirror removed, please contact support@gadgetgodot.com.
FlexContainer
A simple flex container plugin for Godot.
- Installation
- Usage
- Properties
- Alternatives
- Issues
Installation
- Download the latest version in releases or clone the repository.
- Copy the contents of
addons/FlexContainerinto yourres://addons/FlexContainerdirectory. - Enable
Dialogue Managerin your project plugins.
Usage
- Set a grid size using the
ColumnsandRowsinInspector. - In
Inspectorincrease the amount ofVector2inBlocksproperty based on the grid size (Columns×Rows). This is not required but recommended. It would also be better to avoid going beyond grid size. Vector2'sxacts as span whileyacts as row. Customize them depending to your need.- Added children within the node will change size and position corresponding to the
Vector2inBlocks. The firstVector2corresponds to the first child and so forth.
Note: when extending the script, add the tool keyword to have the exports show in the Inspector.
Properties
| Property | Type | Definition |
|---|---|---|
| Columns | int | the width or amount of column the container will have, forming a grid. |
| Rows | int | the height or amount of rows the container will have, forming a grid. |
| Blocks | PoolVector2Array | the placeholder for child nodes within the container. Each Vector2 represents a block within a grid, having its own span (x) and row (y). It moves from left to right and top to bottom. |
| Compact | boolean | it fills in the empty spaces within the container. |
| Limit Visible | boolean | it hides children that goes beyond the container's size or outside the size of Blocks. |
| Disable Min Size | boolean | it sets the rect_min_size of children to Vector2.ZERO. This is currently the default as the container can't handle rect_min_size of children. |
Alternatives
- I suggest using DockableContainer for a more cleaner and flexible alternative. It does what FlexContainer does but more! Worth a try.
Issues
- Currently has no way to properly handle
rect_min_sizeof chilren. - Adding non
Controltype nodes may cause errors or even a crash. Bypass by encapsulating it inside a control type node. - Resizing isn't fully accurate which may cause some jitter and a pixel or two of misalignment. It's annoying.
Said issues may be fixed in the future updates. However, if you know a way to fix it, do open up an issue or a pull request. Your contribution would be greatly appreciated.