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

#include <assetManager_ScriptBinding.h>

Inherits SimObject.

Public Member Functions

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

Member Function Documentation

◆ acquireAsset()

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.

◆ addDeclaredAsset()

Boolean 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.

◆ addModuleDeclaredAssets()

Boolean 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.

◆ addPrivateAsset()

String addPrivateAsset ( assetObject  )

Adds a private asset object.

Parameters
assetObjectThe asset object to add as a private asset.
Returns
The allocated private asset Id.

◆ compileReferencedAssets()

Boolean 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.

◆ deleteAsset()

Boolean 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.

◆ dumpDeclaredAssets()

void dumpDeclaredAssets ( )

Dumps a breakdown of all declared assets.

Returns
No return value.

◆ findAllAssets()

Integer 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.

◆ findAssetAutoUnload()

Integer 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.

◆ findAssetCategory()

Integer 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.

◆ findAssetDependsOn()

Integer 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.

◆ findAssetInternal()

Integer 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.

◆ findAssetIsDependedOn()

Integer 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.

◆ findAssetLooseFile()

Integer 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.

◆ findAssetName()

Integer 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.

◆ findAssetPrivate()

Integer 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.

◆ findAssetType()

Integer 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.

◆ findInvalidAssetReferences()

Integer 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.

◆ findTaggedAssets()

Integer 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.

◆ getAssetCategory()

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.

◆ getAssetDescription()

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.

◆ getAssetFilePath()

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.

◆ getAssetModule()

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

◆ getAssetName()

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.

◆ getAssetPath()

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.

◆ getAssetTags()

Integer getAssetTags ( )

Gets the currently loaded asset tags manifest.

Returns
The currently loaded asset tags manifest or zero if not loaded.

◆ getAssetType()

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.

◆ getDeclaredAssetCount()

Boolean getDeclaredAssetCount ( )

Gets the number of declared assets.

Returns
Returns the number of declared assets.

◆ getLoadedExternalAssetCount()

Boolean getLoadedExternalAssetCount ( )

Gets the number of loaded external assets.

Returns
Returns the number of loaded external assets.

◆ getLoadedInternalAssetCount()

Boolean getLoadedInternalAssetCount ( )

Gets the number of loaded internal assets.

Returns
Returns the number of loaded internal assets.

◆ getMaxLoadedExternalAssetCount()

Boolean getMaxLoadedExternalAssetCount ( )

Gets the maximum number of loaded external assets.

Returns
Returns the maximum number of loaded external assets.

◆ getMaxLoadedInternalAssetCount()

Boolean getMaxLoadedInternalAssetCount ( )

Gets the maximum number of loaded internal assets.

Returns
Returns the maximum number of loaded internal assets.

◆ getReferencedAssetCount()

Boolean getReferencedAssetCount ( )

Gets the number of asset referenced.

Returns
Returns the number of asset references.

◆ isAssetAutoUnload()

Boolean 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.

◆ isAssetInternal()

Boolean 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.

◆ isAssetLoaded()

Boolean 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.

◆ isAssetPrivate()

Boolean 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.

◆ isDeclaredAsset()

Boolean 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.

◆ isReferencedAsset()

Boolean 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.

◆ preloadAsset()

void preloadAsset ( assetId  )

Ensures an asset is loaded even if it has no references. The asset is also set to not auto unload to prevent it from unloading. Use purgeAssets to unload the asset.

Parameters
assetIdThe selected asset Id.
Returns
No return value.

◆ purgeAssets()

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.

◆ refreshAllAssets()

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.

◆ refreshAsset()

void refreshAsset ( assetId  )

Refresh the specified asset Id.

Parameters
assetIdThe selected asset Id.
Returns
No return value.

◆ releaseAsset()

Boolean 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.

◆ removeDeclaredAsset()

Boolean removeDeclaredAsset ( assetId  )

Remove the specified declared asset Id.

Parameters
assetIdThe selected asset Id.
Returns
Whether removing the declared asset was successful or not.

◆ removeDeclaredAssets()

Boolean 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.

◆ renameDeclaredAsset()

Boolean 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.

◆ renameReferencedAsset()

Boolean 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.

◆ restoreAssetTags()

Boolean restoreAssetTags ( )

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

Returns
Whether the restore was successful or not.

◆ saveAssetTags()

Boolean saveAssetTags ( )

Save the currently loaded asset tags manifest.

Returns
Whether the save was successful or not.