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

#include <ImageAsset_ScriptBinding.h>

Inherits AssetBase.

Public Member Functions

Boolean addExplicitCell (int cellOffsetX, int cellOffsetY, int cellWidth, int cellHeight, string cellName)
 
void addLayer (imageFile, position, blendColor, [doRedraw])
 
Boolean clearExplicitCells ()
 
void forceRedraw ()
 
String getBlendColor ()
 
Integer getCellCountX ()
 
Integer getCellCountY ()
 
Integer getCellHeight ()
 
Integer getCellOffsetX ()
 
Integer getCellOffsetY ()
 
Boolean getCellRowOrder ()
 
Integer getCellStrideX ()
 
Integer getCellStrideY ()
 
Integer getCellWidth ()
 
Integer getExplicitCellCount ()
 
Integer getExplicitCellHeight (cell)
 
Integer getExplicitCellIndex (cellName)
 
String getExplicitCellName (cell)
 
String getExplicitCellOffset (cell)
 
Integer getExplicitCellWidth (cell)
 
Boolean getExplicitMode ()
 
String getFilterMode ()
 
Boolean getForce16Bit ()
 
Integer getFrameCount ()
 
String getFrameSize (int frame)
 
String getImageFile ()
 
Integer getImageHeight ()
 
String getImageSize ()
 
Integer getImageWidth ()
 
Boolean getIsImagePOT ()
 
String getLayerBlendColor (index)
 
Integer getLayerCount ()
 
String getLayerImage (index)
 
String getLayerPosition (index)
 
String getRelativeImageFile ()
 
Boolean insertExplicitCell (int cellIndex, int cellOffsetX, int cellOffsetY, int cellWidth, int cellHeight, string cellName)
 
void insertLayer (index, imageFile, position, blendColor, [doRedraw])
 
void moveLayerBackward (index, [doRedraw])
 
void moveLayerForward (index, [doRedraw])
 
void moveLayerToBack (index, [doRedraw])
 
void moveLayerToFront (index, [doRedraw])
 
Boolean removeExplicitCell (int cellIndex)
 
void removeLayer (index, [doRedraw])
 
void setBlendColor (blendColor, [doRedraw])
 
void setCellCountX (countX)
 
void setCellCountY (countY)
 
void setCellHeight (Height)
 
void setCellOffsetX (offsetX)
 
void setCellOffsetY (offsetY)
 
void setCellRowOrder (rowOrder?)
 
void setCellStrideX (strideX)
 
void setCellStrideY (strideY)
 
void setCellWidth (Width)
 
Boolean setExplicitCell (int cellIndex, int cellOffsetX, int cellOffsetY, int cellWidth, int cellHeight, string cellName)
 
void setExplicitMode (explicitMode)
 
void setFilterMode (mode)
 
void setForce16Bit (force16Bit?)
 
void setImageFile (ImageFile)
 
void setLayerBlendColor (index, blendColor, [doRedraw])
 
void setLayerImage (index, image, [doRedraw])
 
void setLayerPosition (index, position, [doRedraw])
 
- Public Member Functions inherited from AssetBase
String getAssetId ()
 
void refreshAsset ()
 
- 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

◆ addExplicitCell()

Boolean addExplicitCell ( int  cellOffsetX,
int  cellOffsetY,
int  cellWidth,
int  cellHeight,
string  cellName 
)

Add an explicit cell.

Parameters
cellOffsetXThe offset in the X axis to the top-left of the cell.
cellOffsetYThe offset in the Y axis to the top-left of the cell.
cellWidthThe width of the cell.
cellHeightThe height of the cell.
cellNameThe name of the cell's region. The image asset must be in explicit mode for this operation to succeed.
Returns
Whether the operation was successful or not.

◆ addLayer()

void addLayer ( imageFile  ,
position  ,
blendColor   
)

Adds a layer to the ImageAsset

Parameters
imageFileThe file for the image to layer over the texture.
positionThe position for the layer to be at with (0, 0) in the top left corner.
blendColorThe blending color to be applied to this new layer.
doRedrawOptional value that prevents a redraw of the texture when false. Defaults to true.
Returns
No return value.

◆ clearExplicitCells()

Boolean clearExplicitCells ( )

Clears all explicit cells. The image asset stays in explicit mode however with no explicit cells a single full-frame cell becomes default.

Returns
Whether the operation was successful or not.

◆ forceRedraw()

void forceRedraw ( )

Forces the texture to redraw its layers. Redrawing can be expensive and is automatically done on every change to a layer unless prevented.

Returns
No return value.

◆ getBlendColor()

String getBlendColor ( )

Returns the blend color for the base texture when using layers.

Returns
(float red / float green / float blue / float alpha) The base blend color.

◆ getCellCountX()

Integer getCellCountX ( )

Gets the CELL count X.

Returns
The CELL count X.

◆ getCellCountY()

Integer getCellCountY ( )

Gets the CELL count Y.

Returns
The CELL count Y.

◆ getCellHeight()

Integer getCellHeight ( )

Gets the CELL height.

Returns
The CELL height.

◆ getCellOffsetX()

Integer getCellOffsetX ( )

Gets the CELL offset X.

Returns
The CELL offset X.

◆ getCellOffsetY()

Integer getCellOffsetY ( )

Gets the CELL offset Y.

Returns
The CELL offset Y.

◆ getCellRowOrder()

Boolean getCellRowOrder ( )

Gets whether CELL row order should be used or not.

Returns
Whether CELL row order should be used or not.

◆ getCellStrideX()

Integer getCellStrideX ( )

Gets the CELL stride X.

Returns
The CELL stride X.

◆ getCellStrideY()

Integer getCellStrideY ( )

Gets the CELL stride Y.

Returns
The CELL stride Y.

◆ getCellWidth()

Integer getCellWidth ( )

Gets the CELL width.

Returns
The CELL width.

◆ getExplicitCellCount()

Integer getExplicitCellCount ( )

Gets the explicit cell count.

Returns
The explicit cell count.

◆ getExplicitCellHeight()

Integer getExplicitCellHeight ( cell  )

Gets the CELL height in Explicit Mode.

Parameters
cellThe cell index or cell name to use to find the specific height.
Returns
The specified CELL height.

◆ getExplicitCellIndex()

Integer getExplicitCellIndex ( cellName  )

Gets the CELL index number in Explicit Mode.

Parameters
cellNameThe cell name to use to find the specific index.
Returns
The specified CELL index number or -1 if no such cell exists.

◆ getExplicitCellName()

String getExplicitCellName ( cell  )

Gets the CELL region name in Explicit Mode.

Parameters
cellThe cell index to use to find the specific name.
Returns
The specified CELL region name.

◆ getExplicitCellOffset()

String getExplicitCellOffset ( cell  )

Gets the CELL offset in Explicit Mode.

Parameters
cellThe cell index or cell name to use to find the specific offset.
Returns
The specified CELL width.

◆ getExplicitCellWidth()

Integer getExplicitCellWidth ( cell  )

Gets the CELL width in Explicit Mode.

Parameters
cellThe cell index or cell name to use to find the specific width.
Returns
The specified CELL width.

◆ getExplicitMode()

Boolean getExplicitMode ( )

Gets the status of Explicit mode

Returns
Returns true if ExplicitMode is on, false otherwise.

◆ getFilterMode()

String getFilterMode ( )

Gets the filter mode.

Returns
The filter mode.

◆ getForce16Bit()

Boolean getForce16Bit ( )

Gets whether 16-bit image is forced or not.

Returns
Whether 16-bit image is forced or not.

◆ getFrameCount()

Integer getFrameCount ( )

Gets the frame count.

Returns
The frame count.

◆ getFrameSize()

String getFrameSize ( int  frame)

Gets the specified frames size.

Parameters
frameThe frame number to use.
Returns
The specified frames size.

◆ getImageFile()

String getImageFile ( )

Gets the image file.

Returns
Returns the bitmap image file, typically as an absolute path.

◆ getImageHeight()

Integer getImageHeight ( )

Gets the image height.

Returns
The image width.

◆ getImageSize()

String getImageSize ( )

Gets the image size.

Returns
The image size.

◆ getImageWidth()

Integer getImageWidth ( )

Gets the image width.

Returns
The image width.

◆ getIsImagePOT()

Boolean getIsImagePOT ( )

Gets whether the image has a power-of-two dimensions or not.

Returns
Whether the image has a power-of-two dimensions or not.

◆ getLayerBlendColor()

String getLayerBlendColor ( index  )

Returns the blend color for a given layer.

Parameters
indexThe one-based index to move to the back. Must be less or equal to the number of layers.
Returns
(float red / float green / float blue / float alpha) The layer blend color.

◆ getLayerCount()

Integer getLayerCount ( )

Returns the number of layers.

Returns
The number of layers used by the texture. Zero if only the base texture is used.

◆ getLayerImage()

String getLayerImage ( index  )

Returns image used for a given layer.

Parameters
indexThe one-based index to move to the back. Must be less or equal to the number of layers.
Returns
The path to the image file.

◆ getLayerPosition()

String getLayerPosition ( index  )

Returns position for a given layer.

Parameters
indexThe one-based index to move to the back. Must be less or equal to the number of layers.
Returns
(int y, int x) The layer position.

◆ getRelativeImageFile()

String getRelativeImageFile ( )

Gets the image file.

Returns
Returns the bitmap image file as a path relative to the asset file.

◆ insertExplicitCell()

Boolean insertExplicitCell ( int  cellIndex,
int  cellOffsetX,
int  cellOffsetY,
int  cellWidth,
int  cellHeight,
string  cellName 
)

Insert an explicit cell at the specified index.

Parameters
cellIndexThe zero-based index to insert the cell. This will work when no cells are present. If the index is beyond the cell count then the cell is simply added.
cellOffsetXThe offset in the X axis to the top-left of the cell.
cellOffsetYThe offset in the Y axis to the top-left of the cell.
cellWidthThe width of the cell.
cellHeightThe height of the cell.
cellNameThe name of the cell's region. The image asset must be in explicit mode for this operation to succeed.
Returns
Whether the operation was successful or not.

◆ insertLayer()

void insertLayer ( index  ,
imageFile  ,
position  ,
blendColor   
)

Inserts a layer into the stack of layers on a texture at a given index.

Parameters
indexThe one-based index to insert the new layer at. Must be less or equal to the number of layers.
imageFileThe file for the image to layer over the texture.
positionThe position for the layer to be at with (0, 0) in the top left corner.
blendColorThe blending color to be applied to this new layer.
doRedrawOptional value that prevents a redraw of the texture when false. Defaults to true.
Returns
No return value.

◆ moveLayerBackward()

void moveLayerBackward ( index  )

Moves the layer at the index backward.

Parameters
indexThe one-based index to move backward. Must be less or equal to the number of layers.
doRedrawOptional value that prevents a redraw of the texture when false. Defaults to true.
Returns
No return value.

◆ moveLayerForward()

void moveLayerForward ( index  )

Moves the layer at the index forward.

Parameters
indexThe one-based index to move forward. Must be less or equal to the number of layers.
doRedrawOptional value that prevents a redraw of the texture when false. Defaults to true.
Returns
No return value.

◆ moveLayerToBack()

void moveLayerToBack ( index  )

Moves the layer at the index to the back.

Parameters
indexThe one-based index to move to the back. Must be less or equal to the number of layers.
doRedrawOptional value that prevents a redraw of the texture when false. Defaults to true.
Returns
No return value.

◆ moveLayerToFront()

void moveLayerToFront ( index  )

Moves the layer at the index to the front.

Parameters
indexThe one-based index to move to the front. Must be less or equal to the number of layers.
doRedrawOptional value that prevents a redraw of the texture when false. Defaults to true.
Returns
No return value.

◆ removeExplicitCell()

Boolean removeExplicitCell ( int  cellIndex)

Remove an explicit cell from the specified index.

Parameters
cellIndexThe zero-based index to remove the cell from.
Returns
Whether the operation was successful or not.

◆ removeLayer()

void removeLayer ( index  )

Removes a layer from a texture at a given index.

