TorqueScript Reference

- Main Page
- Related Pages
- Modules
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
AssetManager Class Reference

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 | 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
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)
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]*)
Boolean | save (fileName, [selectedOnly]?)
void | addFieldFilter (fieldName)
void | removeFieldFilter (fieldName)

## 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

  assetId | The selected asset Id.
  asPrivate | Whether to acquire the asset Id as a private asset.

Returns
  The acquired asset or NULL if not acquired.

Boolean addDeclaredAsset | ( | moduleDefinition | ,
|  | assetFilePath |
| ) |  |

Add the specified asset against the specified module definition.

Parameters

  moduleDefinition | The module definition that may contain declared assets.

Returns
  Whether adding declared assets was successful or not.

Boolean addModuleDeclaredAssets | ( | moduleDefinition |  | ) |

Add any the declared assets specified by the module definition.

Parameters

  moduleDefinition | The module definition specifies the asset manifest.

Returns
  Whether adding declared assets was successful or not.

String addPrivateAsset | ( | assetObject |  | ) |

Adds a private asset object.

Parameters

  assetObject | The asset object to add as a private asset.

Returns
  The allocated private asset Id.

Boolean compileReferencedAssets | ( | moduleDefinition |  | ) |

Compile the referenced assets determined by the specified module definition.

Parameters

  moduleDefinition | The module definition specifies the asset manifest.

Returns
  Whether the compilation was successful or not.

Boolean deleteAsset | ( | assetId | ,
|  | deleteLooseFiles | ,
|  | deleteDependencies |
| ) |  |

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

Parameters

  assetId | The selected asset Id.
  deleteLooseFiles | Whether to delete an assets loose files or not.
  deleteDependencies | Whether 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.

Integer findAllAssets | ( | assetQuery |  | ) |

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

Parameters

  assetQuery | The asset query object that will be populated with the results.
  ignoreInternal | Whether to ignore internal assets or not. Optional: Defaults to true.
  ignorePrivate | Whether to ignore private assets or not. Optional: Defaults to true.

Returns
  The number of asset Ids found or (-1) if an error occurred.

Integer findAssetAutoUnload | ( | assetQuery | ,
|  | assetAutoUnload |
| ) |  |

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

Parameters

  assetQuery | The asset query object that will be populated with the results.
  assetInternal | The asset internal flag to search for.
  assetQueryAsSource | Whether 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.

Integer findAssetCategory | ( | assetQuery | ,
|  | assetCategory |
| ) |  |

Performs an asset query searching for the specified asset category.

Parameters

  assetQuery | The asset query object that will be populated with the results.
  assetCategory | The asset category to search for.
  assetQueryAsSource | Whether 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.

Integer findAssetDependsOn | ( | assetQuery | ,
|  | assetId |
| ) |  |

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

Parameters

  assetQuery | The asset query object that will be populated with the results.
  assetId | The 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.

Integer findAssetInternal | ( | assetQuery | ,
|  | assetInternal |
| ) |  |

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

Parameters

  assetQuery | The asset query object that will be populated with the results.
  assetInternal | The asset internal flag to search for.
  assetQueryAsSource | Whether 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.

Integer findAssetIsDependedOn | ( | assetQuery | ,
|  | assetId |
| ) |  |

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

Parameters

  assetQuery | The asset query object that will be populated with the results.
  assetId | The 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.

Integer findAssetLooseFile | ( | assetQuery | ,
|  | assetLooseFile |
| ) |  |

Performs an asset query searching for the specified loose file.

Parameters

  assetQuery | The asset query object that will be populated with the results.
  assetLooseFile | The loose-file used by the asset to search for.
  assetQueryAsSource | Whether 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.

Integer findAssetName | ( | assetQuery | ,
|  | assetName |
| ) |  |

Performs an asset query searching for the specified asset name.

Parameters

  assetQuery | The asset query object that will be populated with the results.
  assetName | The asset name to search for. This may be a partial name if 'partialName' is true.
  partialName | Whether 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.

Integer findAssetPrivate | ( | assetQuery | ,
|  | assetPrivate |
| ) |  |

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

Parameters

  assetQuery | The asset query object that will be populated with the results.
  assetPrivate | The asset private flag to search for.
  assetQueryAsSource | Whether 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.

Integer findAssetType | ( | assetQuery | ,
|  | assetType |
| ) |  |

Performs an asset query searching for the specified asset type.

