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...
 
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...
 
void setSelectedPalettePath (int index, String &path)
 Sets the full path (including name and extension) of the palette to which the selected colour belongs. 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.

◆ clearPalettes

void ColorOverride::clearPalettes ( )
slot

Clear the list of whole palette overrides.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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) );

◆ 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.

◆ setSelectedPalettePath

void 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.