Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an easy way to change target path in AnimationTrack #4847

Open
KoBeWi opened this issue Jul 10, 2022 · 6 comments · May be fixed by godotengine/godot#99362
Open

Add an easy way to change target path in AnimationTrack #4847

KoBeWi opened this issue Jul 10, 2022 · 6 comments · May be fixed by godotengine/godot#99362

Comments

@KoBeWi
Copy link
Member

KoBeWi commented Jul 10, 2022

Describe the project you are working on

Just some game that uses animations.

Describe the problem or limitation you are having in your project

When using AnimationPlayer, you sometimes end up with invalid target property path. When you move or delete nodes, the tracks are updated automatically, but this sometimes fails. Aside from that, you might copy a track or copy animation or do something unexpected that will leave you with track pointing to a different node than you'd like to.

This is where the problems start. You can't change the target easily. All you have is some tiny text box that doesn't even display half of the path. You need to navigate this tiny space and manually type/paste your desired path. The usability of this is trash.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

I'd like to have an option to easily pick new target node. Like, a right-click menu in the track editor that gives you an option "Change Target Node". When you select it, you are presented with node list on the scene and you can pick a new node. When you do so, the track path will be updated to the new node, keeping the property.

Changing property could be an option too, because why not.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

image
(context menu here)

If this enhancement will not be used often, can it be worked around with a few lines of script?

It requires editor modifications.

Is there a reason why this should be core and not an add-on in the asset library?

It's useful when working with animations.

@Invertex

This comment was marked as off-topic.

@klaritan
Copy link

This issue is still present. I moved a node into a parent and it didn't update. I had to manually create en entire track again.

@jasonmorgado
Copy link

I find locating the new path occasionally tricky, so my current workaround is:

  • create a new track with the desired target node
  • copy the node+property path
  • Paste it in the original path
  • Delete the new track

This would be much easier with the ability to select a new target node, and take the same property.
This also affects one track at a time, where several tracks may reference the same node.

I like the idea of selecting a new target node for a single track, maybe even all the tracks on a node.

One would still need to consider how to select the new target node. Does it restrict it to the same type of Node? Does the property dictate what kind of node can be switched to?
If we had a track set to a modulate property on a Node2D, you'd need something inheriting CanvasItem since that's the class modulate came from.

If you changed the node path of two tracks together, like modulate and position, it would need to be a Node2D since that's the lowest class in the hierarchy. (vs CanvasItem)

Change property might also be tricky if you could switch to a property of a different type. Maybe differently typed properties could be grayed out from the select property dialog? Like position could switch to scale since both are Vector2, but couldn't be switched to modulate which is a Color. Or force the property to be the same?

@jasonmorgado
Copy link

I've recently started putting together an implementation for this proposal. (For my first contribution)

My current planned solution is similar to what was mentioned above:

  • Right clicking on the text box of the track (the left side of the divider) will open a PopupMenu with the following options:
    • "Change Node" would prompt the user with the SceneTree Dialogue, with the nodes filtered for whichever class owns the property. For example a track of a Sprite2D's modulate property would filter for "CanvasItem" since CanvasItem provides the modulate property.
    • "Change Property" would prompt the user with the property dialogue for properties in the current node. It should be filtered to be only the same property type (Vector2 should filter for Vector2s).
      • Another idea could be just prompting for any Node then a property of the same type, but that could be confusing if the first item is "Change Node" and the latter "Change Property"
    • "Copy To Another Node" seems useful. Perhaps "Change Node" should instead be "Move to Another Node" then?

I'm planning to keep my changes in the scope of individual tracks, not the groups of tracks under a particular node, mentioned in a issue below.

Filtering the SceneTree dialogue seems straightforward, haven't yet looked into filtering the property dialogue. I might drop "Change Property" if it seems like too much effort for one PR.

Also related: Copy/Pasting tracks currently exist under the AnimationPlayer's Edit button. But between animations not to different nodes or properties.

Issues related to the implementation of this proposal:

Issues somewhat related:

  • Picking node for audio track could be improved godot#55944
    • Picking a node for a new Audio Track should filter the Scene Tree for AudioStreamPlayers (and similar nodes mentioned in the issue).
    • Somewhat related to how "Change/Move node" buttons will filter the scene tree dialogue
    • The rest of the track types outside Property and Bezier probably need filtering as well.
  • Animation Editor, no right click menu, on left half of key frame at time 0 godot#56074
    • Seems to be related to how the split between the text box and keyframe editor works. Currently clicks on the left of the divider register for the track path, and the right register on the keyframe editor.
    • I guess the problem would be keyframes at time 0 shows up on top of the divider itself, unless you move the timeline to the right.

@jasonmorgado
Copy link

Found two more related proposals, both appear to be duplicates of proposal 444 describing selecting the node group and moving tracks over.
#1090
#3008

Both are either covered by this proposal or 444 so seems like some issues can be closed/merged somehow.

@sigilbaram
Copy link

@jasonmorgado I came here looking for this kind of suggestion as I just broke an AnimationPlayer by moving it. Cool to see someone is already working on it.

The AnimationPlayer.root_node has an Editor control that might be useful if it can be reused here or even just used as an example. The default click is a popup to change the target node rather than jump to it in the editor, which is instead under the context menu. That seems nicer to me than jumping being the default click behavior as you can just close the popup if it's not what you meant to do vs having to navigate back (I've been annoyed by that more than once...). Another option would be for clicking the node to offer more properties to add? Maybe turn all these behaviors into icons next to the node name instead of on the name itself? Not sure which approach is actually better as I'm new here and not sure what is best for workflow...

On a related note, while your already looking at this, I would also suggest being able to collapse on the node in the track tree in order to hide the tracks under a give node. #444 had a LOT of properties keyed in that one skeleton and if you wanted to focus on animating a different node it would be nice to get all that out of the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants