ModelImporter

Struct ModelImporter 

Source
pub struct ModelImporter {
Show 121 fields pub m_AddColliders: bool, pub m_AnimationCompression: i32, pub m_AnimationPositionError: f32, pub m_AnimationRotationError: f32, pub m_AnimationScaleError: f32, pub m_AnimationWrapMode: i32, pub m_BakeSimulation: bool, pub m_ClipAnimations: Vec<ClipAnimationInfo>, pub m_GlobalScale: f32, pub m_HasExtraRoot: bool, pub m_ImportedRoots: Vec<PPtr>, pub m_MeshCompression: i32, pub m_Name: String, pub m_UseFileUnits: bool, pub normalSmoothAngle: f32, pub bakeAxisConversion: Option<bool>, pub blendShapeNormalImportMode: Option<i32>, pub generateSecondaryUV: Option<bool>, pub indexFormat: Option<i32>, pub keepQuads: Option<bool>, pub legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: Option<bool>, pub m_AddHumanoidExtraRootOnlyWhenUsingAvatar: Option<bool>, pub m_AdditionalBone: Option<bool>, pub m_AnimationDoRetargetingWarnings: Option<bool>, pub m_AnimationImportErrors: Option<String>, pub m_AnimationImportWarnings: Option<String>, pub m_AnimationRetargetingWarnings: Option<String>, pub m_AnimationType: Option<i32>, pub m_AssetBundleName: Option<String>, pub m_AssetBundleVariant: Option<String>, pub m_AutoGenerateAvatarMappingIfUnspecified: Option<bool>, pub m_AutoMapExternalMaterials: Option<bool>, pub m_AvatarSetup: Option<i32>, pub m_CopyAvatar: Option<bool>, pub m_ExternalObjects: Option<Vec<(SourceAssetIdentifier, PPtr)>>, pub m_ExtraExposedTransformPaths: Option<Vec<String>>, pub m_ExtraUserProperties: Option<Vec<String>>, pub m_FileIDToRecycleName: Option<Vec<(i64, String)>>, pub m_FileIdsGeneration: Option<i32>, pub m_FileScale: Option<f32>, pub m_FileScaleFactor: Option<f32>, pub m_FileScaleUnit: Option<String>, pub m_FirstImportVersion: Option<i32>, pub m_GenerateAnimations: Option<i32>, pub m_GenerateMaterials: Option<i32>, pub m_HasEmbeddedTextures: Option<bool>, pub m_HasPreviousCalculatedGlobalScale: Option<bool>, pub m_HumanDescription: Option<HumanDescription>, pub m_HumanoidOversampling: Option<i32>, pub m_ImportAnimatedCustomProperties: Option<bool>, pub m_ImportAnimation: Option<bool>, pub m_ImportBlendShapeDeformPercent: Option<bool>, pub m_ImportBlendShapes: Option<bool>, pub m_ImportCameras: Option<bool>, pub m_ImportConstraints: Option<bool>, pub m_ImportLights: Option<bool>, pub m_ImportMaterials: Option<bool>, pub m_ImportPhysicalCameras: Option<bool>, pub m_ImportVisibility: Option<bool>, pub m_ImportedTakeInfos: Option<Vec<TakeInfo>>, pub m_InternalIDToNameTable: Option<Vec<((i32, i64), String)>>, pub m_IsReadable: Option<bool>, pub m_LODScreenPercentages: Option<Vec<f32>>, pub m_LastHumanDescriptionAvatarSource: Option<PPtr>, pub m_LegacyGenerateAnimations: Option<i32>, pub m_MaterialImportMode: Option<i32>, pub m_MaterialLocation: Option<i32>, pub m_MaterialName: Option<i32>, pub m_MaterialSearch: Option<i32>, pub m_Materials: Option<Vec<SourceAssetIdentifier>>, pub m_MeshSettings_generateSecondaryUV: Option<bool>, pub m_MeshSettings_normalImportMode: Option<i32>, pub m_MeshSettings_secondaryUVAngleDistortion: Option<f32>, pub m_MeshSettings_secondaryUVAreaDistortion: Option<f32>, pub m_MeshSettings_secondaryUVHardAngle: Option<f32>, pub m_MeshSettings_secondaryUVPackMargin: Option<f32>, pub m_MeshSettings_swapUVChannels: Option<bool>, pub m_MeshSettings_tangentImportMode: Option<i32>, pub m_MotionNodeName: Option<String>, pub m_NewHashIdentity: Option<MdFour>, pub m_NodeNameCollisionStrategy: Option<i32>, pub m_OldHashIdentity: Option<MdFour>, pub m_OptimizeGameObjects: Option<bool>, pub m_PreserveHierarchy: Option<bool>, pub m_PreviousCalculatedGlobalScale: Option<f32>, pub m_ReferencedClips: Option<Vec<GUID>>, pub m_RemapMaterialsIfMaterialImportModeIsNone: Option<bool>, pub m_RemoveConstantScaleCurves: Option<bool>, pub m_ResampleCurves: Option<bool>, pub m_ResampleRotations: Option<bool>, pub m_RigImportErrors: Option<String>, pub m_RigImportWarnings: Option<String>, pub m_SortHierarchyByName: Option<bool>, pub m_SplitAnimations: Option<bool>, pub m_StrictVertexDataChecks: Option<bool>, pub m_SupportsEmbeddedMaterials: Option<bool>, pub m_UseFileScale: Option<bool>, pub m_UseSRGBMaterialColor: Option<bool>, pub m_UsedFileIDs: Option<Vec<i64>>, pub m_UserData: Option<String>, pub maxBonesPerVertex: Option<i32>, pub meshOptimizationFlags: Option<i32>, pub minBoneWeight: Option<f32>, pub normalCalculationMode: Option<i32>, pub normalImportMode: Option<i32>, pub normalSmoothingSource: Option<i32>, pub optimizeBones: Option<bool>, pub optimizeMesh: Option<bool>, pub optimizeMeshForGPU: Option<bool>, pub secondaryUVAngleDistortion: Option<f32>, pub secondaryUVAreaDistortion: Option<f32>, pub secondaryUVHardAngle: Option<f32>, pub secondaryUVMarginMethod: Option<i32>, pub secondaryUVMinLightmapResolution: Option<f32>, pub secondaryUVMinObjectScale: Option<f32>, pub secondaryUVPackMargin: Option<f32>, pub skinWeightsMode: Option<i32>, pub splitTangentsAcrossUV: Option<bool>, pub swapUVChannels: Option<bool>, pub tangentImportMode: Option<i32>, pub weldVertices: Option<bool>,
}
Expand description

