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 | |
|---|---|---|---|
| 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 | 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. | |
| TObjectPtr< UMLDeformerModel > | Model | The runtime model associated with this editor model. | |
| TRange< double > | PlaybackRange | The playback range of this model for each timeframe | |
| FDelegateHandle | PostEditPropertyDelegateHandle | The delegate handle to the post edit property event. | |
| FMLDeformerSampler * | Sampler | A pointer to the sampler, which can sample target meshes to calculate deltas. | |
| FFrameTime | ScrubPosition | The current scrub position. | |
| 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 | Add all animated bones to the bone include list. | ||
| void | Add all animated curves to the curve include list. | ||
| 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. | ||
| 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 | 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 * | Create the vertex delta sampler object. | ||
| 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. | ||
| 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. | |
| 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
(
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. | ||
| 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. | |
| 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. | ||
| 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. | |
| double | GetTrainingTimeAtFrame
(
int32 FrameNumber |
Get the time in seconds, for a given frame in the training data. | |
| 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. | |
| 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 | 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 | This is called when training data inputs change. | ||
| 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 | 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 | 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
(
FFrameTime NewScrubPostion |
Set the current scrub position. | |
| void | SetScrubPosition
(
FFrameNumber NewScrubPostion |
Set the current scrub position. | |
| void | SetTestFrame
(
int32 FrameNumber |
Go to a given frame in the test data. | |
| void | SetTrainingFrame
(
int32 FrameNumber |
Go to a given frame in the training data. | |
| 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 the transforms of all the editor actors. | ||
| void | Update the visibility status of the editor actors. | ||
| 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 | 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 | Invalidate the memory usage, so it gets updated in the UI again. | ||
| 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 the playback speed of the test data. |
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 | |
|---|---|---|---|
| InitSettings | The editor model initialization settings. This is used in the Init call. |
Deprecated Functions
| Type | Name | Description | |
|---|---|---|---|
| void | CalcMeshNormals
(
TArrayView< const FVector3f > VertexPositions, |
Please call FMLDeformerMorphModelEditorModel::CalcVertexNormals instead. | |
| void | CompressEngineMorphTargets
(
FMorphTargetVertexInfoBuffers& OutMorphBuffers, |
Please call FMLDeformerMorphModelEditorModel::CompressMorphTargets instead. | |
| void | CreateEngineMorphTargets
(
TArray< UMorphTarget* >& OutMorphTargets, |
Please call FMLDeformerMorphModelEditorModel::CreateMorphTargets instead. | |
| void | DrawMorphTarget
(
FPrimitiveDrawInterface* PDI, |
Please call FMLDeformerMorphModelEditorModel::DebugDrawMorphTargets instead. | |
| void | GenerateNormalsForMorphTarget
(
int32 LOD, |
Please call FMLDeformerMorphModelEditorModel::CalcMorphTargetNormals instead. | |
| void | ZeroDeltasByThreshold
(
TArray< FVector3f >& Deltas, |
Please call FMLDeformerMorphModelEditorModel::ZeroDeltasByLengthThreshold instead. |