ColorOverride Class Reference

The JavaScript class for manipulating colour override nodes. Created from the node global object. More...

Public Slots

Whole Palette Overrides.
int getNumPalettes ()
 Returns the number of whole palette overrides. More...
 
String palettePath (int index)
 Returns the full path (including name and extension) of the palette override at postion 'index'. More...
 
void setPalettePath (int index, String &path)
 Set the path (including name and extension) of the palette at position 'index'. More...
 
void clearPalettes ()
 Clear the list of whole palette overrides. More...
 
void addPalette (String &path)
 Add a full palette path at the bottom of the list of whole palette overrides. More...
 
void removePalette (String &path)
 Remove a palette with the supplied path from the list of whole palette overrides. More...
 
Individual Color Overrides.
int getNumColorOverrides ()
 Returns the number of individual colour overrides. More...
 
int addColorOverride (String &palettePath, String &colorId, QObject newValue, String &mode, String &texture=String())
 Add an Individual Color Override with a specific mode, colour and texture filename. More...
 
bool removeColorOverride (int idx)
 Removes a specific color override at the given index. More...
 
bool setOverridePaletteId (int index, String &paletteId)
 Change the paletteId of a color override entry on a node. More...
 
String getOverridePaletteId (int index)
 Get the paletteId of a color override entry on a node. More...
 
bool setOverrideMode (int index, String &mode)
 Change the override mode of a color override entry on a node. More...
 
String getOverrideMode (int index)
 Get the override mode of a color override entry on a node. More...
 
bool setOverrideColor (int index, QObject newValue)
 Change the override color of a color override entry on a node. More...
 
ColorRGBA getOverrideColor (int index)
 Get the override color of a color override entry on a node. More...
 
bool setOverrideColorId (int index, String colorId)
 Change the color id of a color to override in a color override entry on a node. More...
 
String getOverrideColorId (int index)
 Get the color id of a color to override in a color override entry on a node. More...
 
bool setOverrideColorName (int index, String name)
 Set the color name of a color override entry on a node. More...
 
String getOverrideColorName (int index)
 Get the color name of a color to override in a color override entry on a node. More...
 
String getOverrideTexturePath (int index)
 Returns the path of a texture file for the colour override at the specified position in the list. More...
 
void setOverrideTexturePath (int index, String &path)
 Sets the path of a texture file for the colour override at the specified position in the list. More...
 
String getOverridePalettePath (int index)
 Returns the full path (including name and extension) of the palette to which the override colour belongs. More...
 
void setOverridePalettePath (int index, String &path)
 Sets the full path (including name and extension) of the palette to which the override colour belongs. More...
 
Render Selected Colours Only.
int getNumSelectedColors ()
 Returns the number of selected colours. More...
 
String getSelectedPalettePath (int index)
 Returns the full path (including name and extension) of the palette to which the selected colour belongs. More...
 
bool setSelectedPalettePath (int index, String &path)
 Sets the full path (including name and extension) of the palette to which the selected colour belongs. More...
 
bool addSelectedColor (String &path, String &colorId)
 Creates a new Selected Colours Entry. Adds the entry to the back of the list of selected colors. More...
 
bool removeSelectedColor (int index)
 Removes a Selected Colours Entry at the given index. More...
 
bool setSelectedColorId (int index, String id)
 Sets the ID of a selected colour at a given index. More...
 
String getSelectedColorId (int index)
 Gets the ID of a selected colour at a given index. More...
 
bool setSelectedColorName (int index, String name)
 Sets the name of a selected colour at a given index. More...
 
String getSelectedColorName (int index)
 Gets the name of a selected colour at a given index. More...
 
void setTraverseMatte (bool traverseMatte)
 Sets the matte traversal behaviour of the node. More...
 
bool getTraverseMatte ()
 Gets the matte traversal behaviour of the node. More...
 
bool setSelectedColorMode (String selectedMode)
 Sets the selected colour behaviour of the colour override node. More...
 
String getSelectedColorMode ()
 Gets the selected colour mode of the colour override node. More...
 
bool fromXML (String xml)
 Sets the XML for the Color Override attribute. More...
 
String toXML ()
 Gets the XML for the Color Override attribute. More...
 

Detailed Description

The JavaScript class for manipulating colour override nodes. Created from the node global object.

Used to get information about palettes associated to a colour override node, or to add or remove a palette from the node.

var myColorOverride = node.getColorOverride("Top/MyColorOverrideNode");