ModelImporter is a class of the Unity engine since version 3.4.0. Exert from Unity’s scripting documentation: Model importer lets you modify model import settings from editor scripts. Settings of this class match the ones exposed in Mesh Import Settings.

Fields§

§m_AddColliders: bool§m_AnimationCompression: i32

Animation compression setting.

§m_AnimationPositionError: f32

Allowed error of animation position compression.

§m_AnimationRotationError: f32

Allowed error of animation rotation compression.

§m_AnimationScaleError: f32

Allowed error of animation scale compression.

§m_AnimationWrapMode: i32

The default wrap mode for the generated animation clips.

§m_BakeSimulation: bool§m_ClipAnimations: Vec<ClipAnimationInfo>

Animation clips to split animation into. See Also: ModelImporterClipAnimation.

§m_GlobalScale: f32

Global scale factor for importing.

§m_HasExtraRoot: bool§m_ImportedRoots: Vec<PPtr>

Vec<PPtr<GameObject>>: (3.4.0 - 2022.3.2f1)

§m_MeshCompression: i32

Mesh compression setting.

§m_Name: String

The name of the object.

§m_UseFileUnits: bool

Detect file units and import as 1FileUnit=1UnityUnit, otherwise it will import as 1cm=1UnityUnit.

§normalSmoothAngle: f32§bakeAxisConversion: Option<bool>

