Torque2D Reference
Loading...
Searching...
No Matches
AnimationAsset Class Reference

#include <AnimationAsset.h>

Inheritance diagram for AnimationAsset:

Public Member Functions

 AnimationAsset ()
virtual ~AnimationAsset ()
virtual bool onAdd ()
 Called when the object is added to the sim.
virtual void onRemove ()
 Called when the object is removed from the sim.
void setImage (const char *pAssetId)
const AssetPtr< ImageAsset > & getImage (void) const
void setAnimationFrames (const char *pAnimationFrames)
const Vector< S32 > & getSpecifiedAnimationFrames (void) const
const Vector< S32 > & getValidatedAnimationFrames (void) const
void setNamedAnimationFrames (const char *pAnimationFrames)
const Vector< StringTableEntry > & getSpecifiedNamedAnimationFrames (void) const
const Vector< StringTableEntry > & getValidatedNamedAnimationFrames (void) const
void setAnimationTime (const F32 animationTime)
F32 getAnimationTime (void) const
void setAnimationCycle (const bool animationCycle)
bool getAnimationCycle (void) const
void setRandomStart (const bool randomStart)
bool getRandomStart (void) const
bool getNamedCellsMode (void) const
void validateFrames (void)
void validateNumericalFrames (void)
void validateNamedFrames (void)
void convertFramesForMode (void)
void getMissingFrames (Vector< StringTableEntry > &missingFrames) const
 The specified names that no cell answers to. Empty when all of them do.
S32 getFrameCount (const bool validatedFrames) const
 How many frames the animation has, in whichever space it is using.
virtual bool isAssetValid (void) const
 DECLARE_CONOBJECT (AnimationAsset)
 Declare Console Object.
Public Member Functions inherited from AssetBase
 AssetBase ()
virtual ~AssetBase ()
virtual void copyTo (SimObject *object)
virtual void copyAssetStateTo (AssetBase *pTarget)
void setAssetName (const char *pAssetName)
 Asset configuration.
StringTableEntry getAssetName (void) const
void setAssetDescription (const char *pAssetDescription)
StringTableEntry getAssetDescription (void) const
void setAssetCategory (const char *pAssetCategory)
StringTableEntry getAssetCategory (void) const
void setAssetAutoUnload (const bool autoUnload)
bool getAssetAutoUnload (void) const
void setAssetInternal (const bool assetInternal)
bool getAssetInternal (void) const
bool getAssetPrivate (void) const
StringTableEntry getAssetType (void) const
S32 getAcquiredReferenceCount (void) const
bool getOwned (void) const
StringTableEntry getAssetId (void) const
StringTableEntry expandAssetFilePath (const char *pAssetFilePath) const
 Expanding/Collapsing asset paths is only available once registered with the asset manager.
StringTableEntry collapseAssetFilePath (const char *pAssetFilePath) const
bool getAssetDirty (void) const
 Whether the asset has changes that have not been saved.
void refreshAsset (void)
bool saveAsset (void)
 Save the asset's file, and revert it to what that file already holds.
bool revertAsset (void)
AssetBasecreateStateSnapshot (void)
bool restoreStateSnapshot (AssetBase *pSnapshot)
 DECLARE_CONOBJECT (AssetBase)
 Declare Console Object.
Public Member Functions inherited from SimObject
StringTableEntry getClassNamespace () const
StringTableEntry getSuperClassNamespace () const
void setClassNamespace (const char *classNamespace)
void setSuperClassNamespace (const char *superClassNamespace)
void pushScriptCallbackGuard (void)
void popScriptCallbackGuard (void)
S32 getScriptCallbackGuard (void)
virtual SimObjectfindObject (const char *name)
NamespacegetNamespace ()
 Return the object's namespace.
const char * tabComplete (const char *prevText, S32 baseLen, bool)
virtual void dump ()
virtual void dumpClassHierarchy ()
SimObjectclone (const bool copyDynamicFields)
SimObjectdeepClone ()
template<typename T>
bool isType (void)
virtual bool handlesConsoleMethod (const char *fname, S32 *routingId)
 DECLARE_CONOBJECT (SimObject)
