TorqueScript Reference
Public Member Functions | List of all members
AssetManager Class Reference

Inherits SimObject.

Public Member Functions

string acquireAsset (assetId,[asPrivate?])
 
bool addDeclaredAsset (moduleDefinition, assetFilePath)
 
bool addModuleDeclaredAssets (moduleDefinition)
 
string addPrivateAsset (assetObject)
 
bool compileReferencedAssets (moduleDefinition)
 
bool deleteAsset (assetId, deleteLooseFiles, deleteDependencies)
 
void dumpDeclaredAssets ()
 
int findAllAssets (assetQuery,[ignoreInternal?],[ignorePrivate?])
 
int findAssetAutoUnload (assetQuery, assetAutoUnload,[assetQueryAsSource?])
 
int findAssetCategory (assetQuery, assetCategory,[assetQueryAsSource?])
 
int findAssetDependsOn (assetQuery, assetId)
 
int findAssetInternal (assetQuery, assetInternal,[assetQueryAsSource?])
 
int findAssetIsDependedOn (assetQuery, assetId)
 
int findAssetLooseFile (assetQuery, assetLooseFile,[assetQueryAsSource?])
 
int findAssetName (assetQuery, assetName,[partialName?])
 
int findAssetPrivate (assetQuery, assetPrivate,[assetQueryAsSource?])
 
int findAssetType (assetQuery, assetType,[assetQueryAsSource?])
 
int findInvalidAssetReferences (assetQuery)
 
int findTaggedAssets (assetQuery, assetTagNames,[assetQueryAsSource?])
 
string getAssetCategory (assetId)
 
string getAssetDescription (assetId)
 
string getAssetFilePath (assetId)
 
string getAssetModule (assetId)
 
string getAssetName (assetId)
 
string getAssetPath (assetId)
 
int getAssetTags ()
 
string getAssetType (assetId)
 
bool getDeclaredAssetCount ()
 
bool getLoadedExternalAssetCount ()
 
bool getLoadedInternalAssetCount ()
 
bool getMaxLoadedExternalAssetCount ()
 
bool getMaxLoadedInternalAssetCount ()
 
bool getReferencedAssetCount ()
 
bool isAssetAutoUnload (assetId)
 
bool isAssetInternal (assetId)
 
bool isAssetLoaded (assetId)
 
bool isAssetPrivate (assetId)
 
bool isDeclaredAsset (assetId)
 
bool isReferencedAsset (assetId)
 
void purgeAssets ()
 
void refreshAllAssets ([bool includeUnloaded])
 
void refreshAsset (assetId)
 
bool releaseAsset (assetId)
 
bool removeDeclaredAsset (assetId)
 
bool removeDeclaredAssets (moduleDefinition)
 
bool renameDeclaredAsset (assetIdFrom, assetIdTo)
 
bool renameReferencedAsset (assetIdFrom, assetIdTo)
 
bool restoreAssetTags ()
 
bool saveAssetTags ()
 
- Public Member Functions inherited from SimObject
string call (functionName,[args]*)
 
int clone ([bool copyDynamicFields?=false]?)
 
void delete ()
 
void dump ()
 
void dumpClassHierarchy ()
 
const char * getClassName ()
 
string getClassNamespace ()
 
string getDynamicField (index)
 
int getDynamicFieldCount ()
 
string getField (int index)
 
int getFieldCount ()
 
const char * getFieldType (fieldName)
 
const char * getFieldValue (fieldName)
 
int getGroup ()
 
int getId ()
 
string getInternalName ()
 
const char * getName ()
 
string getProgenitorFile ()
 
string getSuperClassNamespace ()
 
int getType ()
 
bool isChildOfGroup ()
 
bool isMemberOfClass (string classname)
 
bool isMethod (const char *methodName)
 
bool isMethod (string method name)
 
bool isTimerActive ()
 
bool save (fileName,[selectedOnly]?)
 
int schedule (time, command,[arg]*)
 
void setClassNamespace ()
 
bool setFieldValue (fieldName, value)
 
void setInternalName (string InternalName)
 
void setName (newName)
 
void setProgenitorFile (file)
 
void setSuperClassNamespace ()
 
