TriLib  1.9.0
TriLib Unity Package
TriLib.AssetLoaderBase Class Reference

Base asset loader. More...

Inheritance diagram for TriLib.AssetLoaderBase:
TriLib.AssetLoader TriLib.AssetLoaderAsync TriLib.AssetLoaderZip

Public Member Functions

void TriggerOnAvatarCreated (Avatar avatar, Animator animator)
 
void Dispose ()
 

Static Public Member Functions

static bool IsExtensionSupported (string extension)
 Checks whether the given file extension is supported. More...
 
static string GetSupportedFileExtensions ()
 Returns a string of supported file extensions. More...
 

Public Attributes

NodeData RootNodeData
 Main scene TriLib.NodeData. More...
 
MaterialData [] MaterialData
 Processed TriLib.MaterialData list. More...
 
MeshData [] MeshData
 Processed TriLib.MeshData list. More...
 
AnimationData [] AnimationData
 Processed TriLib.AnimationData list. More...
 
CameraData [] CameraData
 Processed TriLib.CameraData list. More...
 
AssimpMetadata [] Metadata
 Processed TriLib.AssimpMetadata list. More...
 
Dictionary< string, string > NodesPath
 Processed nodes path dictionary. More...
 
Dictionary< string, Material > LoadedMaterials
 Loaded UnityEngine.Material for a given name dictionary. More...
 
Dictionary< string, Texture2D > LoadedTextures
 Loaded UnityEngine.Texture2D for a given name dictionary. More...
 
Dictionary< SkinnedMeshRenderer, IList< string > > LoadedBoneNames
 Loaded bone names for a given UnityEngine.SkinnedMeshRenderer dictionary. More...
 
Dictionary< string, MeshDataMeshDataConnections
 UnityEngine.GameObject and MeshData relationship dictionary used to apply blend-shape animations. More...
 
Dictionary< string, EmbeddedTextureData > EmbeddedTextures
 Loaded EmbeddedTextureData for a given name dictionary. More...
 
uint NodeId
 Used to temporarily store nodes id. More...
 
bool HasBoneInfo
 Used to temporarily indicate if there are any bones assigned to loaded meshes. More...
 
bool HasBlendShapes
 Used to temporarily indicate if there are any blend shapes assigned to loaded meshes. More...
 

Static Public Attributes

static ConcurrentList< FileLoadData > FilesLoadData = new ConcurrentList<FileLoadData>()
 Stores a FileLoadData reference list for callbacks. More...
 
static Material StandardBaseMaterial
 Base Diffuse UnityEngine.Material used to load materials. More...
 
static Material StandardSpecularMaterial
 Base Specular UnityEngine.Material used to load materials. More...
 
static Material StandardBaseAlphaMaterial
 Base Diffuse Alpha UnityEngine.Material used to load materials. More...
 
static Material StandardSpecularAlphaMaterial
 Base Specular Alpha UnityEngine.Material used to load materials. More...
 
static Material StandardBaseCutoutMaterial
 Base Diffuse Cutout UnityEngine.Material used to load materials. More...
 
static Material StandardBaseFadeMaterial
 Base Diffuse Fade UnityEngine.Material used to load materials. More...
 
static Material StandardSpecularCutoutMaterial
 Base Specular Cutout UnityEngine.Material used to load materials. More...
 
static Material StandardSpecularFadeMaterial
 Base Specular Fade UnityEngine.Material used to load materials. More...
 
static Material StandardRoughnessMaterial
 Base Roughness UnityEngine.Material used to load materials. More...
 
static Material StandardRoughnessCutoutMaterial
 Base Roughness Cutout UnityEngine.Material used to load materials. More...
 
static Material StandardRoughnessFadeMaterial
 Base Roughness Fade UnityEngine.Material used to load materials. More...
 
static Material StandardRoughnessAlphaMaterial
 Base Roughness Alpha UnityEngine.Material used to load materials. More...
 
static Texture2D NotFoundTexture
 UnityEngine.Texture used to show when no texture is found. More...
 

Protected Member Functions

void TriggerOnMeshCreated (uint meshIndex, Mesh mesh)
 Triggers the on mesh created event. More...
 
void TriggerOnMaterialCreated (uint materialIndex, bool isOverriden, Material material)
 Triggers the on material created event. More...
 
void TriggerOnTextureLoaded (string sourcePath, Material material, string propertyName, Texture2D texture)
 Triggers the on texture loaded event. More...
 
void TriggerOnAnimationClipCreated (uint animationClipIndex, AnimationClip animationClip)
 Triggers the on animation clip created event. More...
 
void TriggerOnObjectLoaded (GameObject loadedGameObject)
 Triggers the on object loaded event. More...
 