virtual bool writeField (StringTableEntry fieldname, const char *value)
virtual void write (Stream &stream, U32 tabStop, U32 flags=0)
virtual void writeFields (Stream &stream, U32 tabStop)
virtual bool writeObject (Stream *stream)
virtual bool readObject (Stream *stream)
virtual void buildFilterList ()
void addFieldFilter (const char *fieldName)
void removeFieldFilter (const char *fieldName)
void clearFieldFilters ()
bool isFiltered (const char *fieldName)
void assignFieldsFrom (SimObject *obj)
void copyFieldsFrom (SimObject *obj, const U32 flags)
void assignDynamicFieldsFrom (SimObject *obj)
NotifyremoveNotify (void *ptr, Notify::Type)
 Remove a notification from the list.
void deleteNotify (SimObject *obj)
 Notify an object when we are deleted.
void clearNotify (SimObject *obj)
 Notify an object when we are cleared.
void clearAllNotifications ()
 Remove all notifications for this object.
void processDeleteNotifies ()
 Send out deletion notifications.
void registerReference (SimObject **obj)
void unregisterReference (SimObject **obj)
void addListener (std::string objID)
void removeListener (std::string objID)
void removeAllListeners ()
void postEvent (std::string eventName, std::string data)
const char * getDataField (StringTableEntry slotName, const char *array)
virtual void setDataField (StringTableEntry slotName, const char *array, const char *value)
const char * getPrefixedDataField (StringTableEntry fieldName, const char *array)
void setPrefixedDataField (StringTableEntry fieldName, const char *array, const char *value)
const char * getPrefixedDynamicDataField (StringTableEntry fieldName, const char *array, const S32 fieldType=-1)
void setPrefixedDynamicDataField (StringTableEntry fieldName, const char *array, const char *value, const S32 fieldType=-1)
StringTableEntry getDataFieldPrefix (StringTableEntry fieldName)
U32 getDataFieldType (StringTableEntry slotName, const char *array)
SimFieldDictionarygetFieldDictionary ()
void clearDynamicFields (void)
 Clear all dynamic fields.
void setCanSaveDynamicFields (bool bCanSave)
 Set whether fields created at runtime should be saved. Default is true.
bool getCanSaveDynamicFields (void) const
 Get whether fields created at runtime should be saved. Default is true.
void setInternalName (const char *newname)
StringTableEntry getInternalName ()
 Get the internal of of this control.
virtual bool save (const char *pcFilePath, bool bOnlySelected=false)
 Save object as a TorqueScript File.
virtual bool isMethod (const char *methodName)
 Check if a method exists in the objects current namespace.
SimObjectId getId (void) const
StringTableEntry getIdString (void) const
U32 getType () const
const StringTableEntry getName (void) const
void setId (SimObjectId id)
void assignName (const char *name)
SimGroupgetGroup () const
bool isChildOfGroup (SimGroup *pGroup)
bool isProperlyAdded () const
bool isDeleted () const
bool isRemoved () const
bool isLocked () const
void setLocked (bool b)
bool isHidden () const
void setHidden (bool b)
void setProgenitorFile (const char *pFile)
StringTableEntry getProgenitorFile (void) const
void setPeriodicTimerID (const S32 timerID)
S32 getPeriodicTimerID (void) const
bool isPeriodicTimerActive (void) const
bool isSelected () const
bool isExpanded () const
void setSelected (bool sel)
void setExpanded (bool exp)
void setModDynamicFields (bool dyn)
void setModStaticFields (bool sta)
 SimObject ()
virtual ~SimObject ()
virtual bool processArguments (S32 argc, const char **argv)
 Process constructor options. (ie, new SimObject(1,2,3)).
virtual void onGroupAdd ()
 Called when the object is added to a SimGroup.
virtual void onGroupRemove ()
 Called when the object is removed from a SimGroup.
virtual void onNameChange (const char *name)
 Called when the object's name is changed.
virtual void onStaticModified (const char *slotName, const char *newValue=NULL)
virtual void inspectPreApply ()
virtual void inspectPostApply ()
virtual void onDeleteNotify (SimObject *object)
virtual void onEditorEnable ()
 Called when the editor is activated.
virtual void onEditorDisable ()
 Called when the editor is deactivated.
bool registerObject ()
bool registerObject (U32 id)
bool registerObject (const char *name)
bool registerObject (const char *name, U32 id)
void unregisterObject ()
void deleteObject ()
bool addToSet (SimObjectId)
bool addToSet (const char *)
bool removeFromSet (SimObjectId)
bool removeFromSet (const char *)
Public Member Functions inherited from ConsoleObject
const AbstractClassRep::FieldfindField (StringTableEntry fieldName) const
 Get a reference to a field by name.
