Consfused by NodePaths

rcorrercorre Posts: 11Member
edited July 10 in General Chat

I have the following tree:

  • Root
    • Cube
      • AnimationPlayer
    • AnimationWrapper

I'm trying to programatically add tracks to the AnimationWrapper that are AnimationPlayback tracks for the AnimationPlayer. When I add a AnimationPlayback track with the path "../Cube/AnimationPlayer", it appears as a broken link. When I add a track using the UI, I noticed it uses the path "Cube/AnimationPlayer". This doesn't make much sense to me, as I think that "Cube/AnimationPlayer" would refer to a node at the full path "Root/Cube/AnimationWrapper/Cube/AnimationPlayer", which doesn't exist. "../Cube/AnimationPlayer" seems right to me, as the ".." brings it up to the parent "Root", then "Cube/AnimationPlayer" navigates to the nested animation player from there. Why doesn't that work as expected, and how does "Cube/AnimationPlayer" (without a "..") actually work?

Best Answer

  • rcorrercorre Posts: 11
    Accepted Answer

    Aha. It is because the AnimationPlayer computes its paths relative to a root path which defaults to "..".

Answers

  • rcorrercorre Posts: 11Member

    In other words, when I use the Godot UI to add a track to an AnimationPlayer, it adds a path that looks like a child path (no "..") but actually functions as a sibling path (as if it had a "..")

  • rcorrercorre Posts: 11Member
    Accepted Answer

    Aha. It is because the AnimationPlayer computes its paths relative to a root path which defaults to "..".

Sign In or Register to comment.