0 votes

Is it possible that for the next version of GODOT, a visibility classification is added, which allows the object to remain in place with its size, and only the texture is not visible?

I suggest naming it "invisibility".

I propose this because when using a grid container and hiding an object, the content moves to the empty column. This is the case with many other containers. This prevents certain animations and operations with the nodes. For example when displaying in a grid of 3 columns, 9 images, in random order. The result is a mess and they go out side by side and are sorted as they appear. This type of effect would like to do it, but the current visibility property does not allow it. Thanks in advance.

asked Mar 3 in Engine by Dariem (12 points)

1 Answer

+1 vote

There are several ways to workaround this:

  • 1) Make the control transparent by changing modulate to a transparent color, and change its mouse mode to ignore so it will not process mouse events

  • 2) Hide the contents of your control rather than the control itself. If not applicable, wrap your node within a basic Control, so the parent will remain visible and the child hidden. This will also allow you to animate the child freely, relative to the rectangle it should normally occupy.

  • 3) Write your own container. Much more work. I ended up doing that to animate my menu horizontally while still having my buttons auto-layout vertically.

  • 4) Search, or ask for a visibility-layout hint feature in https://github.com/godotengine/godot-proposals/issues, then wait for someone to do a PR, or code it yourself. That said, if you also want movement animation, option 2) or 3) already work better than a complex proposal.

answered Mar 3 by Zylann (26,143 points)

The first way is probably the best way to do it :)
When you set a node's modulate alpha to 0, it won't even be rendered. This improves performance.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.