Parameters

  assetQuery | The asset query object that will be populated with the results.
  assetType | The asset type to search for.
  assetQueryAsSource | Whether 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.

Integer findInvalidAssetReferences | ( | assetQuery |  | ) |

Performs an asset query searching for invalid asset references.

Parameters

  assetQuery | The 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.

Integer findTaggedAssets | ( | assetQuery | ,
|  | assetTagNames |
| ) |  |

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

Parameters

  assetQuery | The asset query object that will be populated with the results.
  assetTagNames | The 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.
  assetQueryAsSource | Whether 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

  assetId | The 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

  assetId | The 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

  assetId | The 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

  assetId | The 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

  assetId | The 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

  assetId | The selected asset Id.

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

Integer 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

  assetId | The selected asset Id.

Returns
  The asset type from the specified asset Id.

Boolean getDeclaredAssetCount | ( |  | ) |

Gets the number of declared assets.

Returns
  Returns the number of declared assets.

Boolean getLoadedExternalAssetCount | ( |  | ) |

Gets the number of loaded external assets.

Returns
  Returns the number of loaded external assets.

Boolean getLoadedInternalAssetCount | ( |  | ) |

Gets the number of loaded internal assets.

Returns
  Returns the number of loaded internal assets.

Boolean getMaxLoadedExternalAssetCount | ( |  | ) |

Gets the maximum number of loaded external assets.

Returns
  Returns the maximum number of loaded external assets.

Boolean getMaxLoadedInternalAssetCount | ( |  | ) |

Gets the maximum number of loaded internal assets.

Returns
  Returns the maximum number of loaded internal assets.

Boolean getReferencedAssetCount | ( |  | ) |

Gets the number of asset referenced.

Returns
  Returns the number of asset references.

Boolean isAssetAutoUnload | ( | assetId |  | ) |

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

Parameters

  assetId | The selected asset Id.

Returns
  Whether the specified asset Id is auto-unload or not.

Boolean isAssetInternal | ( | assetId |  | ) |

Check whether the specified asset Id is internal or not.

Parameters

  assetId | The selected asset Id.

Returns
  Whether the specified asset Id is internal or not.

Boolean isAssetLoaded | ( | assetId |  | ) |

Check whether the specified asset Id is loaded or not.

Parameters

  assetId | The selected asset Id.

Returns
  Whether the specified asset Id is loaded or not.

Boolean isAssetPrivate | ( | assetId |  | ) |

Check whether the specified asset Id is private or not.

Parameters

  assetId | The selected asset Id.

Returns
  Whether the specified asset Id is private or not.

Boolean isDeclaredAsset | ( | assetId |  | ) |

Check whether the specified asset Id is declared or not.

Parameters

  assetId | The selected asset Id.

Returns
  Whether the specified asset Id is declared or not.

Boolean isReferencedAsset | ( | assetId |  | ) |

Check whether the specified asset Id is referenced or not.

Parameters

  assetId | The 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

  Whether | to 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

  assetId | The selected asset Id.

Returns
  No return value.

Boolean releaseAsset | ( | assetId |  | ) |

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

Parameters

  assetId | The selected asset Id.

Returns
  Whether the asset was released or not.

Boolean removeDeclaredAsset | ( | assetId |  | ) |

Remove the specified declared asset Id.

Parameters

  assetId | The selected asset Id.

Returns
  Whether removing the declared asset was successful or not.

Boolean removeDeclaredAssets | ( | moduleDefinition |  | ) |

Remove any the declared assets specified by the module definition.

Parameters

  moduleDefinition | The module definition that may contain declared assets.

Returns
  Whether removing declared assets was successful or not.

Boolean renameDeclaredAsset | ( | assetIdFrom | ,
|  | assetIdTo |
| ) |  |

Rename declared asset Id.

Parameters

  assetIdFrom | The selected asset Id to rename from.
  assetIdFrom | The selected asset Id to rename to.

Returns
  Whether the rename was successful or not.

Boolean renameReferencedAsset | ( | assetIdFrom | ,
|  | assetIdTo |
| ) |  |

Rename referenced asset Id.

Parameters

  assetIdFrom | The selected asset Id to rename from.
  assetIdFrom | The selected asset Id to rename to.

Returns
  Whether the rename was successful or not.

Boolean restoreAssetTags | ( |  | ) |

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

Returns
  Whether the restore was successful or not.

Boolean saveAssetTags | ( |  | ) |

Save the currently loaded asset tags manifest.

Returns
  Whether the save was successful or not.