virtual AbstractClassRepgetClassRep () const
 Gets the ClassRep.
bool setField (const char *fieldName, const char *value)
 Set the value of a field.
virtual ~ConsoleObject ()
const AbstractClassRep::FieldListgetFieldList () const
 Get a list of all the fields. This information cannot be modified.
AbstractClassRep::FieldListgetModifiableFieldList ()
bool & getDynamicGroupExpand ()
S32 getClassId (U32 netClassGroup) const
const char * getClassName () const

Static Public Member Functions

static void initPersistFields ()
static void translateFrames (const Vector< S32 > &indices, const Vector< StringTableEntry > &cellNames, Vector< StringTableEntry > &outNames)
static void translateFrames (const Vector< StringTableEntry > &names, const Vector< StringTableEntry > &cellNames, Vector< S32 > &outIndices)
Static Public Member Functions inherited from AssetBase
static void initPersistFields ()
 Engine.
Static Public Member Functions inherited from SimObject
static void initPersistFields ()
Static Public Member Functions inherited from ConsoleObject
static const char * lookupClassName (const U32 in_classTag)
 Get the classname from a class tag.
static void initPersistFields ()
static void consoleInit ()
static AbstractClassRepgetStaticClassRep ()
 Get the abstract class information for this class.
static AbstractClassRepgetParentStaticClassRep ()
 Get the abstract class information for this class's superclass.
static ConsoleObjectcreate (const char *in_pClassName)
static ConsoleObjectcreate (const U32 groupId, const U32 typeId, const U32 in_classId)

Protected Member Functions

virtual void initializeAsset (void)
virtual void onAssetRefresh (void)
Protected Member Functions inherited from SimObject
virtual void onTamlPreWrite (void)
 Taml callbacks.
virtual void onTamlPostWrite (void)
 Called after Taml has finished writing the object.
virtual void onTamlPreRead (void)
 Called prior to Taml reading the object.
virtual void onTamlPostRead (const TamlCustomNodes &customNodes)
virtual void onTamlAddParent (SimObject *pParentObject)
 Called after Taml has finished reading the object and has added the object to any parent.
virtual void onTamlCustomWrite (TamlCustomNodes &customNodes)
 Called during the writing of the object to allow custom properties to be written.
virtual void onTamlCustomRead (const TamlCustomNodes &customNodes)
 Called during the reading of the object to allow custom properties to be read.
void linkNamespaces ()
void unlinkNamespaces ()
virtual SimObjectallocClone ()
 A registered but empty object of this object's class.
void cloneInto (SimObject *clone)
virtual void deepCloneChildren (SimObject *clone)
Protected Member Functions inherited from ConsoleObject
 ConsoleObject ()
 ConsoleObject (const ConsoleObject &)

Static Protected Member Functions

static bool setImage (void *obj, const char *data)
static bool writeImage (void *obj, StringTableEntry pFieldName)
static bool setAnimationFrames (void *obj, const char *data)
static bool setNamedAnimationFrames (void *obj, const char *data)
static bool writeAnimationFrames (void *obj, StringTableEntry pFieldName)
static bool writeNamedAnimationFrames (void *obj, StringTableEntry pFieldName)
static bool setAnimationTime (void *obj, const char *data)
static bool setAnimationCycle (void *obj, const char *data)
static bool writeAnimationCycle (void *obj, StringTableEntry pFieldName)
static bool setRandomStart (void *obj, const char *data)
static bool writeRandomStart (void *obj, StringTableEntry pFieldName)
Static Protected Member Functions inherited from AssetBase
static bool setAssetName (void *obj, const char *data)
static const char * getAssetName (void *obj, const char *data)
static bool writeAssetName (void *obj, StringTableEntry pFieldName)
static bool setAssetDescription (void *obj, const char *data)
static const char * getAssetDescription (void *obj, const char *data)
static bool writeAssetDescription (void *obj, StringTableEntry pFieldName)
static bool setAssetCategory (void *obj, const char *data)
static const char * getAssetCategory (void *obj, const char *data)
static bool writeAssetCategory (void *obj, StringTableEntry pFieldName)
static bool setAssetAutoUnload (void *obj, const char *data)
static const char * getAssetAutoUnload (void *obj, const char *data)
static bool writeAssetAutoUnload (void *obj, StringTableEntry pFieldName)
static bool setAssetInternal (void *obj, const char *data)
static const char * getAssetInternal (void *obj, const char *data)
static bool writeAssetInternal (void *obj, StringTableEntry pFieldName)
static const char * getAssetPrivate (void *obj, const char *data)
Static Protected Member Functions inherited from SimObject
static bool setClass (void *obj, const char *data)
static bool setSuperClass (void *obj, const char *data)
static bool writeObjectName (void *obj, StringTableEntry pFieldName)
static bool writeCanSaveDynamicFields (void *obj, StringTableEntry pFieldName)
static bool writeInternalName (void *obj, StringTableEntry pFieldName)
static bool setParentGroup (void *obj, const char *data)
static bool writeParentGroup (void *obj, StringTableEntry pFieldName)
static bool writeSuperclass (void *obj, StringTableEntry pFieldName)
static bool writeClass (void *obj, StringTableEntry pFieldName)
static bool setProtectedName (void *obj, const char *data)
static const char * getProtectedName (void *obj, const char *data)
static SimObject::NotifyallocNotify ()
 Get a free Notify structure.
