I have a character model with a bunch of morph targets, they work. They are to change the appearance of the character, like a character creator.
The problem is, I cannot figure out what is the best way to apply them, and in my research I have found either no information on this, or conflicting answers.
The setup I have right now is a base actor BP with, among other components,
- a skeletal mesh component
- a custom object I made containing an array of all the morph targets (name and value) that can be applied to the mesh. The concept I have been working with is to modify the values in this list. Then, at some point, that list is read and those values are copied to the matching targets on the mesh. This is for serialization, different character configurations, and so on.
I want to be able to change the values of morph targets in that list, in the editor, and have them applied real-time, without having to start the game or compile anything (to design the characters). I also want these targets simply applied in-game (for obvious reasons).
I have also seen other people say to set all the morph targets in the character’s Animation Blueprint Initialization event. Why? The targets are applied to the skeletal mesh and I can access that from anywhere. I mean it works, but not in the editor, and not when any target value is changed.
To get the instant visual feedback I mentioned, I can call a function to apply the targets in the construction script of the actor BP. Apparently I am not supposed to do that. It also doesn’t work, only when the animation blueprint is compiled.
So right now it’s:
Editor:
Actor BP Construction Script → Animation Blueprint Event (Build Morphs) → Instance problem where it cannot read the specific list of target values for the character that called it. They all share the same instance of the ABP? Until the game is ran? That doesn’t exactly make sense. I don’t know.
In-Game:
Animation Blueprint Event (Build Morphs) → Works, somehow
Anywhere I try to apply the targets, I can generally get it to work in some way, but not the exact way I described, which means it is not feasible to design characters.
One issue I have consistently been having is a type of abstract object-oriented instancing problem. The Animation Blueprint (where I am currently assigning the target values) cannot read the instance of the owner’s target list, only the list for the generic template character.
It really feels like there is a better way to do this, and I’d like to hear about other solutions.