Animation Blueprint code with different skeletons

If you have many monsters in your game with different skeletons, there needs to be a way to reuse the code in animation blueprints in a common class.

Right now you’re stuck creating an AnimBlueprint with a skeleton and then having to copy paste nodes around between different blueprints. It’s going to be a nightmare trying to maintain this since I’m going to have foot IK code, hand IK code, nested locomotion state machines, etc…

3 Likes

That’s why you should use one skeleton for many monsters.
The AnimationBP and the Animations are “bound” to the skeleton. You either need to retarget the Animations (“copies” the animations and animation blueprints) or use the same skeleton for each monster.

No im with illYay on this one. Retargeting is nice but only a cheap solution and cant replace custom animations on custom skeletons if you are aiming for that level of quality.
Lets say we have 5 dfferent monsters with their own individual skeletons and animations libraries (which obviously have the same naming convention throughout and have generally been organized well). Then there should be a way to tell the BP to use a specific character along with his skeleton and animations. Or to create a parentClass BP with all functions and variables for the monster class working. So that for each monster you have to create a bp from that class and that should get you 90% of the way.

3 Likes

Yeah, I see no reason why there can’t be common code for doing all the work of driving foot IK standing on arbitrary slopes for example. And then common code for locomotion state machines, and all the other things. I’ve touched the code for Animation Blueprint Nodes a few times and there’s nothing in there that can’t allow for an arbitrary skeleton at any time. 4.13 added sub anim blueprints, which I was excited for since I thought that did this very thing. Except it still has the problem of needing a hard set skeleton.

All we need is a way to pass in as parameters what animation assets we actually want to use for each character.

Like if I have a locomotion state machine, let all of that code be common, but let me pass in the walk blendspace, and jump animation, and all the other things.

I already have many input parameters into the anim BP to specify what animation asset should be playing, such as idle hand poses for the specific gun the player is using, or what idle animation to play underneath the anim montage.

And I don’t plan on reusing the same walking animation between different characters. Each one is a fairly unique looking monster with their own walk cycles and movement styles. All I want is the common code for driving that instead of having to copy paste nodes around.

you are right!
i don’t know why UE’s staff can’t understand such a basic need!

I’m going to raise this topic again.

What’s the actual situation on this? I’ve dug into that and seems that the problem still remains.

And, if for Epic’s team that’s not a problem, which is the proper way to handle it in order to not redo 85% of the animation blueprint again?

It’s hard to understand that all that logic inside the animation blueprint that is perfectly reusable for other characters but just with different animations for a different skeleton, can’t be reused.

I hope any of you can bring some light into this subject!

Unless I missed it in a new engine update, Nope, there is no normal way of reusing animation BP as a template for different skeleton. But searching brings up a few different ways people have worked around the issue.

I’ve been able to at least use sub anim instances to make modular anim blueprints.

I have this PR that aims to fix problems with anim instances, like notifies not triggering, and montages not playing. https://github.com/EpicGames/UnrealEngine/pull/4866

Can we talk about this again? It’s unbelievable to me this still isn’t a thing. I want to have a multitude of humanoid characters with wildly differing skeletons but pretty much identical animation behaviour… but it seems insane to copy/paste every bit of the anim blueprint for every new character every time I improve my animation BP.

Why isn’t it possible for an anim BP to just work with any skeleton? The engine seems very capable of this with a bit of tinkering. I ended up changing just a few lines of engine code and now I can create a generic anim BP where I just need to specify the relevant animations for every new creature. The only thing making this annoying is the fact that previewing and debugging doesn’t really work. The preview of course still shows the parent BP’s skeleton preview mesh.

I feel like this is a really important thing, or am I just really missing something here?

I hear about sub anim instances a lot when looking for answers on this topic. Can you work around this limitation with them? If so, how? They seem to have pretty much the same rigid limitation to a specific skeleton.

