CustomSampleRate
CustomSampleRate
#Overview
name: CustomSampleRate
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 11
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of CustomSampleRate is to specify a custom sample rate for imported animations in Unreal Engine 5. It is used primarily in the animation system, specifically for importing FBX animations.
This setting variable is primarily used in the Interchange Editor plugin and the UnrealEd module, which are responsible for importing and processing external assets, including animations.
The value of this variable is typically set through the import UI or configuration files. It can be modified in the FBX import settings or when configuring animation import options.
CustomSampleRate interacts with other variables such as:
- bUseDefaultSampleRate: Determines whether to use the default sample rate or the custom one.
- bResample: Indicates whether resampling should occur during import.
- bSnapToClosestFrameBoundary: Determines if the animation should snap to the closest frame boundary.
Developers should be aware of the following when using this variable:
- A value of 0 for CustomSampleRate means the system will automatically find the best sample rate.
- The variable is only used when bUseDefaultSampleRate is false.
- It affects the quality and performance of imported animations.
Best practices when using this variable include:
- Only set a custom sample rate when necessary, as the default or automatic settings are often sufficient.
- When setting a custom rate, ensure it’s appropriate for the animation to avoid quality loss or unnecessary data inflation.
- Consider the target platform and performance requirements when choosing a sample rate.
- Test the imported animations thoroughly after changing the sample rate to ensure desired quality and performance.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:686, section: [/Script/UnrealEd.FbxAnimSequenceImportData]
- INI Section:
/Script/UnrealEd.FbxAnimSequenceImportData
- Raw value:
0
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Interchange/Editor/Source/InterchangeEditor/Private/InterchangeFbxAssetImportDataConverter.cpp:278
Scope (from outer to inner):
file
namespace UE::Interchange::Private
function void FillInterchangeGenericAssetsPipelineFromFbxAnimSequenceImportData
Source code excerpt:
GenericAssetPipeline->AnimationPipeline->bSnapToClosestFrameBoundary = AnimSequenceImportData->bSnapToClosestFrameBoundary;
GenericAssetPipeline->AnimationPipeline->bUse30HzToBakeBoneAnimation = AnimSequenceImportData->bUseDefaultSampleRate;
GenericAssetPipeline->AnimationPipeline->CustomBoneAnimationSampleRate = AnimSequenceImportData->CustomSampleRate;
GenericAssetPipeline->AnimationPipeline->FrameImportRange = AnimSequenceImportData->FrameImportRange;
GenericAssetPipeline->AnimationPipeline->MaterialCurveSuffixes = AnimSequenceImportData->MaterialCurveSuffixes;
GenericAssetPipeline->AnimationPipeline->SourceAnimationName = AnimSequenceImportData->SourceAnimationName;
}
UAssetImportData* ConvertToLegacyFbx(UStaticMesh* StaticMesh, const UInterchangeAssetImportData* InterchangeSourceData)
#Loc: <Workspace>/Engine/Plugins/Interchange/Editor/Source/InterchangeEditor/Private/InterchangeFbxAssetImportDataConverter.cpp:499
Scope (from outer to inner):
file
namespace UE::Interchange::Private
function UAssetImportData* ConvertToLegacyFbx
Source code excerpt:
DestinationAnimSequenceImportData->bSnapToClosestFrameBoundary = GenericAssetPipeline->AnimationPipeline->bSnapToClosestFrameBoundary;
DestinationAnimSequenceImportData->bUseDefaultSampleRate = GenericAssetPipeline->AnimationPipeline->bUse30HzToBakeBoneAnimation;
DestinationAnimSequenceImportData->CustomSampleRate = GenericAssetPipeline->AnimationPipeline->CustomBoneAnimationSampleRate;
DestinationAnimSequenceImportData->FrameImportRange = GenericAssetPipeline->AnimationPipeline->FrameImportRange;
DestinationAnimSequenceImportData->MaterialCurveSuffixes = GenericAssetPipeline->AnimationPipeline->MaterialCurveSuffixes;
DestinationAnimSequenceImportData->SourceAnimationName = GenericAssetPipeline->AnimationPipeline->SourceAnimationName;
}
}
return DestinationAnimSequenceImportData;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Factories/FbxAnimSequenceImportData.h:64
Scope (from outer to inner):
file
class class UFbxAnimSequenceImportData : public UFbxAssetImportData
Source code excerpt:
/** Use this option to specify a sample rate for the imported animation, a value of 0 use the best matching samplerate. */
UPROPERTY(EditAnywhere, AdvancedDisplay, config, Category = ImportSettings, meta = (EditCondition = "!bUseDefaultSampleRate", ToolTip = "Sample fbx animation data at the specified sample rate, 0 find automaticaly the best sample rate", ClampMin = 0, UIMin = 0, ClampMax = 48000, UIMax = 60))
int32 CustomSampleRate;
UPROPERTY(EditAnywhere, AdvancedDisplay, config, Category = ImportSettings, meta = (ToolTip = "If enabled, snaps the animation to the closest frame boundary using the import sampling rate"))
bool bSnapToClosestFrameBoundary;
/** Name of source animation that was imported, used to reimport correct animation from the FBX file */
UPROPERTY()
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Factories/FbxSceneImportOptionsSkeletalMesh.h:87
Scope (from outer to inner):
file
class class UFbxSceneImportOptionsSkeletalMesh : public UObject
Source code excerpt:
/** Use this option to specify a sample rate for the imported animation, a value of 0 use the best matching sample rate. */
UPROPERTY(EditAnywhere, AdvancedDisplay, config, Category = Animation, meta = (EditCondition = "!bUseDefaultSampleRate", ToolTip = "Sample fbx animation data at the specified sample rate, 0 find automaticaly the best sample rate"))
int32 CustomSampleRate;
UPROPERTY(EditAnywhere, AdvancedDisplay, config, Category = Animation, meta = (ToolTip = "If enabled, snaps the animation to the closest frame boundary using the import sampling rate"))
bool bSnapToClosestFrameBoundary;
/** If true, import node attributes as either Animation Curves or Animation Attributes */
UPROPERTY(EditAnywhere, AdvancedDisplay, config, Category = Animation, meta = (DisplayName = "Import Attributes as Curves or Animation Attributes"))
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxAnimSequenceImportData.cpp:16
Scope (from outer to inner):
file
function UFbxAnimSequenceImportData::UFbxAnimSequenceImportData
Source code excerpt:
MaterialCurveSuffixes.Add(TEXT("_mat"));
CustomSampleRate = 0;
}
UFbxAnimSequenceImportData* UFbxAnimSequenceImportData::GetImportDataForAnimSequence(UAnimSequence* AnimSequence, UFbxAnimSequenceImportData* TemplateForCreation)
{
check(AnimSequence);
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxAnimSequenceImportData.cpp:96
Scope (from outer to inner):
file
function void UFbxAnimSequenceImportData::CopyAnimationValues
Source code excerpt:
bAddCurveMetadataToSkeleton = Other->bAddCurveMetadataToSkeleton;
bUseDefaultSampleRate = Other->bUseDefaultSampleRate;
CustomSampleRate = Other->CustomSampleRate;
FrameImportRange = Other->FrameImportRange;
MaterialCurveSuffixes = Other->MaterialCurveSuffixes;
SourceAnimationName = Other->SourceAnimationName;
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxMainImport.cpp:504
Scope (from outer to inner):
file
namespace UnFbx
function void ApplyImportUIToImportOptions
Source code excerpt:
// only re-sample if they don't want to use default sample rate
InOutImportOptions.bResample = !ImportUI->AnimSequenceImportData->bUseDefaultSampleRate;
InOutImportOptions.ResampleRate = ImportUI->AnimSequenceImportData->CustomSampleRate;
InOutImportOptions.bSnapToClosestFrameBoundary = ImportUI->AnimSequenceImportData->bSnapToClosestFrameBoundary;
InOutImportOptions.bPreserveLocalTransform = ImportUI->AnimSequenceImportData->bPreserveLocalTransform;
InOutImportOptions.bDeleteExistingMorphTargetCurves = ImportUI->AnimSequenceImportData->bDeleteExistingMorphTargetCurves;
InOutImportOptions.bRemoveRedundantKeys = ImportUI->AnimSequenceImportData->bRemoveRedundantKeys;
InOutImportOptions.bDoNotImportCurveWithZero = ImportUI->AnimSequenceImportData->bDoNotImportCurveWithZero;
InOutImportOptions.bImportCustomAttribute = ImportUI->AnimSequenceImportData->bImportCustomAttribute;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxSceneImportOptionsSkeletalMesh.cpp:28
Scope (from outer to inner):
file
function UFbxSceneImportOptionsSkeletalMesh::UFbxSceneImportOptionsSkeletalMesh
Source code excerpt:
, FrameImportRange(0, 0)
, bUseDefaultSampleRate(false)
, CustomSampleRate(0)
, bImportCustomAttribute(true)
, bDeleteExistingCustomAttributeCurves(false)
, bDeleteExistingNonCurveCustomAttributes(false)
, bPreserveLocalTransform(false)
, bDeleteExistingMorphTargetCurves(false)
{
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxSceneImportOptionsSkeletalMesh.cpp:70
Scope (from outer to inner):
file
function void UFbxSceneImportOptionsSkeletalMesh::FillSkeletalMeshInmportData
Source code excerpt:
AnimSequenceImportData->bPreserveLocalTransform = bPreserveLocalTransform;
AnimSequenceImportData->bUseDefaultSampleRate = bUseDefaultSampleRate;
AnimSequenceImportData->CustomSampleRate = CustomSampleRate;
AnimSequenceImportData->FrameImportRange = FrameImportRange;
AnimSequenceImportData->bImportAsScene = true;
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/SFbxSceneOptionWindow.cpp:1514
Scope (from outer to inner):
file
function void SFbxSceneOptionWindow::CopySkeletalMeshOptionsToFbxOptions
Source code excerpt:
ImportSettings->bPreserveLocalTransform = SkeletalMeshOptions->bPreserveLocalTransform;
ImportSettings->bResample = !SkeletalMeshOptions->bUseDefaultSampleRate;
ImportSettings->ResampleRate = SkeletalMeshOptions->CustomSampleRate;
ImportSettings->bSnapToClosestFrameBoundary = SkeletalMeshOptions->bSnapToClosestFrameBoundary;
ImportSettings->AnimationRange.X = SkeletalMeshOptions->FrameImportRange.Min;
ImportSettings->AnimationRange.Y = SkeletalMeshOptions->FrameImportRange.Max;
}
void SFbxSceneOptionWindow::CopyFbxOptionsToSkeletalMeshOptions(UnFbx::FBXImportOptions *ImportSettings, class UFbxSceneImportOptionsSkeletalMesh* SkeletalMeshOptions)
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/SFbxSceneOptionWindow.cpp:1543
Scope (from outer to inner):
file
function void SFbxSceneOptionWindow::CopyFbxOptionsToSkeletalMeshOptions
Source code excerpt:
SkeletalMeshOptions->bPreserveLocalTransform = ImportSettings->bPreserveLocalTransform;
SkeletalMeshOptions->bUseDefaultSampleRate = !ImportSettings->bResample;
SkeletalMeshOptions->CustomSampleRate = ImportSettings->ResampleRate;
SkeletalMeshOptions->FrameImportRange.Min = ImportSettings->AnimationRange.X;
SkeletalMeshOptions->FrameImportRange.Max = ImportSettings->AnimationRange.Y;
}
#undef LOCTEXT_NAMESPACE