static void freeNotify (SimObject::Notify *)
 Mark a Notify structure as free.
static void addGroup (const char *in_pGroupname, const char *in_pGroupDocs=NULL)
static void endGroup (const char *in_pGroupname)
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::WriteDataNotify in_writeDataFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, const char *in_pFieldDocs)
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::WriteDataNotify in_writeDataFn, const char *in_pFieldDocs)
static void addFieldV (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, ConsoleTypeValidator *v, const char *in_pFieldDocs=NULL)
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, AbstractClassRep::WriteDataNotify in_writeDataFn=&defaultProtectedWriteFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, const char *in_pFieldDocs=NULL)
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, AbstractClassRep::WriteDataNotify in_writeDataFn=&defaultProtectedWriteFn, const char *in_pFieldDocs=NULL)
static void addDepricatedField (const char *fieldName)
static bool removeField (const char *in_pFieldname)

Additional Inherited Members

Public Types inherited from SimObject
enum  WriteFlags { SelectedOnly = BIT(0) }
enum  CopyFieldsFlags { CopyFields_SkipName = BIT(0) , CopyFields_SkipParentGroup = BIT(1) , CopyFields_SkipScriptClass = BIT(2) }
 What copyFieldsFrom may be told to leave alone. More...
static bool disableNameChanging = false
Protected Attributes inherited from SimObject
SimObjectId mId
 Id number for this object.
StringTableEntry mIdString
NamespacemNameSpace
U32 mTypeMask
S32 mScriptCallbackGuard
 Whether the object is executing a script callback.
bool mCanSaveFieldDictionary
 true if dynamic fields (added at runtime) should be saved, defaults to true
StringTableEntry mInternalName
 Stores object Internal Name.
StringTableEntry mClassName
 Stores the class name to link script class namespaces.
StringTableEntry mSuperClassName
 Stores super class name to link script class namespaces.
static SimObject::NotifymNotifyFreeList = NULL

Constructor & Destructor Documentation

◆ AnimationAsset()

◆ ~AnimationAsset()

~AnimationAsset ( )
virtual

Member Function Documentation

◆ convertFramesForMode()

void convertFramesForMode ( void )

Put the frame list into the space the image now uses.

Deliberately NOT called from the two frame setters, only from the three places that mean "something outside changed". Setting an empty frame list is a thing the editor does whenever the timeline is emptied, and something copyFieldsFrom does on every single copy – and from inside a setter this could not tell that from "this list was never filled in", so it put the frames the user had just cleared straight back.

◆ DECLARE_CONOBJECT()

DECLARE_CONOBJECT ( AnimationAsset )

Declare Console Object.

◆ getAnimationCycle()

bool getAnimationCycle ( void ) const
inline

◆ getAnimationTime()

F32 getAnimationTime ( void ) const
inline

◆ getFrameCount()

S32 getFrameCount ( const bool validatedFrames) const

How many frames the animation has, in whichever space it is using.

◆ getImage()

const AssetPtr< ImageAsset > & getImage ( void ) const
inline

◆ getMissingFrames()

void getMissingFrames ( Vector< StringTableEntry > & missingFrames) const

The specified names that no cell answers to. Empty when all of them do.

◆ getNamedCellsMode()

bool getNamedCellsMode ( void ) const

Whether this animation addresses its frames by name rather than by index.

Asked of the image, not stored. An image in explicit mode cuts itself into named cells and one in cell mode does not, so the image already holds the only honest answer – and a copy of it here could disagree with the image it was copied from the moment that image was re-cut. It was a saved field once, which meant a person could set it to true on an image that had no names, and the animation had no frames and no explanation.