Computes the axis conversion on geometry and animation for Models defined in an axis system that differs from Unity’s (left handed, Z forward, Y-up). When enabled, Unity transforms the geometry and animation data in order to convert the axis. When disabled, Unity transforms the root GameObject of the hierarchy in order to convert the axis. bool: (2020.1.0b1 - 2022.3.2f1)

§blendShapeNormalImportMode: Option<i32>

i32: (2018.3.0f2 - 2022.3.2f1)

§generateSecondaryUV: Option<bool>

Generate secondary UV set for lightmapping. bool: (3.5.0 - 2022.3.2f1)

§indexFormat: Option<i32>

Format of the imported mesh index buffer data. i32: (2017.3.0b1 - 2022.3.2f1)

§keepQuads: Option<bool>

If this is true, any quad faces that exist in the mesh data before it is imported are kept as quads instead of being split into two triangles, for the purposes of tessellation. Set this to false to disable this behavior. bool: (5.0.0f4 - 2022.3.2f1)

§legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: Option<bool>

bool: (2018.3.0f2 - 2022.3.2f1)

§m_AddHumanoidExtraRootOnlyWhenUsingAvatar: Option<bool>

bool: (2020.2.0f1 - 2022.3.2f1)

§m_AdditionalBone: Option<bool>

bool: (4.0.0 - 2022.3.2f1)

§m_AnimationDoRetargetingWarnings: Option<bool>

bool: (5.1.0f1 - 2022.3.2f1)

§m_AnimationImportErrors: Option<String>

String: (5.1.0f1 - 2022.3.2f1)

§m_AnimationImportWarnings: Option<String>

String: (5.1.0f1 - 2022.3.2f1)

§m_AnimationRetargetingWarnings: Option<String>

String: (5.1.0f1 - 2022.3.2f1)

§m_AnimationType: Option<i32>

Animator generation mode. i32: (4.0.0 - 2022.3.2f1)

§m_AssetBundleName: Option<String>

Get or set the AssetBundle name. String: (5.0.0f4 - 2022.3.2f1)

§m_AssetBundleVariant: Option<String>

Get or set the AssetBundle variant. String: (5.0.0f4 - 2022.3.2f1)

§m_AutoGenerateAvatarMappingIfUnspecified: Option<bool>

Generate auto mapping if no avatarSetup is provided when importing humanoid animation. bool: (2019.3.0f1 - 2022.3.2f1)

§m_AutoMapExternalMaterials: Option<bool>

bool: (2017.2.0b2 - 2017.2.0b6)

§m_AvatarSetup: Option<i32>

The Avatar generation of the imported model. i32: (2019.3.0b1 - 2022.3.2f1)

§m_CopyAvatar: Option<bool>

bool: (4.0.0 - 2019.3.0a2)

§m_ExternalObjects: Option<Vec<(SourceAssetIdentifier, PPtr)>>

Vec<(SourceAssetIdentifier, PPtr<[Object]>)>: (2017.2.0b2 - 2022.3.2f1)

§m_ExtraExposedTransformPaths: Option<Vec<String>>

Animation optimization setting. Vec: (4.3.0 - 2022.3.2f1)

§m_ExtraUserProperties: Option<Vec<String>>

A list of default FBX properties to treat as user properties during OnPostprocessGameObjectWithUserProperties. Vec: (2017.1.0f2 - 2022.3.2f1)

§m_FileIDToRecycleName: Option<Vec<(i64, String)>>

Vec<(i32, String)>: (3.4.0 - 4.7.2); Vec<(i64, String)>: (5.0.0f4 - 2018.4.36f1)

§m_FileIdsGeneration: Option<i32>

i32: (2019.4.0f1 - 2022.3.2f1)

§m_FileScale: Option<f32>

Scaling factor used when useFileScale is set to true (Read-only). f32: (5.0.0f4 - 2022.3.2f1)

§m_FileScaleFactor: Option<f32>

f32: (2018.3.0f2 - 2022.3.2f1)

§m_FileScaleUnit: Option<String>

String: (2018.3.0f2 - 2022.3.2f1)

§m_FirstImportVersion: Option<i32>

i32: (3.4.0 - 3.4.2)

§m_GenerateAnimations: Option<i32>

Animation generation options. i32: (3.4.0 - 3.5.7)

§m_GenerateMaterials: Option<i32>

i32: (3.4.0 - 3.4.2)

§m_HasEmbeddedTextures: Option<bool>

bool: (2017.2.0b2 - 2022.3.2f1)

§m_HasPreviousCalculatedGlobalScale: Option<bool>

bool: (2018.2.0b1 - 2019.1.0a13)

§m_HumanDescription: Option<HumanDescription>

The human description that is used to generate an Avatar during the import process. HumanDescription: (4.0.0 - 2022.3.2f1)

§m_HumanoidOversampling: Option<i32>

Controls how much oversampling is used when importing humanoid animations for retargeting. i32: (5.2.0f2 - 2022.3.2f1)

§m_ImportAnimatedCustomProperties: Option<bool>

Import animated custom properties from file. bool: (2017.2.0b2 - 2022.3.2f1)

§m_ImportAnimation: Option<bool>

Import animation from file. bool: (4.0.0 - 2022.3.2f1)

§m_ImportBlendShapeDeformPercent: Option<bool>

Import BlendShapes deform percent. bool: (2022.1.0b1 - 2022.3.2f1)

§m_ImportBlendShapes: Option<bool>

Controls import of BlendShapes. bool: (4.1.0 - 2022.3.2f1)

§m_ImportCameras: Option<bool>

Controls import of cameras. Basic properties like field of view, near plane distance and far plane distance can be animated. bool: (2017.1.0b1 - 2022.3.2f1)

§m_ImportConstraints: Option<bool>

Import animation constraints. bool: (2018.1.0b2 - 2022.3.2f1)

§m_ImportLights: Option<bool>

Controls import of lights. Note that because light are defined differently in DCC tools, some light types or properties may not be exported. Basic properties like color and intensity can be animated. bool: (2017.1.0b1 - 2022.3.2f1)

§m_ImportMaterials: Option<bool>

bool: (3.5.0 - 2019.3.0a6)

§m_ImportPhysicalCameras: Option<bool>

bool: (2022.2.19f1 - 2022.3.2f1)

§m_ImportVisibility: Option<bool>

Use visibility properties to enable or disable MeshRenderer components. bool: (2017.1.0b1 - 2022.3.2f1)

§m_ImportedTakeInfos: Option<Vec<TakeInfo>>

Generates the list of all imported take. Vec: (4.0.0 - 2022.3.2f1)

§m_InternalIDToNameTable: Option<Vec<((i32, i64), String)>>

Vec<((i32, i64), String)>: (2019.1.0b1 - 2022.3.2f1)

§m_IsReadable: Option<bool>

Are mesh vertices and indices accessible from script? bool: (4.0.0 - 2022.3.2f1)

§m_LODScreenPercentages: Option<Vec<f32>>

Vec: (3.5.0 - 2022.3.2f1)

§m_LastHumanDescriptionAvatarSource: Option<PPtr>

PPtr<Avatar>: (4.0.0 - 2022.3.2f1)

§m_LegacyGenerateAnimations: Option<i32>

i32: (4.0.0 - 2022.3.2f1)

§m_MaterialImportMode: Option<i32>

Material creation options. i32: (2019.3.0b1 - 2022.3.2f1)

§m_MaterialLocation: Option<i32>

Material import location options. i32: (2017.2.0b2 - 2022.3.2f1)

§m_MaterialName: Option<i32>

Material naming setting. i32: (3.5.0 - 2022.3.2f1)

§m_MaterialSearch: Option<i32>

Existing material search setting. i32: (3.5.0 - 2022.3.2f1)

§m_Materials: Option<Vec<SourceAssetIdentifier>>

Vec: (2017.2.0b2 - 2022.3.2f1)

§m_MeshSettings_generateSecondaryUV: Option<bool>

bool: (3.4.0 - 3.4.2)

§m_MeshSettings_normalImportMode: Option<i32>

i32: (3.4.0 - 3.4.2)

§m_MeshSettings_secondaryUVAngleDistortion: Option<f32>

f32: (3.4.0 - 3.4.2)

§m_MeshSettings_secondaryUVAreaDistortion: Option<f32>

f32: (3.4.0 - 3.4.2)

§m_MeshSettings_secondaryUVHardAngle: Option<f32>

f32: (3.4.0 - 3.4.2)

§m_MeshSettings_secondaryUVPackMargin: Option<f32>

f32: (3.4.0 - 3.4.2)

§m_MeshSettings_swapUVChannels: Option<bool>

bool: (3.4.0 - 3.4.2)

§m_MeshSettings_tangentImportMode: Option<i32>

i32: (3.4.0 - 3.4.2)

§m_MotionNodeName: Option<String>

The path of the transform used to generation the motion of the animation. String: (4.5.0 - 2022.3.2f1)

§m_NewHashIdentity: Option<MdFour>

MdFour: (3.4.0 - 3.4.2)

§m_NodeNameCollisionStrategy: Option<i32>

i32: (2021.2.0b1 - 2022.3.2f1)

§m_OldHashIdentity: Option<MdFour>

MdFour: (3.4.0 - 3.4.2)

§m_OptimizeGameObjects: Option<bool>

Animation optimization setting. bool: (4.3.0 - 2022.3.2f1)

§m_PreserveHierarchy: Option<bool>

If true, always create an explicit Prefab root. Otherwise, if the model has a single root, it is reused as the Prefab root. bool: (2017.3.0b1 - 2022.3.2f1)

§m_PreviousCalculatedGlobalScale: Option<f32>

f32: (2018.2.0b1 - 2019.1.0a13)

§m_ReferencedClips: Option<Vec<GUID>>

Generates the list of all imported Animations. Vec: (4.0.0 - 2022.3.2f1)

§m_RemapMaterialsIfMaterialImportModeIsNone: Option<bool>

bool: (2020.3.37f1 - 2022.3.2f1)

§m_RemoveConstantScaleCurves: Option<bool>

Removes constant animation curves with values identical to the object initial scale value. bool: (2021.2.0b1 - 2022.3.2f1)

§m_ResampleCurves: Option<bool>

If set to false, the importer will not resample curves when possible.Read more about animation curve resampling.Notes:- Some unsupported FBX features (such as PreRotation or PostRotation on transforms) will override this setting. In these situations, animation curves will still be resampled even if the setting is disabled. For best results, avoid using PreRotation, PostRotation and GetRotationPivot.- This option was introduced in Version 5.3. Prior to this version, Unity’s import behaviour was as if this option was always enabled. Therefore enabling the option gives the same behaviour as pre-5.3 animation import. bool: (5.4.0f3 - 2022.3.2f1)

§m_ResampleRotations: Option<bool>

bool: (5.3.0f1 - 5.3.8f2)

§m_RigImportErrors: Option<String>

String: (5.6.0b1 - 2022.3.2f1)

§m_RigImportWarnings: Option<String>

String: (5.6.0b1 - 2022.3.2f1)

§m_SortHierarchyByName: Option<bool>

Sorts the gameObject hierarchy by name. bool: (2019.2.0b1 - 2022.3.2f1)

§m_SplitAnimations: Option<bool>

bool: (3.4.0 - 3.5.7)

§m_StrictVertexDataChecks: Option<bool>

Enables strict checks on imported vertex data. bool: (2022.1.0b1 - 2022.3.2f1)

§m_SupportsEmbeddedMaterials: Option<bool>

bool: (2017.2.0f2 - 2022.3.2f1)

§m_UseFileScale: Option<bool>

Use FileScale when importing. bool: (5.0.0f4 - 2022.3.2f1)

§m_UseSRGBMaterialColor: Option<bool>

When disabled, imported material albedo colors are converted to gamma space. This property should be disabled when using linear color space in Player rendering settings.The default value is true. bool: (2018.3.0f2 - 2022.3.2f1)

§m_UsedFileIDs: Option<Vec<i64>>

Vec: (2019.1.0b1 - 2022.3.2f1)

§m_UserData: Option<String>

Get or set any user data. String: (4.0.0 - 2022.3.2f1)

§maxBonesPerVertex: Option<i32>

The maximum number of bones per vertex stored in this mesh data. i32: (2019.1.0b1 - 2022.3.2f1)

§meshOptimizationFlags: Option<i32>

Options to control the optimization of mesh data during asset import. i32: (2019.1.0b1 - 2022.3.2f1)

§minBoneWeight: Option<f32>

Minimum bone weight to keep. f32: (2019.1.0b1 - 2022.3.2f1)

§normalCalculationMode: Option<i32>

Normal generation options for ModelImporter. i32: (2017.1.0b1 - 2022.3.2f1)

§normalImportMode: Option<i32>

i32: (3.5.0 - 2022.3.2f1)

§normalSmoothingSource: Option<i32>

Source of smoothing information for calculation of normals. i32: (2018.3.0f2 - 2022.3.2f1)

§optimizeBones: Option<bool>

Only import bones where they are connected to vertices. bool: (2021.2.0b1 - 2022.3.2f1)

§optimizeMesh: Option<bool>

bool: (3.5.0 - 3.5.7)

§optimizeMeshForGPU: Option<bool>

bool: (4.0.0 - 2018.4.36f1)

§secondaryUVAngleDistortion: Option<f32>

Threshold for angle distortion (in degrees) when generating secondary UV. f32: (3.5.0 - 2022.3.2f1)

§secondaryUVAreaDistortion: Option<f32>

Threshold for area distortion when generating secondary UV. f32: (3.5.0 - 2022.3.2f1)

§secondaryUVHardAngle: Option<f32>

Hard angle (in degrees) for generating secondary UV. f32: (3.5.0 - 2022.3.2f1)

§secondaryUVMarginMethod: Option<i32>

Method to use for handling margins when generating secondary UV. i32: (2020.1.0b1 - 2022.3.2f1)

§secondaryUVMinLightmapResolution: Option<f32>

The minimum lightmap resolution in texels per unit that the associated model is expected to have. f32: (2020.1.0b1 - 2022.3.2f1)

§secondaryUVMinObjectScale: Option<f32>

The minimum object scale that the associated model is expected to have. f32: (2020.1.0b1 - 2022.3.2f1)

§secondaryUVPackMargin: Option<f32>

Margin to be left between charts when packing secondary UV. f32: (3.5.0 - 2022.3.2f1)

§skinWeightsMode: Option<i32>

i32: (2019.1.0b1 - 2022.3.2f1)

§splitTangentsAcrossUV: Option<bool>

bool: (3.4.0 - 5.2.5f1)

§swapUVChannels: Option<bool>

Swap primary and secondary UV channels when importing. bool: (3.5.0 - 2022.3.2f1)

§tangentImportMode: Option<i32>

i32: (3.5.0 - 2022.3.2f1)

§weldVertices: Option<bool>

Combine vertices that share the same position in space. bool: (4.1.0 - 2022.3.2f1)

Trait Implementations§

Source§

impl Debug for ModelImporter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ModelImporter

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ModelImporter

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,