godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Add an AnimationTreeCommentNode #7313

Open Flynsarmy opened 1 year ago

Flynsarmy commented 1 year ago

Describe the project you are working on

A third person character with an AnimationTree.

Describe the problem or limitation you are having in your project

AnimationTrees can get quite complex. I've been using various tricks and techniques to work around current bugs and limitations but will inevitably forget what I've done and upon returning later down the track, be confused about why I've done hwat I've done. This is a common pattern in the developer world.

There is currently no way to add comments inside an AnimationTree to refresh my memory or explain to the next poor soul that has to look at this mess.

Here's an example. I have an AnimationNodeStateMachine where I've added dummy animations with no purpose that I've named noop. Why did I do this? The correct answer is that I'm using a combination of an At End switch and a transition expression to work around a nasty bug in the engine, but it's impossible to tell without a comment block. image

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

I'd love a Comment node akin to how comments work in Unreal Engines Blueprint system.

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

Here's a screenshot of a Blueprint comment. Ideally we'd get something that works the same way. image

To add an AnimationTreeNodeComment the user would right click - Add Comment. This node would appear behind others and allow a comment to be typed into it or into a field in the Inspector.

When dragging a comment node around, any other nodes inside of it would also be moved along with it.

All node types (including Comments) can be dragged into and out of a comment node freely.

A comment node has no functionality and doesn't interact with Transitions - it's purely for informational and usability purposes.

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

The workaround is to have a documentation file somewhere in your project folder.

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

A feature like this wouldn't be project-specific. I'm also unsure if new node types can be added with addons.

Calinou commented 1 year ago

This is likely pending on https://github.com/godotengine/godot/pull/67152 (or its sub-PRs https://github.com/godotengine/godot/pull/79308 and https://github.com/godotengine/godot/pull/79311) to be completed.