bool startTimer (callbackFunction, float timePeriod,[repeat]?)
 
void stopTimer ()
 

Additional Inherited Members

- Static Public Member Functions inherited from SimObject
static S32 QSORT_CALLBACK compareFields (const void *a, const void *b)
 

Member Function Documentation

string acquireAsset ( assetId  )

Acquire the specified asset Id. You must release the asset once you're finish with it using 'releaseAsset'.

Parameters
assetIdThe selected asset Id.
asPrivateWhether to acquire the asset Id as a private asset.
Returns
The acquired asset or NULL if not acquired.
bool addDeclaredAsset ( moduleDefinition  ,
assetFilePath   
)

Add the specified asset against the specified module definition.

Parameters
moduleDefinitionThe module definition that may contain declared assets.
Returns
Whether adding declared assets was successful or not.
bool addModuleDeclaredAssets ( moduleDefinition  )

Add any the declared assets specified by the module definition.

Parameters
moduleDefinitionThe module definition specifies the asset manifest.
Returns
Whether adding declared assets was successful or not.
string addPrivateAsset ( assetObject  )

Adds a private asset object.

Parameters
assetObjectThe asset object to add as a private asset.
Returns
The allocated private asset Id.
bool compileReferencedAssets ( moduleDefinition  )

Compile the referenced assets determined by the specified module definition.

Parameters
moduleDefinitionThe module definition specifies the asset manifest.
Returns
Whether the compilation was successful or not.
bool deleteAsset ( assetId  ,
deleteLooseFiles  ,
deleteDependencies   
)

Deletes the specified asset Id and optionally its loose files and asset dependencies.

Parameters
assetIdThe selected asset Id.
deleteLooseFilesWhether to delete an assets loose files or not.
deleteDependenciesWhether to delete assets that depend on this asset or not.
Returns
Whether the asset deletion was successful or not. A failure only indicates that the specified asset was not deleted but dependent assets and their loose files may have being deleted.
void dumpDeclaredAssets ( )

Dumps a breakdown of all declared assets.

Returns
No return value.
int findAllAssets ( assetQuery  )

Performs an asset query searching for all assets optionally ignoring internal assets.

Parameters
assetQueryThe asset query object that will be populated with the results.
ignoreInternalWhether to ignore internal assets or not. Optional: Defaults to true.
ignorePrivateWhether to ignore private assets or not. Optional: Defaults to true.
Returns
The number of asset Ids found or (-1) if an error occurred.
int findAssetAutoUnload ( assetQuery  ,
assetAutoUnload   
)

Performs an asset query searching for the specified asset auto-unload flag.

Parameters
assetQueryThe asset query object that will be populated with the results.
assetInternalThe asset internal flag to search for.
assetQueryAsSourceWhether to use the asset query as the data-source rather than the asset managers database or not. Doing this effectively filters the asset query. Optional: Defaults to false.
Returns
The number of asset Ids found or (-1) if an error occurred.
int findAssetCategory ( assetQuery  ,
assetCategory   
)

Performs an asset query searching for the specified asset category.

Parameters
assetQueryThe asset query object that will be populated with the results.
assetCategoryThe asset category to search for.
assetQueryAsSourceWhether to use the asset query as the data-source rather than the asset managers database or not. Doing this effectively filters the asset query. Optional: Defaults to false.
Returns
The number of asset Ids found or (-1) if an error occurred.
int findAssetDependsOn ( assetQuery  ,
assetId   
)

Performs an asset query searching for asset Ids that the specified asset Id depends on.

Parameters
assetQueryThe asset query object that will be populated with the results.
assetIdThe asset Id to query for any asset Ids that it depends on.
Returns
The number of asset Ids found or (-1) if an error occurred.
int findAssetInternal ( assetQuery  ,
assetInternal   
)

Performs an asset query searching for the specified asset internal flag.

Parameters
assetQueryThe asset query object that will be populated with the results.
assetInternalThe asset internal flag to search for.
assetQueryAsSourceWhether to use the asset query as the data-source rather than the asset managers database or not. Doing this effectively filters the asset query. Optional: Defaults to false.
Returns
The number of asset Ids found or (-1) if an error occurred.
int findAssetIsDependedOn ( assetQuery  ,
assetId   
)

