TorqueScript Reference
AssetBase Class Reference

#include <assetBase_ScriptBinding.h>

Inherits SimObject.

Inherited by AnimationAsset, AudioAsset, FontAsset, ImageAsset, and ParticleAsset.

Public Member Functions

Integer createStateSnapshot ()
String getAssetId ()
Boolean isAssetDirty ()
void refreshAsset ()
Boolean restoreStateSnapshot (snapshot)
Boolean revertAsset ()
Boolean saveAsset ()
Public Member Functions inherited from SimObject
void assignFieldsFrom (SimObject)
Integer clone ([copyDynamicFields=false]?)
Integer deepClone ()
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

◆ createStateSnapshot()

Integer createStateSnapshot ( )

Takes a detached copy of everything the asset currently holds. The copy is a registered object that the caller owns and must delete. Taking one changes nothing about this asset: it is not marked as changed and nobody is notified.

Returns
The snapshot object's Id, or 0 if the snapshot could not be taken.

◆ getAssetId()

String getAssetId ( )

Gets the assets' Asset Id. This is only available if the asset was acquired from the asset manager.

Returns
The assets' Asset Id.

◆ isAssetDirty()

Boolean isAssetDirty ( )

Whether the asset has changes that have not been saved.

Returns
Whether the asset has unsaved changes or not.

◆ refreshAsset()

void refreshAsset ( )

Refresh the asset. This marks the asset as having unsaved changes and tells everything watching it that it changed. It does NOT write the asset's file – use saveAsset for that.

Returns
No return value.

◆ restoreStateSnapshot()

Boolean restoreStateSnapshot ( snapshot )

Puts a snapshot taken by createStateSnapshot back onto this asset. The asset object itself is kept, so anything already using the asset keeps working. This does not mark the asset as changed – the caller decides what the asset's unsaved state should be afterwards.

Parameters
snapshotThe snapshot object to restore.
Returns
Whether the restore was successful or not.

◆ revertAsset()

Boolean revertAsset ( )

Discard the asset's unsaved changes and reload it from its file.

Returns
Whether the revert was successful or not.

◆ saveAsset()

Boolean saveAsset ( )

Write the asset to its file.

Returns
Whether the save was successful or not.