Create. Cpp animation class.
Instantiate it as a variable within the character.
Cast to it on begin play and on construction - do check that the skeletal mesh exists and the ABP is assigned.
This can crash out still if the ABP on the character doesn’t use the proper cpp class.
But generally speaking it allows you to push values to the ABP even from blueprint.
The alternative (crash proof) is to store the Animation Blueprint as a variable.
Since it’s a pointer.
Then in BP you can check that is valid and cast to the proper ABP on begin play. Save out the cast as a custom variable to push animation changes via BP.
One important thing that wasn’t mentioned here at all is fast path.
The way the default templates are setup basically prevents fastpath.
In fact they aren’t “examples” they are mostly a guide on “what not to do when using this engine, but we at epic do it anyway, cuz we so cool”.
You want 0 code executed on the animation blueprint.
Nothing at all. Not even an And statement apparently.
You make transition between states either happen with the Automatic checkmark - which is the only way to do animation time remaining in fast path.
Or a boolean which can have a !not as an exception to the And/Or rule.
Any Offsets or Bone manipulations etc. cannot have their Pins broken.
(breaking a pin simply means setting only what you need out of X/Y/Z, which anyone with a brain would think is Kosher and perhaps even faster, But apparently not.)
If you want to change the Z of a vector to move a bone up/down, you have to pass it a full on vector.
This affects how you need to create the CPP animation blueprint variables.
You can’t create and use a simple float because it’s all you need. You have to create a vector because that’s what Epic forces fastpath to use (for now? I’m hopeful they’ll eventually see the error of their ways in maybe 10 years when they go broke?).
So, to answer your initial question.
I’d your states are Idle and Wave, you need to first create a statemachine within the animation blueprint.
Then create the 2 states.
Then set a way for the transition between the 2 states to happen.
I’d you want this to happen from cpp code, you would then create a class for the character.
Change the character patented class to the one you created (make sure to derive it from character or you’ll get issues).
You then need to create an anim instance class. And change the animation blueprint class parenting.
With that done, you can initialize variables in CPP for the animation BP.
Make a bool, call it bWave. Set it to false in the creation (you don’t need to).
You may need to make it blueprint callable, so you got to look up the correct header you need for that.
In engine compile.
In the ABP you should now be able to pull a Get for the boolean to set your state transition up.
Once that’s done you need to get your character cpp to alter that variable directly where it’s at.
As such you need to get skeletal mesh, save it. Make sure it’s valid.
Get the mesh animation instance. Make sure it’s valid.
Cast to the animation class.
Make sure it’s a valid cast.
And finally, storing that value you can then ->bWave = true (or false) wherever you like.
2 hour setup the first time you do it. That’s for sure.