Performs an asset query searching for asset Ids that depend on the specified asset Id.

Parameters
assetQueryThe asset query object that will be populated with the results.
assetIdThe asset Id to query for any asset Ids that may depend on it.
Returns
The number of asset Ids found or (-1) if an error occurred.
int findAssetLooseFile ( assetQuery  ,
assetLooseFile   
)

Performs an asset query searching for the specified loose file.

Parameters
assetQueryThe asset query object that will be populated with the results.
assetLooseFileThe loose-file used by the asset to search for.
assetQueryAsSourceWhether to use the asset query as the data-source rather than the asset managers database or not. Doing this effectively filters the asset query. Optional: Defaults to false.
Returns
The number of asset Ids found or (-1) if an error occurred.
int findAssetName ( assetQuery  ,
assetName   
)

Performs an asset query searching for the specified asset name.

Parameters
assetQueryThe asset query object that will be populated with the results.
assetNameThe asset name to search for. This may be a partial name if 'partialName' is true.
partialNameWhether the asset name is to be used as a partial name or not. Optional: Defaults to false.
Returns
The number of asset Ids found or (-1) if an error occurred.
int findAssetPrivate ( assetQuery  ,
assetPrivate   
)

Performs an asset query searching for the specified asset private flag.

Parameters
assetQueryThe asset query object that will be populated with the results.
assetPrivateThe asset private flag to search for.
assetQueryAsSourceWhether to use the asset query as the data-source rather than the asset managers database or not. Doing this effectively filters the asset query. Optional: Defaults to false.
Returns
The number of asset Ids found or (-1) if an error occurred.
int findAssetType ( assetQuery  ,
assetType   
)

Performs an asset query searching for the specified asset type.

Parameters
assetQueryThe asset query object that will be populated with the results.
assetTypeThe asset type to search for.
assetQueryAsSourceWhether to use the asset query as the data-source rather than the asset managers database or not. Doing this effectively filters the asset query. Optional: Defaults to false.
Returns
The number of asset Ids found or (-1) if an error occurred.
int findInvalidAssetReferences ( assetQuery  )

Performs an asset query searching for invalid asset references.

Parameters
assetQueryThe asset query object that will be populated with the results.
Returns
The number of asset Ids found that are invalid or (-1) if an error occurred.
int findTaggedAssets ( assetQuery  ,
assetTagNames   
)

Performs an asset query searching for the specified asset tag name(s).

Parameters
assetQueryThe asset query object that will be populated with the results.
assetTagNamesThe asset tag name or names to search for. Multiple names can be specified using comma, space, tab or newline separation. Tags use an OR operation i.e. only assets tagged with ANY of the specified tags will be returned.
assetQueryAsSourceWhether to use the asset query as the data-source rather than the asset managers database or not. Doing this effectively filters the asset query. Optional: Defaults to false.
Returns
The number of asset Ids found or (-1) if an error occurred.
string getAssetCategory ( assetId  )

Gets the asset category from the specified asset Id.

Parameters
assetIdThe selected asset Id.
Returns
The asset category from the specified asset Id.
string getAssetDescription ( assetId  )

Gets the asset description from the specified asset Id.

Parameters
assetIdThe selected asset Id.
Returns
The asset description from the specified asset Id.
string getAssetFilePath ( assetId  )

Gets the asset file-path from the specified asset Id.

Parameters
assetIdThe selected asset Id.
Returns
The asset file-path from the specified asset Id.
string getAssetModule ( assetId  )

Gets the module definition where the the specified asset Id is located.

Parameters
assetIdThe selected asset Id.
Returns
The module definition where the the specified asset Id is located
string getAssetName ( assetId  )

Gets the asset name from the specified asset Id.

Parameters
assetIdThe selected asset Id.
Returns
The asset name from the specified asset Id.
string getAssetPath ( assetId  )

Gets the asset path (not including the asset file) from the specified asset Id.

Parameters
assetIdThe selected asset Id.
Returns
The asset path (not including the asset file) from the specified asset Id.
int getAssetTags ( )

Gets the currently loaded asset tags manifest.

Returns
The currently loaded asset tags manifest or zero if not loaded.
string getAssetType ( assetId  )

