Can we make macros/functions for Anim Graph?

I would like to nest some of the same blending logic into a few different SM nodes. Is there a way to make a macro or function for AnimGraph?

You can save part of your branches using “save new cache pose” and rename it as you see fit. Then you must call “use cache pose “saved name”” as input.

In addition, calculated variables should always be done outside the animgraph, and saved as booleans or float variables to be considered “thread-safe” inside the anim graph. That said, always use the results of a calculation as final variable inside the animgraph

So there’s no way to put, for example, a series of Layered blend per bone nodes into a macro, to work on any pose that is input into the series?

Not I am aware of. “Save new cache pose” is the way to go. As a remark, you can turn the anim sequences inputs into variables, and update its current values outside the anim graph using notifies or blueprint communication (from your player to the animation blueprint, for instance).

Can we cache poses inside State Machine states? It’s not coming up in the right click menu for me.

I believe you can. Just double check for any potential circular references that might occur. If you right click inside anim graph, type in “save new cache pose”, and it should appear. Then rename it. Take a look at any Paragon character, which comes with anim BPs

The closest you can get to re-usable components inside an Anim Graph, similar to functions/macros in Event Graphs is by using Linked Anim Graphs.

They allow you to move a portion of your Anim Instance to another Blueprint and then define variables and input poses. I’m using it to make repetitive structures re-usable.

As for other earlier replies: You can only make cached poses in the root of the Anim Graph, but you can use them anywhere. Not really sure why this limitation has been imposed.

Example:

3 Likes

Thank you Lennard, Much appreciated.

Quick question. Do you have an idea on how how to make the animation poses flow through it, if it’s possible at all?

For instance, I want to make a function to blend per bone with two poses which should be able to be variable.

Actually, I just want to make a function like layered blend per bone or any other anim graph node which has pose inputs and a result flows out.

I would love to hear your thoughts on this.

With kind regards,

Eric

I was to quick to ask: For anyone searching for it: You need to get the Input Pose Node:


Works great!

1 Like