AssetImporter
Engine/source/T3D/assets/assetImporter.h
AssetImporter is a SimObject derived object that processed and imports files and turns them into assets if they are of valid types.
Private Types
Parent
Private Attributes
The import configuration that is currently being utilized
A log of all the actions that have been performed by the importer
bool
Has the heirarchy of asset import items changed due to processing
only used for passing up the result of an import action for a script-side handled type
Vector< AssetImportObject * >
A list of AssetImportObjects that are to be imported
bool
Are there any issues with any of the current import asset items
char
importLogBuffer [1024]
A string used for writing into the importLog
bool
Is this import action a reimport of an existing asset
A list of file paths that are to be imported.
The Id of the module the assets are to be imported into
The path any imported assets are placed in as their destination
Public Functions
addImportingAsset(String assetType, Torque::Path filePath, AssetImportObject * parentItem, String assetNameOverride)
Adds an importing asset to the current session
addImportingAssetItem(AssetImportObject * assetItem, AssetImportObject * parentItem)
Adds an existing AssetImportObject to our import session.
addImportingFile(Torque::Path filePath)
Processes a file into an AssetImportObject and adds it to the session for importing
autoImportFile(Torque::Path filePath)
Runs the import process on a single file in-place.
bool
checkAssetForCollision(AssetImportObject * assetItemToCheckFor, AssetImportObject * assetItem)
Checks asset items for any collisions in the current import session
Declare Console Object.
deleteImportingAsset(AssetImportObject * assetItem)
Deletes the asset item from the import session.
Dumps the entire current activity log to the console.
findImportingAssetByName(String assetName, AssetImportObject * assetItem)
Finds an asset item in the session if it exists, by name
getActivityLogLine(U32 line)
Gets the log line at a given index
Get the number of lines in the activity log
getAssetItem(U32 index)
Get the top-level asset item in the current import session at the requested index
getAssetItemChild(AssetImportObject * assetItem, U32 index)
Get the child asset item of a specific AssetImportObject at the requested index
getAssetItemChildCount(AssetImportObject * assetItem)
Gets the number of child asset items of a given AssetImportObject
Gets the number of top-level asset items in the current import session(doesn't count children)
getAssetTypeByFile(Torque::Path filePath)
Parses a file path to determine its asset type
Gets the currently active import configuration
importAssets(AssetImportObject * assetItem)
Runs the import process in the current session
importImageAsset(AssetImportObject * assetItem)
Runs the import processing on a specific ImageAsset item
importMaterialAsset(AssetImportObject * assetItem)
Runs the import processing on a specific MaterialAsset item
importShapeAnimationAsset(AssetImportObject * assetItem)
Runs the import processing on a specific ShapeAnimationAsset item
importShapeAsset(AssetImportObject * assetItem)
Runs the import processing on a specific ShapeAsset item
importSoundAsset(AssetImportObject * assetItem)
Runs the import processing on a specific SoundAsset item
bool
onAdd()
Called when the object is added to the sim.
parseImageSuffixes(String assetName, String * suffixType)
Parses an asset's name to try and find if any of the import config's suffix lists match to it
processImageAsset(AssetImportObject * assetItem)
Process a specific AssetImportObject that is an ImageAsset type to prepare it for importing
processImportAssets(AssetImportObject * assetItem)
Process AssetImportObject's to prepare them for importing.
processMaterialAsset(AssetImportObject * assetItem)
Process a specific AssetImportObject that is an MaterialAsset type to prepare it for importing
processShapeAsset(AssetImportObject * assetItem)
Process a specific AssetImportObject that is an ShapeAsset type to prepare it for importing
processShapeMaterialInfo(AssetImportObject * assetItem, S32 materialItemId)
Process a specific ShapeAsset AssetImportObject with a material id in order to parse and handle the materials listed in the shape file
processSoundAsset(AssetImportObject * assetItem)
Process a specific AssetImportObject that is an SoundAsset type to prepare it for importing
resetAssetValidationStatus(AssetImportObject * assetItem)
Reset the validation status of asset items
Resets the active import config to whatever the default is.
resetImportSession(bool hardClearSession)
Resets the import session to a clean slate.
resolveAssetItemIssues(AssetImportObject * assetItem)
Attempts to automatically resolve import issues according to the import config settings
setImportConfig(AssetImportConfig * importConfig)
setTargetModuleId(const String & moduleId)
setTargetPath(Torque::Path pTargetPath)
Sets the target path for the assets being imported to be deposited into
validateAsset(AssetImportObject * assetItem)
Validate a specific asset item
bool
Run through and validate assets for issues, such as name collisions
Public Static Functions
findImagePath(const String & testPath)
getModuleFromPath(Torque::Path filePath)
Finds the module associated with a given file path
getTrueFilename(const String & fileName)
Engine.
const char *
makeFullPath(const String & path)
Detailed Description
AssetImporter is a SimObject derived object that processed and imports files and turns them into assets if they are of valid types.
Utilizes an AssetImportConfig to inform the importing process's behavior.
Private Types
typedef SimObject Parent
Private Attributes
AssetImportConfig * activeImportConfig
The import configuration that is currently being utilized
Vector< String > activityLog
A log of all the actions that have been performed by the importer
bool assetHeirarchyChanged
Has the heirarchy of asset import items changed due to processing
String finalImportedAssetPath
only used for passing up the result of an import action for a script-side handled type
Vector< AssetImportObject * > importingAssets
A list of AssetImportObjects that are to be imported
bool importIssues
Are there any issues with any of the current import asset items
char importLogBuffer [1024]
A string used for writing into the importLog
bool isReimport
Is this import action a reimport of an existing asset
Vector< Torque::Path > originalImportingFiles
A list of file paths that are to be imported.
These are only used for resetting purposes;
String targetModuleId
The Id of the module the assets are to be imported into
String targetPath
The path any imported assets are placed in as their destination
Public Functions
AssetImporter()
~AssetImporter()
addImportingAsset(String assetType, Torque::Path filePath, AssetImportObject * parentItem, String assetNameOverride)
Adds an importing asset to the current session
Parameters:
Type | of the asset being imported |
Parameters:
path | of the file to be imported |
Parameters:
that the new item is a child of. null if no parent |
Parameters:
If | not blank, will be the new item's assetName instead of being created off of the filePath |
AssetImportObject that was created
addImportingAssetItem(AssetImportObject * assetItem, AssetImportObject * parentItem)
Adds an existing AssetImportObject to our import session.
Generally this would be created in a script somewhere
Parameters:
The | asset item to be added to the import session |
Parameters:
parentItem | (Optional), The asset item that will be the parent of the assetItem being added |
addImportingFile(Torque::Path filePath)
Processes a file into an AssetImportObject and adds it to the session for importing
Parameters:
The | filePath of the file to be imported in as an asset |
AssetImportObject that was created
autoImportFile(Torque::Path filePath)
Runs the import process on a single file in-place.
Intended primarily for autoimporting a loose file that's in the game directory.
Parameters:
The | filePath of the file to be imported in as an asset |
AssetId of the asset that was imported. If import failed, it will be empty.
checkAssetForCollision(AssetImportObject * assetItemToCheckFor, AssetImportObject * assetItem)
Checks asset items for any collisions in the current import session
Parameters:
The | asset to check for collisions with |
Parameters:
if | null, will loop over and recurse the main import asset items, if a specific AssetImportObject is passed in, it will recurse it's children |
If a collision was detected
DECLARE_CONOBJECT(AssetImporter )
Declare Console Object.
deleteImportingAsset(AssetImportObject * assetItem)
Deletes the asset item from the import session.
Affects the item's children as well
Parameters:
asset | item to be marked as deleted |
dumpActivityLog()
Dumps the entire current activity log to the console.
findImportingAssetByName(String assetName, AssetImportObject * assetItem)
Finds an asset item in the session if it exists, by name
Parameters:
Asset | name to find |
Parameters:
if | null, will loop over and recurse the main import asset items, if a specific AssetImportObject is passed in, it will recurse it's children |
AssetImportObject that was found
getActivityLogLine(U32 line)
Gets the log line at a given index
Parameters:
line | in the log to get |
The log line as a string
getActivityLogLineCount()
Get the number of lines in the activity log
Line count as S32
getAssetItem(U32 index)
Get the top-level asset item in the current import session at the requested index
Parameters:
The | index of the item array to get |
The AssetImportObject at the index
getAssetItemChild(AssetImportObject * assetItem, U32 index)
Get the child asset item of a specific AssetImportObject at the requested index
Parameters:
The | AssetImportObject to get the number of child items for |
Parameters:
The | index of the child item array to get |
The AssetImportObject at the index
getAssetItemChildCount(AssetImportObject * assetItem)
Gets the number of child asset items of a given AssetImportObject
Parameters:
The | AssetImportObject to get the number of child items for |
Number of children
getAssetItemCount()
Gets the number of top-level asset items in the current import session(doesn't count children)
Number of children
getAssetTypeByFile(Torque::Path filePath)
Parses a file path to determine its asset type
Parameters:
path to parse |
The asset type as a string
getImportConfig()
Gets the currently active import configuration
Current AssetImportConfig the importer is using
getTargetModuleId()
importAssets(AssetImportObject * assetItem)
Runs the import process in the current session
Parameters:
if | null, will loop over and recurse the main import asset items, if a specific AssetImportObject is passed in, it will recurse it's children |
importImageAsset(AssetImportObject * assetItem)
Runs the import processing on a specific ImageAsset item
Parameters:
The | asset item to import |
TAML File path of the new asset that was imported. If import failed, it will be empty.
importMaterialAsset(AssetImportObject * assetItem)
Runs the import processing on a specific MaterialAsset item
Parameters:
The | asset item to import |
TAML File path of the new asset that was imported. If import failed, it will be empty.
importShapeAnimationAsset(AssetImportObject * assetItem)
Runs the import processing on a specific ShapeAnimationAsset item
Parameters:
The | asset item to import |
TAML File path of the new asset that was imported. If import failed, it will be empty.
importShapeAsset(AssetImportObject * assetItem)
Runs the import processing on a specific ShapeAsset item
Parameters:
The | asset item to import |
TAML File path of the new asset that was imported. If import failed, it will be empty.
importSoundAsset(AssetImportObject * assetItem)
Runs the import processing on a specific SoundAsset item
Parameters:
The | asset item to import |
TAML File path of the new asset that was imported. If import failed, it will be empty.
onAdd()
Reimplemented from: SimObject
onRemove()
Reimplemented from: SimObject
parseImageSuffixes(String assetName, String * suffixType)
Parses an asset's name to try and find if any of the import config's suffix lists match to it
Parameters:
Asset | name to parse any image suffix out of |
Parameters:
The | suffix type that was matched to the asset name |
suffix that matched to the asset name
processImageAsset(AssetImportObject * assetItem)
Process a specific AssetImportObject that is an ImageAsset type to prepare it for importing
Parameters:
The | AssetImportObject to process |
processImportAssets(AssetImportObject * assetItem)
Process AssetImportObject's to prepare them for importing.
Parameters:
If | null, will loop over the top-level asset items list, if a specific item is provided, will process it's children |
processMaterialAsset(AssetImportObject * assetItem)
Process a specific AssetImportObject that is an MaterialAsset type to prepare it for importing
Parameters:
The | AssetImportObject to process |
processShapeAsset(AssetImportObject * assetItem)
Process a specific AssetImportObject that is an ShapeAsset type to prepare it for importing
Parameters:
The | AssetImportObject to process |
processShapeMaterialInfo(AssetImportObject * assetItem, S32 materialItemId)
Process a specific ShapeAsset AssetImportObject with a material id in order to parse and handle the materials listed in the shape file
Parameters:
The | AssetImportObject to process |
Parameters:
The | materialItemId in the shapeInfo to process |
processSoundAsset(AssetImportObject * assetItem)
Process a specific AssetImportObject that is an SoundAsset type to prepare it for importing
Parameters:
The | AssetImportObject to process |
resetAssetValidationStatus(AssetImportObject * assetItem)
Reset the validation status of asset items
Parameters:
If | null, will loop over the top-level asset items list, if a specific item is provided, will reset it's children |
resetImportConfig()
Resets the active import config to whatever the default is.
Either a clean slate if one isn't defined or loading one if defined via the editor config
resetImportSession(bool hardClearSession)
Resets the import session to a clean slate.
This will clear all existing AssetImportObjects and the activity log and then re-process the original filePaths again.
Parameters:
Defaults | to false. If true, will also clear the original filePaths |
resolveAssetItemIssues(AssetImportObject * assetItem)
Attempts to automatically resolve import issues according to the import config settings
Parameters:
The | AssetImportObject to resolve |
setImportConfig(AssetImportConfig * importConfig)
setTargetModuleId(const String & moduleId)
setTargetPath(Torque::Path pTargetPath)
Sets the target path for the assets being imported to be deposited into
Parameters:
The | filePath of the destination point assets are imported into |
validateAsset(AssetImportObject * assetItem)
Validate a specific asset item
Parameters:
The | AssetImportObject to validate |
validateAssets()
Run through and validate assets for issues, such as name collisions
Public Static Functions
findImagePath(const String & testPath)
getModuleFromPath(Torque::Path filePath)
Finds the module associated with a given file path
Parameters:
path to parse the the module from |
ModuleDefinition that was found
getTrueFilename(const String & fileName)
initPersistFields()
Engine.
makeFullPath(const String & path)