◆ getRandomStart()

bool getRandomStart ( void ) const
inline

◆ getSpecifiedAnimationFrames()

const Vector< S32 > & getSpecifiedAnimationFrames ( void ) const
inline

◆ getSpecifiedNamedAnimationFrames()

const Vector< StringTableEntry > & getSpecifiedNamedAnimationFrames ( void ) const
inline

◆ getValidatedAnimationFrames()

const Vector< S32 > & getValidatedAnimationFrames ( void ) const
inline

◆ getValidatedNamedAnimationFrames()

const Vector< StringTableEntry > & getValidatedNamedAnimationFrames ( void ) const
inline

◆ initializeAsset()

void initializeAsset ( void )
protectedvirtual

Reimplemented from AssetBase.

◆ initPersistFields()

void initPersistFields ( )
static

◆ isAssetValid()

bool isAssetValid ( void ) const
virtual

Reimplemented from AssetBase.

◆ onAdd()

bool onAdd ( void )
virtual

Called when the object is added to the sim.

Reimplemented from SimObject.

◆ onAssetRefresh()

void onAssetRefresh ( void )
protectedvirtual

Reimplemented from AssetBase.

◆ onRemove()

void onRemove ( )
virtual

Called when the object is removed from the sim.

Reimplemented from SimObject.

◆ setAnimationCycle() [1/2]

void setAnimationCycle ( const bool animationCycle)

◆ setAnimationCycle() [2/2]

bool setAnimationCycle ( void * obj,
const char * data )
inlinestaticprotected

◆ setAnimationFrames() [1/2]

void setAnimationFrames ( const char * pAnimationFrames)

◆ setAnimationFrames() [2/2]

bool setAnimationFrames ( void * obj,
const char * data )
inlinestaticprotected

◆ setAnimationTime() [1/2]

void setAnimationTime ( const F32 animationTime)

◆ setAnimationTime() [2/2]

bool setAnimationTime ( void * obj,
const char * data )
inlinestaticprotected

◆ setImage() [1/2]

void setImage ( const char * pAssetId)

◆ setImage() [2/2]

bool setImage ( void * obj,
const char * data )
inlinestaticprotected

◆ setNamedAnimationFrames() [1/2]

void setNamedAnimationFrames ( const char * pAnimationFrames)

◆ setNamedAnimationFrames() [2/2]

bool setNamedAnimationFrames ( void * obj,
const char * data )
inlinestaticprotected

◆ setRandomStart() [1/2]

void setRandomStart ( const bool randomStart)

◆ setRandomStart() [2/2]

bool setRandomStart ( void * obj,
const char * data )
inlinestaticprotected

◆ translateFrames() [1/2]

void translateFrames ( const Vector< S32 > & indices,
const Vector< StringTableEntry > & cellNames,
Vector< StringTableEntry > & outNames )
static

Translate a frame list from one space to the other against a table of cell names, where entry N is what cell N is called.

Statics taking their whole world rather than methods reaching for the image asset, so they can be unit tested – building a real ImageAsset with cells needs a bitmap, and a unit test has no GL context to load one into.

An entry that does not resolve is skipped. There is no honest name for an index with no cell, and inventing one risks colliding with a cell somebody really does name that later.

◆ translateFrames() [2/2]

void translateFrames ( const Vector< StringTableEntry > & names,
const Vector< StringTableEntry > & cellNames,
Vector< S32 > & outIndices )
static

◆ validateFrames()

void validateFrames ( void )

◆ validateNamedFrames()

void validateNamedFrames ( void )

◆ validateNumericalFrames()

void validateNumericalFrames ( void )

◆ writeAnimationCycle()

bool writeAnimationCycle ( void * obj,
StringTableEntry pFieldName )
inlinestaticprotected

◆ writeAnimationFrames()

bool writeAnimationFrames ( void * obj,
StringTableEntry pFieldName )
inlinestaticprotected

◆ writeImage()

bool writeImage ( void * obj,
StringTableEntry pFieldName )
inlinestaticprotected

◆ writeNamedAnimationFrames()

bool writeNamedAnimationFrames ( void * obj,
StringTableEntry pFieldName )
inlinestaticprotected

◆ writeRandomStart()

bool writeRandomStart ( void * obj,
StringTableEntry pFieldName )
inlinestaticprotected

The documentation for this class was generated from the following files: