How to make a scene instance behave like a Container in the Scene Tree panel?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DyFric

I have a scene (ItemBag) for a widget to reuse often that has a PanelContainer (search_out). The scene tree looks like this:
ItemBag's scene tree: the scene to instantiate
And in another scene (GUI) I’d like ItemBag instances to behave like a Container:
in the Scene Tree panel each child of ItemBag would end up in the PanelContainer search_out, like Label in the screenshot below.
Ideally the GUI Scene Tree panel would only look like this:
GUI's scene tree: the scene using several ItemBags


Of course I can enable Editable Children to each ItemBag, but that clutters the Scene Tree panel very much and visually identifying modifications of the instance remains hard.

I am thinking about using @export_node_path(Control) in ItemBag’ script to move Label in _ready() but that is not scalable and looks convoluted…

How would you deal with such a situation with re-usability in mind?

success with this approach:

  1. a proxy Container, parent of ItemBag which handles the layout.
  2. a proxy Control, child of search_out, for each external child.

A component version is in the works that will leave ItemBag instances free for a custom script.

DyFric | 2023-04-12 16:41