I really don’t like having to pick between either:

  1. retargeting every animation I do to a single skeleton (and hoping they come out looking ok - which is rather unlikely when working with non-human characters)
  2. redoing my anim BPs over and over again

There has to be a better way.

3 Likes

Have you looked into modifying the .uasset file or any of the Python scripting capabilities that are now live?
It would not be too hard to simply replace every animation asset int he BP with a script by pre-pending or appending the character name to it. Yes you’d still have multiple files, but no you wouldn’t have to drop in and change any of the state machine anims individually.

I was thinking they must do this due to the way the anim blueprints are compiled. They do some kind of validation with bone names and bone indicies, and things like that.

If I was them I’d change this underlying behavior though. It would be great to have a common anim blueprint and just specify skeleton and anim assets to use. I guess there’s an assumption that your characters will always be humanoid. Imagine making a game like DooM though with all sorts of types of monsters that are going to most likely have very incompatible skeletons.

The funny thing is, you can write C++ AnimInstance subclasses that do this same thing. Only Anim Blueprints are tied to a skeleton as far as I know. I wonder if you can build a native animInstance by manually linking anim nodes together. The examples I’ve seen of native anim instances do very basic things like control bone locations. Maybe you can prototype an animation blueprint and once you know it works, manually convert it to a native blueprint using the same node layout. Not ideal at all of course, but it’d be interesting to try…

Another year passed and now I’m here wondering how this can still be an actual issue… :frowning:

I guess the best bet is taking all your code to function or macro libraries to reduce the amount you have to copy & paste.
Otherwise, if the actors at least share a base class, maybe you can do the calculating there and in the AnimBP only copy the variable values…

You could also do it in a function library and save all your animation variables in a custom struct… Idk…

Aren’t there any best practices on this? As of now I’m making a hell lot of copy pasta with a still very limited amount of skeletons (caused by having different animals in the game).

It’s also resulting in a lot of work if you copied your calculations to all the anim BPs only to find out some of it is faulty and you have to the same bug fixes in all the BPs…

Perhaps 4.25 give us new options on this ?

I’m not sure how long it has been since Retargeting was made avaliable, but that is precisely what allows you to interface different skeletons with the same blueprint. As state originally by others.

The reason for the constrain to 1 skeleton is the possible divergence of bone tracks.
how can the engine blend bone tracks if a bone track exists in one animation but bot in the other? It cannot.
Hence, all animations are required to utilize the same skeleton, which forces the same bone tracks to be present.

.25 gave us superior debugging, but I don’t think they made changes to the core of the system…

There’s a solution that’s not so obvious but I think it does what most of you are looking for:

  1. Create Animation Blueprint for one skeleton, create all logic etc. inside it
  2. Right-Click this base AnimBP in Content Browser and create child blueprint
  3. Open child blueprint AnimBP and go to Class Settings (the icon with the gear), change Target Skeleton there
  4. Go to “Asset Override Editor” tab. If it’s not open, click in the menu: Window -> Asset Override Editor
  5. replace all animations from old skeleton with animations from new skeleton
  6. If it’s not working as expected, try to compile/save/close/open the AnimBP

Hope that’s useful for you! Let me know if it works for you.

4 Likes

Hi, this would be insane but I cant replace the animations after completing the prior steps. Only animations from the OLD skeleton are present in the Asset Browser and it wont allow me to drag and drop animations from the new skeleton.

2 Likes

I got to the Asset Override Editor on my own before finding this thread and am now stuck like LuNaTiqQc. If anyone knows the secret to solving this, it would be incredibly helpful!

Just tried in 4.25.1 and doesnt work. When changing the skeleton it only shows the old animations and preview mesh cant be changed either. I mean its gotta be a bug otherwise why have the skeleton override?

You probably forgot to complie after charging the skeleton.
you should also close persona and open it again.

This. Compile, save, close, open again. Then it should work. If not, try in 4.24 if it doesn’t work in 4.25. Couldn’t test it in the new version yet. But I don’t think it is broken there.

I edited my original post and added this.