Member Function Documentation

◆ addColorOverride

int ColorOverride::addColorOverride ( String &  palettePath,
String &  colorId,
QObject  newValue,
String &  mode,
String &  texture = String() 
)
slot

Add an Individual Color Override with a specific mode, colour and texture filename.

Parameters
palettePath: The palette path for the color to override.
paletteId: The palette ID of the color to override.
newValue: The new colour value to which the id is overridden – defined as a ColorRGBA object.
mode: The string that defines the color override mode.
texture: The file path for the texture.
Returns
Returns the index of the newly created colour override.

Valid types include the following: RGB,
ALPHA,
RGBA,
TEXTURE, TEX_GLOBAL_BBOX, TEX_GLOBAL_BBOX_CENTRE, TEX_LOCAL_BBOX, TEX_SCREEN, TEX_PENCIL_RGBA, TEX_PENCIL_RGBA_COMBINE_MATRIX, TEX_PENCIL_MATRIX, TEX_PENCIL_COMBINE_MATRIX, TEXTURE_DYNAMIC_CENTERING, TEXTURE_REPLACE_MATRIX, TEXTURE_COMBINE_MATRIX, TEX_PEG, TEX_DYNAMIC

var myColorOverride = node.getColorOverride("Top/MyColorOverrideNode");
myColorOverride.addColorOverride( "palette-library/ScenePalette.plt", "0b5482a850701084", new ColorRGBA(255,255,255, 255), "RGBA", "" );

An example of creating and extending a Colour-Override node.

function randomColourOverride()
{
MessageLog.trace( "START" );
scene.beginUndoRedoAccum( "Random Colour Override" );
var curPalobj = PaletteObjectManager.getPalette( curPal );
if( !curPalobj )
{
MessageLog.trace( "No palette selected." );
return;
}
var newColorOverride = node.add( "Top", "RANDOM_COLOUR_OVERRIDE", "COLOR_OVERRIDE_TVG", 0, 0, 0);
if( !newColorOverride )
{
MessageLog.trace( "Failed to create a palette override." );
return;
}
myColorOverride = node.getColorOverride(newColorOverride);
var colPath = curPalobj.getPath() + "/" + curPalobj.getName() + ".plt";
var scenePath = scene.currentProjectPath();
if( colPath.slice( 0, scenePath.length ) == scenePath )
colPath = colPath.slice(scenePath.length+1);
for( var n=0; n<curPalobj.nColors; n++ )
{
var col = curPalobj.getColorByIndex( n );
MessageLog.trace( "Adding Palette Color: " + col.name );
var newIdx = myColorOverride.addColorOverride( colPath, col.id,
new ColorRGBA( Math.floor(Math.random() * 256), Math.floor(Math.random() * 256), Math.floor(Math.random() * 256), Math.floor(Math.random() * 256)),
"RGBA", "" );
}
}

◆ addPalette

void ColorOverride::addPalette ( String &  path)
slot

Add a full palette path at the bottom of the list of whole palette overrides.

Parameters
path: Path of this new palette override.

◆ addSelectedColor

bool ColorOverride::addSelectedColor ( String &  path,
String &  colorId 
)
slot

Creates a new Selected Colours Entry. Adds the entry to the back of the list of selected colors.

Parameters
path: The full path to the palette.
path: The color id of the color to override.
Returns
True if the command was successful.

◆ clearPalettes

void ColorOverride::clearPalettes ( )
slot

Clear the list of whole palette overrides.

◆ fromXML

bool ColorOverride::fromXML ( String  xml)
slot

Sets the XML for the Color Override attribute.

Parameters
xml: A string containing the XML for the attribute values of the node.
Returns
True if the command was successful.

◆ getNumColorOverrides

int ColorOverride::getNumColorOverrides ( )
slot

Returns the number of individual colour overrides.

Returns
Returns the number of individual colour overrides.

◆ getNumPalettes

int ColorOverride::getNumPalettes ( )
slot

Returns the number of whole palette overrides.

◆ getNumSelectedColors

int ColorOverride::getNumSelectedColors ( )
slot

Returns the number of selected colours.

Returns
Returns the number of selected colours.

◆ getOverrideColor

ColorRGBA ColorOverride::getOverrideColor ( int  index)
slot

Get the override color of a color override entry on a node.

Parameters
index: The index of the color override in the node's color override list.
Returns
Returns the color used to define the color override mode of the given entry.

◆ getOverrideColorId

