Why can't gui.get_node() get a node that is a template instance? (SOLVED)

I have a gui that includes a template. It looks roughly like this:

- Gui
    - Nodes
        - hud (template)
            - foo

From my gui script, I’m able to get the foo node:

gui.get_node('hud/foo')

But I’m not able to get the hud node, which is the instance of the template:

gui.get_node('hud')  -- Gives error "No such node: hud"

Is this intended behaviour? It seems like I should be able to get and programatically manipulate the template node, since it has a position, rotation, scale, etc, just like every other node in the gui. Specifically, I am trying to animate the position of the template so it slides on/off screen.

hud is just part of the name. It does not correspond to any node. If you want a root node that is the parent for all nodes in the template you have to explicitly create one (in tenplate) and make all other nodes children.

1 Like

I agree that the tree view is unclear here. It looks like “hud” is a node - but it is not. There is no template instance, only instances of the nodes from the template.

1 Like

Ok, gotcha. I’ll probably introduce a root node in the template as you suggested. As you say, it’s a bit unclear - the template looks like a node in the tree view. It also has transforms like a node would. It seems to be a part of the scene graph, but not a “node” in the gui sense.

BTW, is it possible to create a root node that just has children, but doesn’t render a box?

EDIT: Ah, I see it has been asked before: Transparent box nodes
I can just do what’s suggested in that thread.

2 Likes