godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.07k stars 69 forks source link

AnimationTree - Allow reusing existing nodes / multiple connections #2386

Open Flavelius opened 3 years ago

Flavelius commented 3 years ago

Describe the project you are working on

RPG like game

Describe the problem or limitation you are having in your project

When trying to model upper body/lower body behaviour in BlendTrees it soon becomes obvious that there needs to be a lot of duplication. It's quite normal to have a full-body animation tree that blends in difference upper body animations while also affecting the lower body in certain states, for example spell casting; in contrast to FPS/shooters, spell casting animations typically involve the whole body. This requires the animation system to play the spellcasting anmation on the whole body when the character is standing still, but only on the upper body when it is moving while allowing to blend between both at any time. Currently this means needing duplicate blendtree content and 'duplicate input parameters', which is mainenance heavy and feels unnecessary, just to have synced upper/lower body animations when needed while also allowing overrides.

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

If animation nodes could have multiple output targets, it would be a simple blend2 node that improved the situation, as the blend2 could then be used to just filter out body parts from the output allowing it to mimic layering like in other engines. Whole blendtree graphs could be reused and just blended with filters where needed, keeping all attached animations in sync and just using a single parameter set.

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

Just allow output connections to be attached to multiple other nodes

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

It is probably not a few lines of script as it likely involves the way the GraphEdit itself works.

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

It's part of the regular animation editing workflow and potentially adds up a lot of possibilities

Flavelius commented 2 years ago

Maybe this could be achieved in the form of a 'Reference' like node for simplicity. This Reference node references another one's output. Internally this would probably only require checking for closed loops, but would not further touch other nodes. I'm not sure how these are processed internally, but i would assume that blending an animation into itself is not prohibited, which means the basic prerequisites for handling this virtual multi-output are already there. I really hope someone can tackle this as it's way too much additional work and very error prone currently having to duplicate (manually mind you) whole parts of animation trees and handling all their duplicate inputs via code.

CristianCape commented 1 month ago

This would be very useful.

AThousandShips commented 1 month ago

@CristianCape Please don't bump without contributing significant new information. Use the :+1: reaction button on the first post instead.