String ColorOverride::getOverrideColorId ( int  index)
slot

Get the color id of a color to override in a color override entry on a node.

Parameters
index: The index of the color override in the node's color override list.
Returns
Returns the ID of the color to override.

◆ getOverrideColorName

String ColorOverride::getOverrideColorName ( int  index)
slot

Get the color name of a color to override in a color override entry on a node.

Parameters
index: The index of the color override in the node's color override list.
Returns
Returns the name of the color to override.

◆ getOverrideMode

String ColorOverride::getOverrideMode ( int  index)
slot

Get the override mode of a color override entry on a node.

Parameters
index: The index of the color override in the node's color override list.
Returns
Returns the string used to define the color override mode of the given entry.

◆ getOverridePaletteId

String ColorOverride::getOverridePaletteId ( int  index)
slot

Get the paletteId of a color override entry on a node.

Parameters
index: The index of the color override in the node's color override list.
Returns
Returns the string used to define the color override mode of the given entry.

◆ getOverridePalettePath

String ColorOverride::getOverridePalettePath ( int  index)
slot

Returns the full path (including name and extension) of the palette to which the override colour belongs.

Parameters
index: Index in the list of individual colour overrides.
Returns
Returns the full path (including name and extension) of the palette to which the override colour belongs.

◆ getOverrideTexturePath

String ColorOverride::getOverrideTexturePath ( int  index)
slot

Returns the path of a texture file for the colour override at the specified position in the list.

Parameters
index: Index in the list of individual colour overrides. Applies for one of the modes that references a texture.
Returns
Returns the path of a texture file for the colour override at the specified position in the list.

◆ getSelectedColorId

String ColorOverride::getSelectedColorId ( int  index)
slot

Gets the ID of a selected colour at a given index.

Parameters
index: Index in the list of selected colours.
Returns
Returns the ID of the selected colour.

◆ getSelectedColorMode

String ColorOverride::getSelectedColorMode ( )
slot

Gets the selected colour mode of the colour override node.

Returns
Returns the IDbehaviour for the selected colours.

The accepted colour behavior are as follows: -RenderAll -RenderSelectedColors -RenderSelectedColorsAndBitmaps

◆ getSelectedColorName

String ColorOverride::getSelectedColorName ( int  index)
slot

Gets the name of a selected colour at a given index.

Parameters
index: Index in the list of selected colours.
Returns
Returns the name of the selected colour.

◆ getSelectedPalettePath

String ColorOverride::getSelectedPalettePath ( int  index)
slot

Returns the full path (including name and extension) of the palette to which the selected colour belongs.

Parameters
index: Index in the list of selected colours.
Returns
Returns the full path (including name and extension) of the palette to which the selected colour belongs.

◆ getTraverseMatte

bool ColorOverride::getTraverseMatte ( )
slot

Gets the matte traversal behaviour of the node.

Returns
Returns true if the colour override is to traverse mattes.

◆ palettePath

String ColorOverride::palettePath ( int  index)
slot

Returns the full path (including name and extension) of the palette override at postion 'index'.

Parameters
index: Index of the palette in the list of palette overrides.

◆ removeColorOverride

bool ColorOverride::removeColorOverride ( int  idx)
slot

Removes a specific color override at the given index.

Parameters
index: The color override entry to remove from the node.
Returns
Returns true if the color override entry was successfully removed.

◆ removePalette

void ColorOverride::removePalette ( String &  path)
slot

Remove a palette with the supplied path from the list of whole palette overrides.

Parameters
path: Path of this palette to remove.

◆ removeSelectedColor

bool ColorOverride::removeSelectedColor ( int  index)
slot

Removes a Selected Colours Entry at the given index.

Parameters
index: Index in the list of selected colours.
Returns
True if the command was successful.

◆ setOverrideColor

bool ColorOverride::setOverrideColor ( int  index,
QObject  newValue 
)
slot

Change the override color of a color override entry on a node.

Parameters
index: The index of the color override in the node's color override list.
color: The new colour value to which the id is overridden – defined as a SCR_ColorRGBA object.
Returns
Returns true if the color override color has been set appropriately.
var myColorOverride = node.getColorOverride("Top/MyColorOverrideNode");
myColorOverride.setOverrideColor( 0, new ColorRGBA(255, 0, 0, 255) );

◆ setOverrideColorId

bool ColorOverride::setOverrideColorId ( int  index,
String  colorId 
)
slot