Gets the asset type from the specified asset Id.

Parameters
assetIdThe selected asset Id.
Returns
The asset type from the specified asset Id.
bool getDeclaredAssetCount ( )

Gets the number of declared assets.

Returns
Returns the number of declared assets.
bool getLoadedExternalAssetCount ( )

Gets the number of loaded external assets.

Returns
Returns the number of loaded external assets.
bool getLoadedInternalAssetCount ( )

Gets the number of loaded internal assets.

Returns
Returns the number of loaded internal assets.
bool getMaxLoadedExternalAssetCount ( )

Gets the maximum number of loaded external assets.

Returns
Returns the maximum number of loaded external assets.
bool getMaxLoadedInternalAssetCount ( )

Gets the maximum number of loaded internal assets.

Returns
Returns the maximum number of loaded internal assets.
bool getReferencedAssetCount ( )

Gets the number of asset referenced.

Returns
Returns the number of asset references.
bool isAssetAutoUnload ( assetId  )

Check whether the specified asset Id is auto-unload or not.

Parameters
assetIdThe selected asset Id.
Returns
Whether the specified asset Id is auto-unload or not.
bool isAssetInternal ( assetId  )

Check whether the specified asset Id is internal or not.

Parameters
assetIdThe selected asset Id.
Returns
Whether the specified asset Id is internal or not.
bool isAssetLoaded ( assetId  )

Check whether the specified asset Id is loaded or not.

Parameters
assetIdThe selected asset Id.
Returns
Whether the specified asset Id is loaded or not.
bool isAssetPrivate ( assetId  )

Check whether the specified asset Id is private or not.

Parameters
assetIdThe selected asset Id.
Returns
Whether the specified asset Id is private or not.
bool isDeclaredAsset ( assetId  )

Check whether the specified asset Id is declared or not.

Parameters
assetIdThe selected asset Id.
Returns
Whether the specified asset Id is declared or not.
bool isReferencedAsset ( assetId  )

Check whether the specified asset Id is referenced or not.

Parameters
assetIdThe selected asset Id.
Returns
Whether the specified asset Id is referenced or not.
void purgeAssets ( )

Purge all assets that are not referenced even if they are set to not auto-unload. Assets can be in this state because they are either set to not auto-unload or the asset manager has/is disabling auto-unload.

Returns
No return value.
void refreshAllAssets ( )

Refresh all declared assets.

Parameters
Whetherto include currently unloaded assets in the refresh or not. Optional: Defaults to false. Refreshing all assets can be an expensive (time-consuming) operation to perform.
Returns
No return value.
void refreshAsset ( assetId  )

Refresh the specified asset Id.

Parameters
assetIdThe selected asset Id.
Returns
No return value.
bool releaseAsset ( assetId  )

Release the specified asset Id. The asset should have been acquired using 'acquireAsset'.

Parameters
assetIdThe selected asset Id.
Returns
Whether the asset was released or not.
bool removeDeclaredAsset ( assetId  )

Remove the specified declared asset Id.

Parameters
assetIdThe selected asset Id.
Returns
Whether removing the declared asset was successful or not.
bool removeDeclaredAssets ( moduleDefinition  )

Remove any the declared assets specified by the module definition.

Parameters
moduleDefinitionThe module definition that may contain declared assets.
Returns
Whether removing declared assets was successful or not.
bool renameDeclaredAsset ( assetIdFrom  ,
assetIdTo   
)

Rename declared asset Id.

Parameters
assetIdFromThe selected asset Id to rename from.
assetIdFromThe selected asset Id to rename to.
Returns
Whether the rename was successful or not.
bool renameReferencedAsset ( assetIdFrom  ,
assetIdTo   
)

Rename referenced asset Id.

Parameters
assetIdFromThe selected asset Id to rename from.
assetIdFromThe selected asset Id to rename to.
Returns
Whether the rename was successful or not.
bool restoreAssetTags ( )

Restore the currently loaded asset tags manifest from disk (replace anything in memory).

Returns
Whether the restore was successful or not.
bool saveAssetTags ( )

Save the currently loaded asset tags manifest.

Returns
Whether the save was successful or not.