Navigation
API > API/Plugins > API/Plugins/MLDeformerFrameworkEditor
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UMLDeformerTrainingModel
- UNearestNeighborTrainingModel
- UNeuralMorphTrainingModel
- UVertexDeltaTrainingModel
References
| Module | MLDeformerFrameworkEditor |
| Header | /Engine/Plugins/Animation/MLDeformer/MLDeformerFramework/Source/MLDeformerFrameworkEditor/Public/MLDeformerTrainingModel.h |
| Include | #include "MLDeformerTrainingModel.h" |
Syntax
UCLASS&40;Blueprintable&41;
class UMLDeformerTrainingModel : public UObject
Remarks
The training model base class. This class is used to interface with Python by providing some methods you can call inside your python training code. For example it allows you to get all the sampled data, such as the deltas, bones and curve values. When you create a new model you need to create a class inherited from this base class, and define a Train method inside it as follows:
//Doesn'tneedanimplementationinsidecpp,justadeclarationintheheaderfile.int32Train()const;
Now inside your Python class you do something like:
@unreal.uclass()classYourModelPythonTrainingModel(unreal.YourTrainingModel):@unreal.ufunction(override=True)deftrain(self):#...dotraininghere...return0#Avalueof0issuccess,1meansaborted,seeETrainingResult.
The editor will execute the Train method, which will trigger the "train" method in your Python class to be executed. Keep in mind that in Unreal Engine all python code is lower case. So a "Train" method inside c++ will need to be called "train" inside the python code. Or if you have something called "PerformMyTraining" it will need to be called "perform_my_training" inside Python.
Variables
| Type | Name | Description | |
|---|---|---|---|
| UE::MLDeformer::FMLDeformerEditorModel * | EditorModel | A pointer to the editor model from which we use the sampler. | |
| TArray< float > | SampleBoneRotations | The bone rotations in bone (local) space for this sample. This is updated after SetCurrentSampleIndex is called and is 6 floats per bone (2 columns of 3x3 rotation matrix). | |
| TArray< float > | SampleCurveValues | The curve weights. This is updated after SetCurrentSampleIndex is called. | |
| TArray< float > | SampleDeltas | The delta values per vertex for this sample. This is updated after SetCurrentSampleIndex is called. Contains an xyz (3 floats) for each vertex. |
Functions
| Type | Name | Description | |
|---|---|---|---|
| UE::MLDeformer::FMLDeformerEditorModel * | Get a pointer to the editor model. | ||
| UMLDeformerModel * | GetModel () |
Get the runtime ML Deformer model object. | |
| bool | Check whether we need to resample the inputs and outputs, or if we can use a cached version. | ||
| int32 | Get number of input curves. | ||
| int32 | Get the number of vertex deltas. | ||
| int32 | Get the number of input transforms. This is the number of bones. | ||
| void | Init
(
UE::MLDeformer::FMLDeformerEditorModel* InEditorModel |
Initialize the training model. This is automatically called by the editor. | |
| int32 | NumSamples () |
Get the number of samples in this data set. | |
| bool | SampleFrame
(
int32 Index |
This updates the sample deltas, curves, and bone rotations. | |
| bool | SetCurrentSampleIndex
(
int32 Index |
Set the current sample frame. | |
| void | SetEditorModel
(
UE::MLDeformer::FMLDeformerEditorModel* InModel |
Change the pointer to the editor model. | |
| void | SetNeedsResampling
(
bool bNeedsResampling |
Specify whether we need to resample any cached data or not, because our input assets, or any other relevant settings changed that would invalidate the cached data. | |
| void | SetNumFloatsPerCurve
(
int32 NumFloatsPerCurve |
Set the number of floats per curve. On default this is one. |