Replace NodePath
properties with Node
s
#6095
Replies: 1 comment
-
Good, idea, I wonder if it's too late, too big change for Godot 4? For some cases nodepaths actually make more sense, for example in animation, where all track paths are relative to root and also point to properties. I made a list of properties and methods that use nodepaths to pass references to nodes. I tried to filter out any instances where paths are relative or make more sense otherwise. Comment if you find something I missed or if this list contains properties/methods where nodepath should remain.
As a side note, there's inconsistency whether property names end with |
Beta Was this translation helpful? Give feedback.
-
Since godotengine/godot#62185, we have the ability to export
Node
types as properties in the editor, rather than justNodePath
s. which simplifies the need for code that gets an actualNode
from the path.However, there are a few properties of built-in engine classes that still use
NodePath
s to provide access to aNode
object; for example, RemoteTransform3D.remote_path. This feels unnecessarily clunky, sinceNode
s are used more often thanNodePath
s, resulting in extra conversions when working with the latter.Additionally, with a direct export of a
Node
type, the specific type ofNode
could be specified (Node2D
,Node3D
, etc.), whereas withNodePath
s, a path to an incompatible type of node could be given; for example, withRemoteTransform3D
, giving a path to aNode2D
.Beta Was this translation helpful? Give feedback.
All reactions