Godot: Add path short-hand for "owner" Node

Created on 24 Jan 2018  路  4Comments  路  Source: godotengine/godot

Godot version:
Godot 3.x

Issue description:
It would be convenient if, in addition to using "/path" to get a relative path from the root node, and "path" to get a relative path from the current node, you could do another shorthand for accessing a relative path from the owner node (e.g. a local scene root) using something like "//path".

Thoughts?

discussion

Most helpful comment

I don't think //path is readable, and personally I rarely need to get the owner of a node (especially given the limitations @vnen mentioned), so I don't mind typing get_owner() every now and then.

Too much sugar causes health issues..

All 4 comments

So "//Particle" instead of "../Particle"? doesn't seem like much of a shortcut to me. Did I misunderstand what you meant by owner node? it's not the parent node?

The owner is not necessarily the direct parent, it can be further up in the tree. Usually the owner is the root of the scene saved to the disk, because the editor sets that automatically.

Note that if you are relying on the owner, for nodes you instance you have to set the owner manually, because it's not set by default.

I don't think //path is readable, and personally I rarely need to get the owner of a node (especially given the limitations @vnen mentioned), so I don't mind typing get_owner() every now and then.

Too much sugar causes health issues..

I'd rather prefere to have owner as a property in inspector tab. Sometimes it is more convenient to set owner there instead in node script, expecially when packing node thru PackedScene.pack()

Was this page helpful?
0 / 5 - 0 ratings