Parameters
indexThe one-based index to remove the new layer from. Must be less or equal to the number of layers.
doRedrawOptional value that prevents a redraw of the texture when false. Defaults to true.
Returns
No return value.

◆ setBlendColor()

void setBlendColor ( blendColor  )

Sets the blend color for the base image when using layers.

Parameters
blendColorThe space-deliminated color used to blend the layer. Requires four decimal values between 0 and 1 that represent red, green, blue, and alpha.
doRedrawOptional value that prevents a redraw of the texture when false. Defaults to true.
Returns
No return value.

◆ setCellCountX()

void setCellCountX ( countX  )

Sets the CELL count X.

Returns
No return value.

◆ setCellCountY()

void setCellCountY ( countY  )

Sets the CELL count Y.

Returns
No return value.

◆ setCellHeight()

void setCellHeight ( Height  )

Sets the CELL height.

Returns
No return value.

◆ setCellOffsetX()

void setCellOffsetX ( offsetX  )

Sets the CELL offset X.

Returns
No return value.

◆ setCellOffsetY()

void setCellOffsetY ( offsetY  )

Sets the CELL offset Y.

Returns
No return value.

◆ setCellRowOrder()

void setCellRowOrder ( rowOrder?  )

Sets whether CELL row order should be used or not.

Returns
No return value.

◆ setCellStrideX()

void setCellStrideX ( strideX  )

Sets the CELL stride X.

Returns
No return value.

◆ setCellStrideY()

void setCellStrideY ( strideY  )

Sets the CELL stride Y.

Returns
No return value.

◆ setCellWidth()

void setCellWidth ( Width  )

Sets the CELL width.

Returns
No return value.

◆ setExplicitCell()

Boolean setExplicitCell ( int  cellIndex,
int  cellOffsetX,
int  cellOffsetY,
int  cellWidth,
int  cellHeight,
string  cellName 
)

Set an explicit cell at the specified index.

Parameters
cellIndexThe zero-based index to set the cell.
cellOffsetXThe offset in the X axis to the top-left of the cell.
cellOffsetYThe offset in the Y axis to the top-left of the cell.
cellWidthThe width of the cell.
cellHeightThe height of the cell.
cellNameThe name of the cell's region. The image asset must be in explicit mode for this operation to succeed.
Returns
Whether the operation was successful or not.

◆ setExplicitMode()

void setExplicitMode ( explicitMode  )

Sets Explicit Mode

Parameters
explicitModeWhether to set Explicit Mode or disable it
Returns
No return value.

◆ setFilterMode()

void setFilterMode ( mode  )

Sets the filter mode.

Returns
No return value.

◆ setForce16Bit()

void setForce16Bit ( force16Bit?  )

Sets whether 16-bit image is forced or not.

Returns
No return value.

◆ setImageFile()

void setImageFile ( ImageFile  )

Sets the image file (bitmap file).

Returns
No return value.

◆ setLayerBlendColor()

void setLayerBlendColor ( index  ,
blendColor   
)

Sets the blend color for a layer at the given index.

Parameters
indexThe one-based index to move to the back. Must be less or equal to the number of layers.
blendColorThe space-deliminated color used to blend the layer. Requires four decimal values between 0 and 1 that represent red, green, blue, and alpha.
doRedrawOptional value that prevents a redraw of the texture when false. Defaults to true.
Returns
No return value.

◆ setLayerImage()

void setLayerImage ( index  ,
image   
)

Sets the image for a layer at the given index.

Parameters
indexThe one-based index to move to the back. Must be less or equal to the number of layers.
imageThe path to an image to be used by the layer.
doRedrawOptional value that prevents a redraw of the texture when false. Defaults to true.
Returns
No return value.

◆ setLayerPosition()

void setLayerPosition ( index  ,
position   
)

Sets the position for a layer at the given index.

Parameters
indexThe one-based index to move to the back. Must be less or equal to the number of layers.
positionThe space-deliminated (x, y) position to place the image with the top left corner as (0, 0). The layer can safely overflow the bounds of the original image.
doRedrawOptional value that prevents a redraw of the texture when false. Defaults to true.
Returns
No return value.