void TriggerOnMetadataProcessed (AssimpMetadataType metadataType, uint metadataIndex, string metadataKey, object metadataValue)
 Triggers the on metadata processed event. More...
 
void TriggerOnBlendShapeKeyCreated (Mesh mesh, string name, Vector3[] vertices, Vector3[] normals, Vector4[] tangents, Vector4[] biTangents)
 Triggers the on blend-shape key created event. More...
 
void InternalLoadFromMemory (byte[] fileBytes, string filename, string basePath, AssetLoaderOptions options=null, bool usesWrapperGameObject=false, AssimpInterop.DataCallback dataCallback=null, AssimpInterop.ExistsCallback existsCallback=null, LoadTextureDataCallback loadTextureDataCallback=null, AssimpInterop.ProgressCallback progressCallback=null, FileLoadData customFileLoadData=null)
 Internally loads a file from memory into its data representation. More...
 
void InternalLoadFromMemoryAndZip (byte[] data, string assetExtension, string basePath, AssetLoaderOptions options=null, bool usesWrapperGameObject=false, AssimpInterop.DataCallback dataCallback=null, AssimpInterop.ExistsCallback existsCallback=null, LoadTextureDataCallback loadTextureDataCallback=null, AssimpInterop.ProgressCallback progressCallback=null, string filename=null)
 Internally loads a model from memory with custom embedded texture loading for ZIP files. More...
 
void InternalLoadFromFile (string filename, string basePath, AssetLoaderOptions options=null, bool usesWrapperGameObject=false, AssimpInterop.ProgressCallback progressCallback=null)
 Internally loads a file from file system into it's data representation. More...
 
GameObject BuildGameObject (AssetLoaderOptions options, string basePath=null, GameObject wrapperGameObject=null)
 Builds the UnityEngine.GameObject from pre-loaded data. More...
 
virtual void SetupSkinnedMeshRendererTransforms (GameObject gameObject)
 Setups the UnityEngine.SkinnedMeshRenderer bone transforms. More...
 
virtual void ProcessMetadata (AssimpMetadata metadata)
 Processes the given metadata by triggering the OnMetadataProcessed event. More...
 
virtual void SetupAnimations (GameObject gameObject, AssetLoaderOptions options)
 Setups animation components and UnityEngine.AnimationClip clips into the given UnityEngine.GameObject. More...
 
virtual GameObject TransformNodeData (NodeData nodeData, AssetLoaderOptions options, GameObject existingGameObject=null)
 Transforms given TriLib.NodeData into a UnityEngine.GameObject. More...
 
virtual void CreateMeshComponents (GameObject gameObject, AssetLoaderOptions options, Mesh mesh, bool hasBoneInfo, Material[] combinedMaterials, IList< string > boneNames=null, Material singleMaterial=null, MeshData meshData=null, string connectionKey=null)
 Creates mesh rendering components into given UnityEngine.GameObject. More...
 
virtual void TransformCameraData (GameObject gameObject, CameraData cameraData, AssetLoaderOptions options)
 Transforms the given TriLib.CameraData into a UnityEngine.Camera. More...
 
virtual void TransformAnimationData (AnimationData animationData, AssetLoaderOptions options, GameObject gameObject, bool useWrapperGameObject=false)
 Transforms the given TriLib.AnimationData into a UnityEngine.AnimationClip. More...
 
virtual void TransformMeshData (MeshData meshData, AssetLoaderOptions options)
 Transforms the given TriLib.MeshData into a UnityEngine.Mesh. More...
 
virtual bool IsUsingHDRP ()
 Checks if project is using HDRP render pipeline. More...
 
virtual string RemapMaterialProperty (string property)
 Override this method to rename Material Property names when using different Rendering Pipelines or working with custom Materials. More...
 
virtual void TransformMaterialData (MaterialData materialData, AssetLoaderOptions options, string basePath=null)
 Transforms the given TriLib.MaterialData into a UnityEngine.Material. More...
 
virtual Material LoadMaterial (string name, AssetLoaderOptions options, bool hasAlpha, bool hasSpecular)
 Creates a new UnityEngine.Material or loads an existing UnityEngine.Material with the given name. More...
 
virtual Texture2D LoadTextureFromFile (string path, string name, AssetLoaderOptions options, EmbeddedTextureData embeddedTextureData, TextureWrapMode textureWrapMode, ref bool hasAlphaChannel, bool isNormalMap, bool checkAlphaChannel=false)
 Creates a new UnityEngine.Texture2D or loads an existing UnityEngine.Texture2D with the given path. More...
 
virtual void BuildMaterials (string basePath, AssetLoaderOptions options, LoadTextureDataCallback loadTextureDataCallback=null)
 Builds the TriLib.MaterialData list for given scene. More...
 
EmbeddedTextureData LoadTextureData (string path, string basePath)
 Tries to load texture data from the given path, searching from basePath. More...
 
EmbeddedTextureData LoadEmbeddedTextureData (IntPtr texture, string textureName)
 Loads an embedded texture data. More...
 
virtual string FixNodeName (string name, uint nodeId)
 Generates a unique node name, if the given name is empty. More...
 
virtual string FixName (string name, uint id)
 Generates a unique name, if the given name is empty. More...
 
virtual string FixName (string name)
 Generates a unique name using GUIDs, if the given name is empty. More...
 
void ReleaseImport ()
 Releases allocated resources. More...
 

Protected Attributes

const string AssimpFilenameMagicString = "$$$___magic___$$$"
 Assimp uses this prefix when loading files from memory. More...
 
IntPtr Scene
 Pointer to Assimp loaded scene. More...
 

Properties

bool HasOnMeshCreated [get]
 Gets a value indicating whether this instance has on mesh created event. More...
 
bool HasOnMaterialCreated [get]
 Gets a value indicating whether this instance has on material created event. More...
 
bool HasOnTextureLoaded [get]
 Gets a value indicating whether this instance has on texture loaded event. More...
 
bool HasOnAvatarCreated [get]
 
bool HasOnAnimationClipCreated [get]
 Gets a value indicating whether this instance has on animation clip created event. More...
 
bool HasOnObjectLoaded [get]
 Gets a value indicating whether this instance has on object loaded event. More...
 
bool HasOnMetadataProcessed [get]
 Gets a value indicating whether this instance has on metadata processed event. More...
 
bool HasOnBlendShapeKeyCreated [get]
 Gets a value indicating whether this instance has on blend-shape key created event. More...
 

Events

EmbeddedTextureLoadCallback EmbeddedTextureLoad
 Use this field to assign the callback that will be triggered when a texture looks up for embedded data. More...
 
MeshCreatedHandle OnMeshCreated
 Use this field to assign the event that occurs when a mesh is loaded. More...
 
MaterialCreatedHandle OnMaterialCreated
 Use this field to assign the event that occurs when a material is created. More...
 
TextureLoadHandle OnTextureLoaded
 Use this field to assign the event that occurs when a texture is loaded. More...
 
AvatarCreatedHandle OnAvatarCreated
 
AnimationClipCreatedHandle OnAnimationClipCreated
 Use this field to assign the event that occurs when an animation is created. More...
 
ObjectLoadedHandle OnObjectLoaded
 Use this field to assign the event that occurs when the asset is loaded. More...
 
MetadataProcessedHandle OnMetadataProcessed
 Use this field to assign the event that will occurs when each file metadata is processed. More...
 
BlendShapeKeyCreatedHandle OnBlendShapeKeyCreated
 Use this field to assign the event that occurs when a blend-shape key is created. More...
 

Detailed Description

Base asset loader.

Member Function Documentation

◆ BuildGameObject()

GameObject TriLib.AssetLoaderBase.BuildGameObject ( AssetLoaderOptions  options,
string  basePath = null,
GameObject  wrapperGameObject = null 
)
protected

Builds the UnityEngine.GameObject from pre-loaded data.

Parameters
optionsTriLib.AssetLoaderOptions used to build the UnityEngine.GameObject.
basePathBase path from the loaded file.
wrapperGameObjectWrapper UnityEngine.GameObject to build the object into.
Returns
When options is null or options.UseOriginalPositionRotationAndScale is false, returns the built UnityEngine.GameObject. When options.UseOriginalPositionRotationAndScale is true returns the wrapper UnityEngine.GameObject created for the object.

◆ BuildMaterials()

virtual void TriLib.AssetLoaderBase.BuildMaterials ( string  basePath,
AssetLoaderOptions  options,
LoadTextureDataCallback  loadTextureDataCallback = null 
)
protectedvirtual

Builds the TriLib.MaterialData list for given scene.

Parameters
basePathBase model path.
optionsOptions used to load the material.
loadTextureDataCallbackPass this callback to load texture data from custom sources.

◆ CreateMeshComponents()

virtual void TriLib.AssetLoaderBase.CreateMeshComponents ( GameObject  gameObject,
AssetLoaderOptions  options,
Mesh  mesh,
bool  hasBoneInfo,
Material []  combinedMaterials,
IList< string >  boneNames = null,
Material  singleMaterial = null,
MeshData  meshData = null,
string  connectionKey = null 
)
protectedvirtual

Creates mesh rendering components into given UnityEngine.GameObject.

Parameters
gameObjectUnityEngine.GameObject to create the components at.
optionsTriLib.AssetLoaderOptions used to create the components.
meshUnityEngine.Mesh to add to the created component.
hasBoneInfoIf true, creates a UnityEngine.SkinnedMeshRenderer, otherwise, creates a UnityEngine.MeshRenderer.
combinedMaterialsUnityEngine.Material list to assign to the created component.
boneNamesBone names loaded for the given component.
singleMaterialSingle UnityEngine.Material to assign to the component.
meshDataMeshData used to store a reference to the created UnityEngine.SkinnedMeshRenderer.
connectionKeyKey used to build a MeshData connection.

◆ Dispose()

void TriLib.AssetLoaderBase.Dispose ( )

◆ FixName() [1/2]

virtual string TriLib.AssetLoaderBase.FixName ( string  name,
uint  id 
)
protectedvirtual

Generates a unique name, if the given name is empty.

Parameters
nameName to check.
idId to generate the unique name.
Returns
Generated name if given name is empty. Otherwise, returns the given name.

◆ FixName() [2/2]

virtual string TriLib.AssetLoaderBase.FixName ( string  name)
protectedvirtual

Generates a unique name using GUIDs, if the given name is empty.

Parameters
nameName to check.
Returns
Generated name if given name is empty. Otherwise, returns the given name.

◆ FixNodeName()

virtual string TriLib.AssetLoaderBase.FixNodeName ( string  name,
uint  nodeId 
)
protectedvirtual

Generates a unique node name, if the given name is empty.

Parameters
nameNode name to check.
nodeIdNode id to use when the node name is empty or when it already exists.
Returns
Generated name if given name is empty. Otherwise, returns the given name.

◆ GetSupportedFileExtensions()

static string TriLib.AssetLoaderBase.GetSupportedFileExtensions ( )
static

Returns a string of supported file extensions.

Returns
Supported file extensions.

◆ InternalLoadFromFile()

void TriLib.AssetLoaderBase.InternalLoadFromFile ( string  filename,
string  basePath,
AssetLoaderOptions  options = null,
bool  usesWrapperGameObject = false,
AssimpInterop.ProgressCallback  progressCallback = null 
)
protected

Internally loads a file from file system into it's data representation.

Parameters
filenameFilename to load.
basePathBase path from the loaded file.
optionsTriLib.AssetLoaderOptions used to load the file.
usesWrapperGameObjectPass true when using a wrapper UnityEngine.GameObject.
progressCallbackCallback used to retrieve file loading percentage.

◆ InternalLoadFromMemory()

void TriLib.AssetLoaderBase.InternalLoadFromMemory ( byte []  fileBytes,
string  filename,
string  basePath,
AssetLoaderOptions  options = null,
bool  usesWrapperGameObject = false,
AssimpInterop.DataCallback  dataCallback = null,
AssimpInterop.ExistsCallback  existsCallback = null,
LoadTextureDataCallback  loadTextureDataCallback = null,
AssimpInterop.ProgressCallback  progressCallback = null,
FileLoadData  customFileLoadData = null 
)
protected

Internally loads a file from memory into its data representation.

Parameters
fileBytesFile data to load.
filenameFilename, in case it doesn't exist, the file extension should be used (eg: ".FBX").
basePathBase path from the loaded file.
optionsTriLib.AssetLoaderOptions used to load the file.
usesWrapperGameObjectPass true when using a wrapper UnityEngine.GameObject.
dataCallbackCustom resource data retrieval callback. Pass this parameter when you need to load external data while loading from memory.
existsCallbackCustom resource size retrieval callback. Pass this parameter when you need to load external data while loading from memory.
loadTextureDataCallbackPass this callback to load texture data from custom sources.
progressCallbackCallback used to retrieve file loading percentage.
customFileLoadDataCustom FileLoadData used to store additional asset source information.

◆ InternalLoadFromMemoryAndZip()

void TriLib.AssetLoaderBase.InternalLoadFromMemoryAndZip ( byte []  data,
string  assetExtension,
string  basePath,
AssetLoaderOptions  options = null,
bool  usesWrapperGameObject = false,
AssimpInterop.DataCallback  dataCallback = null,
AssimpInterop.ExistsCallback  existsCallback = null,
LoadTextureDataCallback  loadTextureDataCallback = null,
AssimpInterop.ProgressCallback  progressCallback = null,
string  filename = null 
)
protected

Internally loads a model from memory with custom embedded texture loading for ZIP files.

Parameters
dataLoaded file data.
assetExtensionLoaded file extension.
basePathBase path from the loaded file.
optionsTriLib.AssetLoaderOptions used to load the file.
usesWrapperGameObjectPass true when using a wrapper UnityEngine.GameObject.
dataCallbackCustom resource data retrieval callback. Pass this parameter when you need to load external data while loading from memory.
existsCallbackCustom resource size retrieval callback. Pass this parameter when you need to load external data while loading from memory.
loadTextureDataCallbackPass this callback to load texture data from custom sources.
progressCallbackCallback used to retrieve file loading percentage.
filenameSource filename.
Returns

◆ IsExtensionSupported()

static bool TriLib.AssetLoaderBase.IsExtensionSupported ( string  extension)
static

Checks whether the given file extension is supported.

Returns
true, if the extension is supported. Otherwise, false.

◆ IsUsingHDRP()

virtual bool TriLib.AssetLoaderBase.IsUsingHDRP ( )
protectedvirtual

Checks if project is using HDRP render pipeline.

Returns
true when project is using HDRP render pipeline.

◆ LoadEmbeddedTextureData()

EmbeddedTextureData TriLib.AssetLoaderBase.LoadEmbeddedTextureData ( IntPtr  texture,
string  textureName 
)
protected

Loads an embedded texture data.

Parameters
textureAssimp texture pointer.
textureNameUsed in case of embedded textures with no name.
Returns
A new TriLib.EmbeddedTextureData.

◆ LoadMaterial()

virtual Material TriLib.AssetLoaderBase.LoadMaterial ( string  name,
AssetLoaderOptions  options,
bool  hasAlpha,
bool  hasSpecular 
)
protectedvirtual

Creates a new UnityEngine.Material or loads an existing UnityEngine.Material with the given name.

Parameters
nameMaterial name.
optionsTriLib.AssetLoaderOptions used to load the material.
hasAlphaIf true, creates/loads an alpha material.
hasSpecularIf true, creates/loads a specular material.
Returns
The created/loaded UnityEngine.Material.

◆ LoadTextureData()

EmbeddedTextureData TriLib.AssetLoaderBase.LoadTextureData ( string  path,
string  basePath 
)
protected

Tries to load texture data from the given path, searching from basePath.

Parameters
pathTexture relative path.
basePathModel absolute path.
Returns
A new TriLib.EmbeddedTextureData.

◆ LoadTextureFromFile()

virtual Texture2D TriLib.AssetLoaderBase.LoadTextureFromFile ( string  path,
string  name,
AssetLoaderOptions  options,
EmbeddedTextureData  embeddedTextureData,
TextureWrapMode  textureWrapMode,
ref bool  hasAlphaChannel,
bool  isNormalMap,
bool  checkAlphaChannel = false 
)
protectedvirtual

Creates a new UnityEngine.Texture2D or loads an existing UnityEngine.Texture2D with the given path.

Parameters
pathPath to load the texture from.
nameTexture name.
optionsTriLib.AssetLoaderOptions used to load the texture.
embeddedTextureDataTriLib.EmbeddedTextureData to load the texture from.
textureWrapModeUnityEngine.TextureWrapMode to assign to the texture.
hasAlphaChannelChanged to true when the texture has alpha pixels.
isNormalMapIf true, applies special processing to the texture and treat it as a normal map.
checkAlphaChannelIf true, checks for any alpha pixel on loaded texture and assigns the value back to this variable.
Returns
The created/loaded UnityEngine.Texture2D

◆ ProcessMetadata()

virtual void TriLib.AssetLoaderBase.ProcessMetadata ( AssimpMetadata  metadata)
protectedvirtual

Processes the given metadata by triggering the OnMetadataProcessed event.

Parameters
metadataTriLib.AssimpMetadata to process.

◆ ReleaseImport()

void TriLib.AssetLoaderBase.ReleaseImport ( )
protected

Releases allocated resources.

◆ RemapMaterialProperty()

virtual string TriLib.AssetLoaderBase.RemapMaterialProperty ( string  property)
protectedvirtual

Override this method to rename Material Property names when using different Rendering Pipelines or working with custom Materials.

Parameters
propertyMaterial Property name.
Returns
Renamed Material Property name, when applicable. Otherwise, returns the original Property name.

◆ SetupAnimations()

virtual void TriLib.AssetLoaderBase.SetupAnimations ( GameObject  gameObject,
AssetLoaderOptions  options 
)
protectedvirtual

Setups animation components and UnityEngine.AnimationClip clips into the given UnityEngine.GameObject.

Parameters
gameObjectUnityEngine.GameObject to add the component to.
optionsTriLib.AssetLoaderOptions used to process the components.

◆ SetupSkinnedMeshRendererTransforms()

virtual void TriLib.AssetLoaderBase.SetupSkinnedMeshRendererTransforms ( GameObject  gameObject)
protectedvirtual

Setups the UnityEngine.SkinnedMeshRenderer bone transforms.

Parameters
gameObjectUnityEngine.GameObject where the bones will be searched.

◆ TransformAnimationData()

virtual void TriLib.AssetLoaderBase.TransformAnimationData ( AnimationData  animationData,
AssetLoaderOptions  options,
GameObject  gameObject,
bool  useWrapperGameObject = false 
)
protectedvirtual

