Navigation
API > API/Plugins > API/Plugins/MLDeformerFrameworkEditor
Inheritance Hierarchy
- TSharedFromThis
- FGCObject
- FMLDeformerEditorModel
- FMLDeformerGeomCacheEditorModel
- FMLDeformerMorphModelEditorModel
- FNearestNeighborEditorModel
- FNeuralMorphEditorModel
- FVertexDeltaEditorModel
References
| Module | MLDeformerFrameworkEditor |
| Header | /Engine/Plugins/Animation/MLDeformer/MLDeformerFramework/Source/MLDeformerFrameworkEditor/Public/MLDeformerEditorModel.h |
| Include | #include "MLDeformerEditorModel.h" |
Syntax
class FMLDeformerEditorModel :
public TSharedFromThis< FMLDeformerEditorModel > ,
public FGCObject
Remarks
The base class for the editor side of an UMLDeformerModel. The editor model class handles most of the editor interactions, such as property changes, triggering the training process, creation of the viewport actors, and many more things. In most cases you will want to inherit your own editor model from either FMLDeformerGeomCacheEditorModel or FMLDeformerMorphModelEditorModel though. These classes will already implement a lot of base functionality in case you work with geometry caches as ground truth data etc.
Variables
| Type | Name | Description | |
|---|---|---|---|
| int32 | ActiveTrainingInputAnimIndex | The training input animation that is selected in the timeline. | |
| bool | bDisplayFrames | Display frame numbers? | |
| bool | bIsReadyForTraining | Are we ready for training? The training button in the editor will be enabled or disabled based on this on default. | |
| bool | bIsScrubbingTimeline | Are we currently scrubbing the timeline? | |
| bool | bNeedsAssetReinit | Set to true when on next tick we need to trigger an input assets changed event. | |
| bool | bNeedToResampleInputOutputs | Do we need to resample all input/output data? | |
| int32 | CurrentTrainingFrame | The current training frame. | |
| FMLDeformerEditorToolkit * | Editor | A pointer to the editor toolkit. | |
| TArray< FMLDeformerEditorActor * > | EditorActors | The set of actors that can appear inside the editor viewport. | |
| TObjectPtr< UMLDeformerInputInfo > | EditorInputInfo | The input info as currently setup in the editor. | |
| TObjectPtr< UMeshDeformer > | HeatMapDeformerGraph | The heatmap deformer graph. | |
| TObjectPtr< UMaterial > | HeatMapMaterial | The heatmap material. | |
| FDelegateHandle | InputObjectModifiedHandle | The delegate that handles when an object got modified (any object). | |
| FDelegateHandle | InputObjectPropertyChangedHandle | The delegate that handles when an object property got changed (any object). | |
| TSharedPtr< SMLDeformerInputWidget > | InputWidget | The inputs widget. | |
| TArray< FLODInfo > | LODMappings | The LOD information. | |
| TObjectPtr< UMLDeformerModel > | Model | The runtime model associated with this editor model. | |
| int32 | NumTrainingFrames | The total number of frames that can be used for training, based on the training input animations list. | |
| TRange< double > | PlaybackRange | The playback range of this model for each timeframe | |
| FDelegateHandle | PostEditPropertyDelegateHandle | The delegate handle to the post edit property event. | |
| TArray< TSharedPtr< FMLDeformerSampler > > | Samplers | A sampler for every input animation. These samplers are used to calculate the vertex deltas. | |
| FFrameTime | ScrubPosition | The current scrub position. | |
| TArray< FVector3f > | SkinnedPositions | A reusable array to store current LOD skinned vertex positions. | |
| TArray< TSharedPtr< FName > > | VertexAttributeNames | A list of vertex attribute names that can be used inside combobox UI elements. | |
| TRange< double > | ViewRange | The range we are currently viewing | |
| TRange< double > | WorkingRange | The working range of this model, encompassing the view range |
Destructors
| Type | Name | Description | |
|---|---|---|---|
| The destructor, which unregisters the instance of this editor model from the model registry. |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AddAnimatedBonesToBonesIncludeList
(
const UAnimSequence* AnimSequence |
||
| void | Add all animated bones to the bone include list. | ||
| void | AddAnimatedCurvesToCurvesIncludeList
(
const UAnimSequence* AnimSequence |
||
| void | Add all animated curves to the curve include list. | ||
| void | AddCompareActor
(
int32 ArrayIndex |
||
| void | ApplyDebugActorTransforms
(
const TArray< FTransform >& DebugActorComponentSpaceTransforms |
Apply the transforms of the actor we debug to the editor actors in our world. | |
| void | Apply the transforms of the debug actor to the actors in the asset editor world. | ||
| void | CalcMeshNormals
(
TArrayView< const FVector3f > VertexPositions, |
Calculate the normals for each vertex, given the triangle data and positions. | |
| int32 | CalcNumValidCompareActorsPriorTo
(
int32 CompareActorIndex |
||
| double | Calculate the test mode timeline position. | ||
| double | Calculate the current time line position offset, of the currently selected frame. | ||
| double | Get the current playback position of our training mode. | ||
| void | ChangeSkeletalMeshOnComponent
(
USkeletalMeshComponent* SkelMeshComponent, |
Change the skeletal mesh on a specific skeletal mesh component. | |
| void | Check whether our training data frame number changed. | ||
| void | Clamp the current test frame index to be in a valid range. | ||
| void | Clamp the current training frame index to be in a valid range. | ||
| void | Clears the Persona preview scene. Resetting the preview mesh, preview mesh component etc. | ||
| void | ClearWorld () |
Clears the world, which basically means it removes all the editor actors and engine actors from the editor world. | |
| void | Clear both the world and preview scene. This calls ClearWorld and ClearPersonaPreviewScene. | ||
| void | CompressEngineMorphTargets
(
FMorphTargetVertexInfoBuffers& OutMorphBuffers, |
Compress morph targets into GPU based morph buffers. | |
| void | CopyBaseSettingsFromModel
(
const FMLDeformerEditorModel* SourceEditorModel |
Copy the common property values from a source model into this model. | |
| float | CorrectedFrameTime
(
int32 FrameNumber, |
Correct floating point errors that can cause issues when sampling animation using step timing. | |
| void | CreateActors
(
const TSharedRef< IPersonaPreviewScene >& InPersonaPreviewScene |
Create the editor actors. | |
| FMLDeformerEditorActor * | CreateEditorActor
(
const FMLDeformerEditorActor::FConstructSettings& Settings |
Create an actor in the editor viewport. | |
| void | CreateEngineMorphTargets
(
TArray< UMorphTarget* >& OutMorphTargets, |
Generate engine morph targets from a set of deltas. | |
| void | Create the heat map assets for this model. | ||
| void | Create the heat map deformer graph for this model. This updates the HeatMapDeformerGraph member. | ||
| void | Create the heat map material for this model. This updates the HeatMapMaterial member. | ||
| TSharedPtr< SMLDeformerInputWidget > | Create the input widget. | ||
| FMLDeformerSampler * | |||
| TSharedPtr< FMLDeformerSampler > | Create the vertex delta sampler object. | ||
| void | |||
| void | CreateTestCompareActors
(
UWorld* World |
Create the compare actors for the testing mode. | |
| void | CreateTestGroundTruthActor
(
UWorld* World |
Create the test ground truth actor. | |
| void | CreateTestLinearSkinnedActor
(
UWorld* World |
Create the linear skinned test actor. | |
| void | CreateTestMLDeformedActor
(
UWorld* World |
Create the test ML Deformed actor. | |
| void | CreateTrainingGroundTruthActor
(
UWorld* World |
Create the training ground truth actor. | |
| void | CreateTrainingLinearSkinnedActor
(
const TSharedRef< IPersonaPreviewScene >& InPersonaPreviewScene |
Create the linear skinned actor that is used as training base. | |
| void | Delete all editor actors. | ||
| void | DrawMorphTarget
(
FPrimitiveDrawInterface* PDI, |
Debug draw specific morph targets using lines and points. | |
| void | Debug draw helpers inside the PIE viewport that highlight debuggable actors. | ||
| FMLDeformerEditorActor * | FindEditorActor
(
int32 ActorTypeID |
Find an editor actor with a specific ID, or return nullptr when not found. | |
| UMLDeformerComponent * | FindMLDeformerComponent
(
int32 ActorID |
Find the ML Deformer component of a given editor actor. | |
| TVertexAttributesConstRef< float > | FindVertexAttributes
(
FName AttributeName |
Find the float based vertex attributes on the skeletal map that have a given name. | |
| void | GenerateNormalsForMorphTarget
(
int32 LOD, |
Generate the normals for a given morph target. | |
| int32 | |||
| UAnimSequence * | Get the currently active training input animation sequence, which is the one that the viewport is showing the timeline for in training mode. | ||
| const UAnimSequence * | Get the animation sequence, either the test or training one, depending on in which mode we are in. | ||
| FText | Check whether the vertex counts of the skeletal mesh have changed compared to the one we have trained on. | ||
| int32 | Get the currently desired training frame number. | ||
| FMLDeformerEditorToolkit * | GetEditor () |
Get a pointer to the ML Deformer editor tookit. Cannot be a nullptr. | |
| const TArray< FMLDeformerEditorActor * > & | Get all the created editor actors. | ||
| UMLDeformerInputInfo * | Get the editor's input info object. | ||
| double | GetFrameRate () |
Get the framerate specified by the anim sequence. | |
| FString | Get the path to the heat map deformer graph asset. | ||
| FString | Get the path to the heat map material asset. | ||
| FText | GetIncompatibleSkeletonErrorText
(
const USkeletalMesh* InSkelMesh, |
Check for incompatible skeletons between the skeletal mesh and anim sequence skeleton. | |
| FText | Check for errors in the inputs. | ||
| TSharedPtr< SMLDeformerInputWidget > | |||
| UMLDeformerModel * | GetModel () |
Get a pointer to the runtime ML Deformer model. Cannot really be a nullptr. | |
| int32 | GetNumCurvesOnSkeletalMesh
(
USkeletalMesh* SkelMesh |
Get the number of curves on a specific skeletal mesh. | |
| int32 | Get the total number of frames used for training, but limited by the maximum number of training frames we have setup. | ||
| int32 | Get the total number of frames in the test anim sequence. | ||
| int32 | Get the number of training frames. | ||
| int32 | Get the number of training input animations. | ||
| FText | Get the text that we should display as overlay on top of the asset editor viewport. | ||
| TRange< FFrameNumber > | Get the playback range of the model's data. | ||
| bool | Check whether we need to resample inputs and outputs. | ||
| FMLDeformerSampler * | GetSampler () |
Get the sampler we use to calculate vertex deltas when we are in training mdoe and enable deltas. | |
| FMLDeformerSampler * | |||
| FMLDeformerSampler * | GetSamplerForTrainingAnim
(
int32 AnimIndex |
Get the vertex delta sampler for a given training input animation. | |
| float | GetScrubTime () |
Get the current scrub time. | |
| FText | Check to see if the skeletal mesh has to be reimported because it misses some newly added data. | ||
| bool | Check whether this model supports a per training input animation vertex mask. | ||
| FText | Check whether the vertex count in the target mesh has changed or not. | ||
| int32 | GetTestFrameAtTime
(
double TimeInSeconds |
Get the test data frame number for a specific time offset in seconds. | |
| double | GetTestTimeAtFrame
(
int32 FrameNumber |
Get the time in seconds, for a given frame in the test data. | |
| int32 | Get the tick resolution we are displaying at. | ||
| FFrameNumber | Get the current scrub position. | ||
| int32 | Get how many ticks there are per frame. | ||
| FMLDeformerEditorActor * | Get the editor actor that defines the timeline play position. | ||
| FString | Get the onnx file name of the trained network. | ||
| int32 | GetTrainingFrameAtTime
(
double TimeInSeconds |
Get the training data frame number for a specific time offset in seconds. | |
| FMLDeformerTrainingInputAnim * | GetTrainingInputAnim
(
int32 Index |
Get a given training input animation. | |
| double | GetTrainingTimeAtFrame
(
int32 FrameNumber |
Get the time in seconds, for a given frame in the training data. | |
| const TArray< TSharedPtr< FName > > & | Get the array of vertex attribute names that can be used for UI widget elements. | ||
| FText | Check whether the vertex map has changed or not. | ||
| TRange< double > | GetViewRange () |
Get the current view range.Get the current view range | |
| FMLDeformerEditorActor * | Get the base actor depending on the currently active mode (train or test mode). | ||
| TRange< double > | Get the working range of the model's data. | ||
| UWorld * | GetWorld () |
Get a pointer to the world that our editor is displaying. Cannot be nullptr. | |
| void | Handle the timeline changes when our model changes. | ||
| void | HandleViewRangeChanged
(
TRange< double > InRange |
Handle the view range being changed. | |
| void | HandleVizModeChanged
(
EMLDeformerVizMode Mode |
Handle the timeline changes required when changing the visualization mode, so when we switch between training and testing mode. | |
| void | HandleWorkingRangeChanged
(
TRange< double > InRange |
Handle the working range being changed. | |
| void | Init
(
const InitSettings& Settings |
Initialize the model. | |
| void | Initialize the bone include list of the runtime model to the set of bones that are animated. | ||
| void | Initialize the curve include list of the runtime model to the set of curves that are animated. | ||
| void | InitInputInfo
(
UMLDeformerInputInfo* InputInfo |
Initialize the input information, which basically describes what the inputs to the neural network are going to be. | |
| void | Mark the deltas to be updated on next Tick. | ||
| bool | IsAnimIndexValid
(
int32 AnimIndex |
||
| bool | IsCompatibleDeformer
(
UMLDeformerAsset* Deformer |
Check if this model is compatible with a specific deformer asset. | |
| bool | Is the timeline displaying frames rather than seconds? | ||
| bool | Perform some basic checks to see if the editor can be ready to train the model. | ||
| bool | Check whether we are playing an animation or not. | ||
| bool | Check whether our anim sequence is playing forward or backward. | ||
| bool | Check whether we are ready to train. | ||
| bool | Are we scrubbing on the timeline? | ||
| bool | IsTrained () |
Check whether our model is trained or not. | |
| UMeshDeformer * | Load the default Optimus deformer graph to use on the skeletal mesh when using this model. | ||
| bool | Load the trained network from an onnx file. | ||
| void | OnDebugActorChanged
(
TObjectPtr< AActor > DebugActor |
Called whenever the actor to debug has been changed. | |
| void | This is called when training data inputs change. | ||
| void | Executed when the maximum number of LOD levels changed. | ||
| void | OnObjectModified
(
UObject* Object |
Called whenever an engine object is being modified. | |
| void | Executed when the user presses the play button in the timeline. | ||
| void | OnPostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
Executed when a property changes by a change in the UI. This internally calls OnPropertyChanged. | |
| void | This is executed after the input assets have changed. | ||
| void | OnPostTraining
(
ETrainingResult TrainingResult, |
This method is executed after training. | |
| void | This is called just before we start the training process. | ||
| void | OnPropertyChanged
(
FPropertyChangedEvent& PropertyChangedEvent |
This is called whenever a property value changes in the UI. | |
| void | OnTimeSliderScrubPositionChanged
(
double NewScrubTime, |
This is executed when the timeline has been scrubbed. | |
| void | OnTrainingAborted
(
bool bUsePartiallyTrainedData |
This is executed when the training process got aborted by the user. | |
| void | This is triggered when the training frame is changed by the user. | ||
| void | Refresh the contents of the input widget. This includes the bone and curve list contents. | ||
| void | Call the SetupComponent on every ML Deformer component on our editor actors and update the compatibility status of the deformer components. | ||
| void | |||
| void | RemoveCompareActor
(
int32 ArrayIndex |
||
| void | Render
(
const FSceneView* View, |
Render additional (debug) things in the viewport. | |
| void | SampleDeltas () |
Sample the vertex deltas between the training base model and target model. | |
| void | SetActiveTrainingInputAnimIndex
(
int32 Index |
||
| void | This makes sure that the deformer graph selected in the visualization settings is not a nullptr. | ||
| void | SetDisplayFrames
(
bool bDisplayFrames |
Set if frames are displayed. | |
| void | SetHeatMapMaterialEnabled
(
bool bEnabled |
Specify whether the heat map material should be enabled or not. | |
| void | SetInputWidget
(
TSharedPtr< SMLDeformerInputWidget > Widget |
||
| void | SetResamplingInputOutputsNeeded
(
bool bNeeded |
Set whether we need to resample inputs or not. | |
| void | SetScrubPosition
(
FFrameNumber NewScrubPosition, |
||
| void | SetScrubPosition
(
FFrameTime NewScrubPosition, |
||
| void | SetScrubPosition
(
FFrameNumber NewScrubPosition |
Set the current scrub position. | |
| void | SetScrubPosition
(
FFrameTime NewScrubPosition |
Set the current scrub position. | |
| void | SetTestFrame
(
int32 FrameNumber |
||
| void | SetTestFrame
(
int32 FrameNumber, |
Go to a given frame in the test data. | |
| void | SetTimelineAnimNames
(
const TArray< TSharedPtr< FMLDeformerTrainingInputAnimName > >& AnimNames |
Set the names of the anim sequences in the timeline. | |
| void | SetTrainingFrame
(
int32 FrameNumber, |
Go to a given frame in the training data. | |
| void | SetTrainingFrame
(
int32 FrameNumber |
||
| void | SetViewRange
(
TRange< double > InRange |
Set the current view range. | |
| void | Tick
(
FEditorViewportClient* ViewportClient, |
Tick the editor viewport. | |
| ETrainingResult | Train () |
Launch the training. | |
| void | TriggerInputAssetChanged
(
bool bRefreshVizSettings |
This will call OnInputAssetsChanged first, followed by OnPostInputAssetChanged. | |
| void | Update LOD levels of the actors in editor world. | ||
| void | Update the transforms of all the editor actors. | ||
| void | Update the visibility status of the editor actors. | ||
| void | |||
| void | This applies the right mesh deformer to the editor actors that have an ML Deformer component on them. | ||
| void | Update the editor's input info based on the current UI settings. | ||
| void | Because of some technical reasons we cannot display a correct ground truth heat map at the moment while playing an animation. | ||
| void | Update the state that is used to decide whether the Train button in the UI is enabled or not. | ||
| void | UpdateLabels () |
Update the visibility of the labels, as well as their positions. | |
| void | |||
| void | Invalidate the memory usage, so it gets updated in the UI again. | ||
| void | Update the mesh offset factors, which is basically controlling where to place the actors in the scene. | ||
| void | Updates the number of available training frames as returned by GetNumTrainingFrames(). | ||
| void | UpdatePaintModePose
(
bool bFullUpdate |
Update the character's pose in paint mode. | |
| void | Update the persona preview scene's actor, skeletal mesh component, mesh and anim asset. | ||
| void | UpdateRanges () |
Update the timeline related ranges, based on the length of the training or testing data. | |
| void | Update whether we force to use step interpolation on the ML Deformed model or not. | ||
| void | Update the playback speed of the test data. | ||
| void | Update the timeline's training input animation list. | ||
| void | This should update the list of available training devices. | ||
| void | Update the vertex attribute names array as returned by GetVertexAttributeNames(). | ||
| void | ZeroDeltasByThreshold
(
TArray< FVector3f >& Deltas, |
Zero all deltas with a length equal to, or smaller than the threshold value. |
Overridden from FGCObject
| Type | Name | Description | |
|---|---|---|---|
| void | AddReferencedObjects
(
FReferenceCollector& Collector |
Pure virtual that must be overloaded by the inheriting class. | |
| FString | Overload this method to report a name for your referencer |
Classes
| Type | Name | Description | |
|---|---|---|---|
| FLODInfo | |||
| InitSettings | The editor model initialization settings. This is used in the Init call. |