Change the color id of a color to override in a color override entry on a node.

Parameters
index: The index of the color override in the node's color override list.
colorId: The color id of the color to override.
  • var myColorOverride = node.getColorOverride("Top/MyColorOverrideNode");
    myColorOverride.setOverrideColorId( 0, "0b5482a850701084" );

◆ setOverrideColorName

bool ColorOverride::setOverrideColorName ( int  index,
String  name 
)
slot

Set the color name of a color override entry on a node.

Parameters
index: The index of the color override in the node's color override list.
colorName: The new color name.

◆ setOverrideMode

bool ColorOverride::setOverrideMode ( int  index,
String &  mode 
)
slot

Change the override mode of a color override entry on a node.

Parameters
index: The index of the color override in the node's color override list.
mode: The mode for the color override type.

Valid types include the following: RGB, ALPHA, RGBA, TEXTURE, TEX_GLOBAL_BBOX, TEX_GLOBAL_BBOX_CENTRE, TEX_LOCAL_BBOX, TEX_SCREEN, TEX_PENCIL_RGBA, TEX_PENCIL_RGBA_COMBINE_MATRIX, TEX_PENCIL_MATRIX, TEX_PENCIL_COMBINE_MATRIX, TEXTURE_DYNAMIC_CENTERING, TEXTURE_REPLACE_MATRIX, TEXTURE_COMBINE_MATRIX, TEX_PEG, TEX_DYNAMIC

var myColorOverride = node.getColorOverride("Top/MyColorOverrideNode");
myColorOverride.setOverrideMode( 0, "RGBA" );
Returns
Returns true if the color override mode has been set appropriately.

◆ setOverridePaletteId

bool ColorOverride::setOverridePaletteId ( int  index,
String &  paletteId 
)
slot

Change the paletteId of a color override entry on a node.

Parameters
index: The index of the color override in the node's color override list.
paletteId: The palette ID of the color to override.
Returns
Returns true if the color override mode has been set appropriately.

◆ setOverridePalettePath

void ColorOverride::setOverridePalettePath ( int  index,
String &  path 
)
slot

Sets the full path (including name and extension) of the palette to which the override colour belongs.

Parameters
index: Index in the list of individual colour overrides.
path: New path for the palette.

◆ setOverrideTexturePath

void ColorOverride::setOverrideTexturePath ( int  index,
String &  path 
)
slot

Sets the path of a texture file for the colour override at the specified position in the list.

Parameters
index: Index in the list of individual colour overrides.
path: Texture path.

Applies for one of the modes that references a texture.

◆ setPalettePath

void ColorOverride::setPalettePath ( int  index,
String &  path 
)
slot

Set the path (including name and extension) of the palette at position 'index'.

Parameters
index: Index of the palette in the list of palette overrides.
path: New path of this palette override.

◆ setSelectedColorId

bool ColorOverride::setSelectedColorId ( int  index,
String  id 
)
slot

Sets the ID of a selected colour at a given index.

Parameters
index: Index in the list of selected colours.
id: The new palette colour ID to assign to the selected colour.
Returns
True if the command was successful.

◆ setSelectedColorMode

bool ColorOverride::setSelectedColorMode ( String  selectedMode)
slot

Sets the selected colour behaviour of the colour override node.

Parameters
selectedBehaviour: The behaviour for the selected colours. The accepted colour behavior are as follows: -RenderAll -RenderSelectedColors -RenderSelectedColorsAndBitmap
Returns
True if the command was successful.

◆ setSelectedColorName

bool ColorOverride::setSelectedColorName ( int  index,
String  name 
)
slot

Sets the name of a selected colour at a given index.

Parameters
index: Index in the list of selected colours.
name: The new palette colour name to assign to the selected colour.
Returns
True if the command was successful.

◆ setSelectedPalettePath

bool ColorOverride::setSelectedPalettePath ( int  index,
String &  path 
)
slot

Sets the full path (including name and extension) of the palette to which the selected colour belongs.

Parameters
index: Index in the list of selected colours.
path: New path for the palette.
Returns
True if the command was successful.

◆ setTraverseMatte

void ColorOverride::setTraverseMatte ( bool  traverseMatte)
slot

Sets the matte traversal behaviour of the node.

Parameters
traverseMatteWhether the Colour Override should traverse the matte ports.

◆ toXML

String ColorOverride::toXML ( )
slot

Gets the XML for the Color Override attribute.

Returns
The XML of the Color override attribute.