Transforms the given TriLib.AnimationData into a UnityEngine.AnimationClip.

Parameters
animationDataTriLib.AnimationData to be transformed.
optionsTriLib.AssetLoaderOptions used to transform the animation.
gameObjectTransformed UnityEngine.GameObject.
useWrapperGameObjectSet to true when using a wrapper UnityEngine.GameObject.

◆ TransformCameraData()

virtual void TriLib.AssetLoaderBase.TransformCameraData ( GameObject  gameObject,
CameraData  cameraData,
AssetLoaderOptions  options 
)
protectedvirtual

Transforms the given TriLib.CameraData into a UnityEngine.Camera.

Parameters
gameObjectUnityEngine.GameObject to add the UnityEngine.Camera component into.
cameraDataTriLib.CameraData to be transformed.
optionsTriLib.AssetLoaderOptions used to transform the camera.

◆ TransformMaterialData()

virtual void TriLib.AssetLoaderBase.TransformMaterialData ( MaterialData  materialData,
AssetLoaderOptions  options,
string  basePath = null 
)
protectedvirtual

Transforms the given TriLib.MaterialData into a UnityEngine.Material.

Parameters
materialDataTriLib.MaterialData to be transformed.
optionsTriLib.AssetLoaderOptions used to transform the material.
basePathLoaded asset base path.

◆ TransformMeshData()

virtual void TriLib.AssetLoaderBase.TransformMeshData ( MeshData  meshData,
AssetLoaderOptions  options 
)
protectedvirtual

Transforms the given TriLib.MeshData into a UnityEngine.Mesh.

Parameters
meshDataTriLib.MeshData to be transformed.
optionsTriLib.AssetLoaderOptions used to transform the mesh.

◆ TransformNodeData()

virtual GameObject TriLib.AssetLoaderBase.TransformNodeData ( NodeData  nodeData,
AssetLoaderOptions  options,
GameObject  existingGameObject = null 
)
protectedvirtual

Transforms given TriLib.NodeData into a UnityEngine.GameObject.

Parameters
nodeDataTriLib.NodeData to be transformed.
optionsTriLib.AssetLoaderOptions used to transform the data.
existingGameObjectused to add the components to instead of adding to a new object.
Returns
The transformed UnityEngine.GameObject.

summary> Counts the UnityEngine.Transform total children recursively. /summary> param name="transform">The UnityEngine.Transform to count the children.

◆ TriggerOnAnimationClipCreated()

void TriLib.AssetLoaderBase.TriggerOnAnimationClipCreated ( uint  animationClipIndex,
AnimationClip  animationClip 
)
protected

Triggers the on animation clip created event.

Parameters
animationClipIndexAnimation clip index.
animationClipAnimation clip.

◆ TriggerOnAvatarCreated()

void TriLib.AssetLoaderBase.TriggerOnAvatarCreated ( Avatar  avatar,
Animator  animator 
)

◆ TriggerOnBlendShapeKeyCreated()

void TriLib.AssetLoaderBase.TriggerOnBlendShapeKeyCreated ( Mesh  mesh,
string  name,
Vector3 []  vertices,
Vector3 []  normals,
Vector4 []  tangents,
Vector4 []  biTangents 
)
protected

Triggers the on blend-shape key created event.

Parameters
meshUnityEngine.Mesh where the blend-shape key has been created.
nameBlend-shape name
verticesBlend-shape key vertices.
normalsBlend-shape key normals.
tangentsBlend-shape key tangents.
biTangentsBlend-shape key bi-tangents.

◆ TriggerOnMaterialCreated()

void TriLib.AssetLoaderBase.TriggerOnMaterialCreated ( uint  materialIndex,
bool  isOverriden,
Material  material 
)
protected

Triggers the on material created event.

Parameters
materialIndexMaterial index.
isOverridenIf set to true is overriden.
materialMaterial.

◆ TriggerOnMeshCreated()

void TriLib.AssetLoaderBase.TriggerOnMeshCreated ( uint  meshIndex,
Mesh  mesh 
)
protected

Triggers the on mesh created event.

Parameters
meshIndexMesh index.
meshMesh.

◆ TriggerOnMetadataProcessed()

void TriLib.AssetLoaderBase.TriggerOnMetadataProcessed ( AssimpMetadataType  metadataType,
uint  metadataIndex,
string  metadataKey,
object  metadataValue 
)
protected

Triggers the on metadata processed event.

Parameters
metadataTypeMetadata type.
metadataIndexMetadata index.
metadataKeyMetadata key.
metadataValueMetadata value.

◆ TriggerOnObjectLoaded()

void TriLib.AssetLoaderBase.TriggerOnObjectLoaded ( GameObject  loadedGameObject)
protected

Triggers the on object loaded event.

Parameters
loadedGameObjectCreated UnityEngine.GameObject.

◆ TriggerOnTextureLoaded()

void TriLib.AssetLoaderBase.TriggerOnTextureLoaded ( string  sourcePath,
Material  material,
string  propertyName,
Texture2D  texture 
)
protected

Triggers the on texture loaded event.

Parameters
sourcePathSource path.
materialMaterial.
propertyNameProperty name.
textureTexture.

Member Data Documentation

◆ AnimationData

AnimationData [] TriLib.AssetLoaderBase.AnimationData

Processed TriLib.AnimationData list.

◆ AssimpFilenameMagicString

const string TriLib.AssetLoaderBase.AssimpFilenameMagicString = "$$$___magic___$$$"
protected

Assimp uses this prefix when loading files from memory.

◆ CameraData

CameraData [] TriLib.AssetLoaderBase.CameraData

Processed TriLib.CameraData list.

◆ EmbeddedTextures

Dictionary<string, EmbeddedTextureData> TriLib.AssetLoaderBase.EmbeddedTextures

Loaded EmbeddedTextureData for a given name dictionary.

◆ FilesLoadData

ConcurrentList<FileLoadData> TriLib.AssetLoaderBase.FilesLoadData = new ConcurrentList<FileLoadData>()
static

Stores a FileLoadData reference list for callbacks.

◆ HasBlendShapes

bool TriLib.AssetLoaderBase.HasBlendShapes

Used to temporarily indicate if there are any blend shapes assigned to loaded meshes.

◆ HasBoneInfo

bool TriLib.AssetLoaderBase.HasBoneInfo

Used to temporarily indicate if there are any bones assigned to loaded meshes.

◆ LoadedBoneNames

Dictionary<SkinnedMeshRenderer, IList<string> > TriLib.AssetLoaderBase.LoadedBoneNames

Loaded bone names for a given UnityEngine.SkinnedMeshRenderer dictionary.

◆ LoadedMaterials

Dictionary<string, Material> TriLib.AssetLoaderBase.LoadedMaterials

Loaded UnityEngine.Material for a given name dictionary.

◆ LoadedTextures

Dictionary<string, Texture2D> TriLib.AssetLoaderBase.LoadedTextures

Loaded UnityEngine.Texture2D for a given name dictionary.

◆ MaterialData

MaterialData [] TriLib.AssetLoaderBase.MaterialData

Processed TriLib.MaterialData list.

◆ MeshData

MeshData [] TriLib.AssetLoaderBase.MeshData

Processed TriLib.MeshData list.

◆ MeshDataConnections

Dictionary<string, MeshData> TriLib.AssetLoaderBase.MeshDataConnections

UnityEngine.GameObject and MeshData relationship dictionary used to apply blend-shape animations.

◆ Metadata

AssimpMetadata [] TriLib.AssetLoaderBase.Metadata

Processed TriLib.AssimpMetadata list.

◆ NodeId

uint TriLib.AssetLoaderBase.NodeId

Used to temporarily store nodes id.

◆ NodesPath

Dictionary<string, string> TriLib.AssetLoaderBase.NodesPath

Processed nodes path dictionary.

◆ NotFoundTexture

Texture2D TriLib.AssetLoaderBase.NotFoundTexture
static

UnityEngine.Texture used to show when no texture is found.

◆ RootNodeData

NodeData TriLib.AssetLoaderBase.RootNodeData

Main scene TriLib.NodeData.

◆ Scene

IntPtr TriLib.AssetLoaderBase.Scene
protected

Pointer to Assimp loaded scene.

◆ StandardBaseAlphaMaterial

Material TriLib.AssetLoaderBase.StandardBaseAlphaMaterial
static

Base Diffuse Alpha UnityEngine.Material used to load materials.

◆ StandardBaseCutoutMaterial

Material TriLib.AssetLoaderBase.StandardBaseCutoutMaterial
static

Base Diffuse Cutout UnityEngine.Material used to load materials.

◆ StandardBaseFadeMaterial

Material TriLib.AssetLoaderBase.StandardBaseFadeMaterial
static

Base Diffuse Fade UnityEngine.Material used to load materials.

◆ StandardBaseMaterial

Material TriLib.AssetLoaderBase.StandardBaseMaterial
static

Base Diffuse UnityEngine.Material used to load materials.

◆ StandardRoughnessAlphaMaterial

Material TriLib.AssetLoaderBase.StandardRoughnessAlphaMaterial
static

Base Roughness Alpha UnityEngine.Material used to load materials.

◆ StandardRoughnessCutoutMaterial

Material TriLib.AssetLoaderBase.StandardRoughnessCutoutMaterial
static

Base Roughness Cutout UnityEngine.Material used to load materials.

◆ StandardRoughnessFadeMaterial

Material TriLib.AssetLoaderBase.StandardRoughnessFadeMaterial
static

Base Roughness Fade UnityEngine.Material used to load materials.

◆ StandardRoughnessMaterial

Material TriLib.AssetLoaderBase.StandardRoughnessMaterial
static

Base Roughness UnityEngine.Material used to load materials.

◆ StandardSpecularAlphaMaterial

Material TriLib.AssetLoaderBase.StandardSpecularAlphaMaterial
static

Base Specular Alpha UnityEngine.Material used to load materials.

◆ StandardSpecularCutoutMaterial

Material TriLib.AssetLoaderBase.StandardSpecularCutoutMaterial
static

Base Specular Cutout UnityEngine.Material used to load materials.

◆ StandardSpecularFadeMaterial

Material TriLib.AssetLoaderBase.StandardSpecularFadeMaterial
static

Base Specular Fade UnityEngine.Material used to load materials.

◆ StandardSpecularMaterial

Material TriLib.AssetLoaderBase.StandardSpecularMaterial
static

Base Specular UnityEngine.Material used to load materials.

Property Documentation

◆ HasOnAnimationClipCreated

bool TriLib.AssetLoaderBase.HasOnAnimationClipCreated
getprotected

Gets a value indicating whether this instance has on animation clip created event.

true if this instance has on animation clip created event; otherwise, false.

◆ HasOnAvatarCreated

bool TriLib.AssetLoaderBase.HasOnAvatarCreated
get

◆ HasOnBlendShapeKeyCreated

bool TriLib.AssetLoaderBase.HasOnBlendShapeKeyCreated
getprotected

Gets a value indicating whether this instance has on blend-shape key created event.

true if this instance has on blend-shape loaded event; otherwise, false.

◆ HasOnMaterialCreated

bool TriLib.AssetLoaderBase.HasOnMaterialCreated
getprotected

Gets a value indicating whether this instance has on material created event.

true if this instance has on material created event; otherwise, false.

◆ HasOnMeshCreated

bool TriLib.AssetLoaderBase.HasOnMeshCreated
getprotected

Gets a value indicating whether this instance has on mesh created event.

true if this instance has on mesh created event; otherwise, false.

◆ HasOnMetadataProcessed

bool TriLib.AssetLoaderBase.HasOnMetadataProcessed
getprotected

Gets a value indicating whether this instance has on metadata processed event.

true if this instance has on metadata processed event; otherwise, false.

◆ HasOnObjectLoaded

bool TriLib.AssetLoaderBase.HasOnObjectLoaded
getprotected

Gets a value indicating whether this instance has on object loaded event.

true if this instance has on object loaded event; otherwise, false.

◆ HasOnTextureLoaded

bool TriLib.AssetLoaderBase.HasOnTextureLoaded
getprotected

Gets a value indicating whether this instance has on texture loaded event.

true if this instance has on texture loaded event; otherwise, false.

Event Documentation

◆ EmbeddedTextureLoad

EmbeddedTextureLoadCallback TriLib.AssetLoaderBase.EmbeddedTextureLoad

Use this field to assign the callback that will be triggered when a texture looks up for embedded data.

◆ OnAnimationClipCreated

AnimationClipCreatedHandle TriLib.AssetLoaderBase.OnAnimationClipCreated

Use this field to assign the event that occurs when an animation is created.

◆ OnAvatarCreated

AvatarCreatedHandle TriLib.AssetLoaderBase.OnAvatarCreated

◆ OnBlendShapeKeyCreated

BlendShapeKeyCreatedHandle TriLib.AssetLoaderBase.OnBlendShapeKeyCreated

Use this field to assign the event that occurs when a blend-shape key is created.

◆ OnMaterialCreated

MaterialCreatedHandle TriLib.AssetLoaderBase.OnMaterialCreated

Use this field to assign the event that occurs when a material is created.

◆ OnMeshCreated

MeshCreatedHandle TriLib.AssetLoaderBase.OnMeshCreated

Use this field to assign the event that occurs when a mesh is loaded.

◆ OnMetadataProcessed

MetadataProcessedHandle TriLib.AssetLoaderBase.OnMetadataProcessed

Use this field to assign the event that will occurs when each file metadata is processed.

◆ OnObjectLoaded

ObjectLoadedHandle TriLib.AssetLoaderBase.OnObjectLoaded

Use this field to assign the event that occurs when the asset is loaded.

◆ OnTextureLoaded

TextureLoadHandle TriLib.AssetLoaderBase.OnTextureLoaded

Use this field to assign the event that occurs when a texture is loaded.


The documentation for this class was generated from the following file: