Harmony
Scripting Interface Documentation
PaletteList Class Reference

The JavaScript class providing informations about a palette list. Obtain from PaletteObjectManager methods like getPaletteListByElementId, getScenePaletteList or getPaletteListById. More...

Public Slots

String getPath ()
 Returns the folder in which this palette list is located. More...
 
bool isValid ()
 Returns whether the javascript wrapper refers to a valid object. More...
 
PalettegetPaletteByIndex (int index)
 Returns a Palette object for the palette at position 'index'. More...
 
PalettegetPaletteById (String id)
 Returns a Palette object for the palette with ID 'id'. More...
 
PalettegetPaletteById (String id, bool lookInLinkedPalettes)
 Returns a Palette object for the palette with ID 'id'. More...
 
bool getLock ()
 Try getting the database lock, returning true on success or false on failure. Without the lock, methods that change the state of the palette list can fail. More...
 
bool releaseLock ()
 Release the lock. More...
 
PalettecreatePalette (String &path)
 
PalettecreatePalette (String &path, int index)
 
PalettecreatePaletteAtLocation (int location, int elementId, String diskName)
 
PalettecreatePaletteAtLocation (int location, int elementId, String diskName, int index)
 
PaletteaddPalette (String &path)
 Adds a palette to the end of this palette list, returning a Palette object. More...
 
PaletteinsertPalette (String &path, int index)
 Adds a palette to this palette list at the position specified by 'index', returning a Palette object. More...
 
PaletteaddPaletteAtLocation (int location, int elementId, String &name)
 Adds a palette to the end of this palette list, returning a Palette object. More...
 
PaletteinsertPaletteAtLocation (int location, int elementId, String &name, int index)
 Adds a palette to this palette list at the position specified by 'index', returning a Palette object. More...
 
bool removePaletteByIndex (int index)
 Remove the palette at the position specified by 'index'. More...
 
bool removePaletteById (String id)
 Remove the palette with the specified palette ID. More...
 
bool removePalette (String &path)
 Remove the palette by path. More...
 
PalettefindPaletteOfColor (String &colorId)
 Search the given color ID and return the first match, also looking in the scene palette list if applicable. More...
 
bool movePaletteUp (String &id)
 Move the specified palette up one place in this palette list. More...
 
bool movePaletteDown (String &id)
 Move the specified palette down one place in this palette list. More...
 
bool isLoaded ()
 Was the palette list successfully loaded from disk (true or false)? More...
 

Properties

int numPalettes
 Number of palettes in this palette list. More...
 
String id
 The palette list ID of this palette list. More...
 
int type
 The type of palette list. One of the PaletteListType constants. More...
 
int elementId
 Will return the elementId of this palette list if the type is PaletteListType.Element will return -1 if the type is PaletteListType.Scene. More...
 

Detailed Description

The JavaScript class providing informations about a palette list. Obtain from PaletteObjectManager methods like getPaletteListByElementId, getScenePaletteList or getPaletteListById.

Defines a collection of palettes.

Provides access to some of the standard functionality of palette lists. Some methods change the state of the palette list. If the database access lock cannot be obtained, they will throw a javascript exception.

Member Function Documentation

◆ addPalette

Palette* PaletteList::addPalette ( String &  path)
slot

Adds a palette to the end of this palette list, returning a Palette object.

Parameters
pathPath to existing palette file
Note
Adding a palette in a palette list of type PaletteListType.Hidden is not allowed and will return an invalid palette.

◆ addPaletteAtLocation

Palette* PaletteList::addPaletteAtLocation ( int  location,
int  elementId,
String &  name 
)
slot

Adds a palette to the end of this palette list, returning a Palette object.

Parameters
locationOne of the valid PaletteLocation constants in that context. Any value except PaletteLocation.EXTERNAL.
elementIdThe element ID if location is PaletteLocation.ELEMENT. Ignored in other cases.
nameThe disk name of the palette.
Note
Adding a palette in a palette list of type PaletteListType.Hidden is not allowed and will return an invalid palette.

◆ createPalette [1/2]

Palette* PaletteList::createPalette ( String &  path)
slot

Create a new palette from a path String. If the file indicated by path already exists, it will append a number to the path to create a unique name.

◆ createPalette [2/2]

Palette* PaletteList::createPalette ( String &  path,
int  index 
)
slot

Create a palette from a path String, inserted at position Index If the file indicated by path already exists, it will append a number to the path to create a unique name.

◆ createPaletteAtLocation [1/2]

Palette* PaletteList::createPaletteAtLocation ( int  location,
int  elementId,
String  diskName 
)
slot

Create Palette at a physical location relative to the project. If the location is not in an element, the parameter element ID is ignored.

◆ createPaletteAtLocation [2/2]

Palette* PaletteList::createPaletteAtLocation ( int  location,
int  elementId,
String  diskName,
int  index 
)
slot

Create Palette at a physical location relative to the project, inserted at index in the paletteList. If the location is not in an element, the parameter element ID is ignored.

◆ findPaletteOfColor

Palette* PaletteList::findPaletteOfColor ( String &  colorId)
slot

Search the given color ID and return the first match, also looking in the scene palette list if applicable.

Parameters
colorIdThe color ID to search
Returns
The palette where the color will be found

◆ getLock

bool PaletteList::getLock ( )
slot

Try getting the database lock, returning true on success or false on failure. Without the lock, methods that change the state of the palette list can fail.

◆ getPaletteById [1/2]

Palette* PaletteList::getPaletteById ( String  id)
slot

Returns a Palette object for the palette with ID 'id'.

Parameters
idpalette ID of palette in this palette list

◆ getPaletteById [2/2]

Palette* PaletteList::getPaletteById ( String  id,
bool  lookInLinkedPalettes 
)
slot

Returns a Palette object for the palette with ID 'id'.

Parameters
idpalette ID of palette in this palette list
lookInLinkedPaletteswhether to look in other accessible palettes, typically the scene palette List when searching from an element palette list

◆ getPaletteByIndex

Palette* PaletteList::getPaletteByIndex ( int  index)
slot

Returns a Palette object for the palette at position 'index'.

Parameters
indexindex of palette in this palette list

◆ getPath

String PaletteList::getPath ( )
slot

Returns the folder in which this palette list is located.

◆ insertPalette

Palette* PaletteList::insertPalette ( String &  path,
int  index 
)
slot

Adds a palette to this palette list at the position specified by 'index', returning a Palette object.

Parameters
pathPath to existing palette file
indexThe index of the position where the palette is inserted.
Note
Inserting palette in a palette list of type PaletteListType.Hidden is not allowed and will return an invalid palette.

◆ insertPaletteAtLocation

Palette* PaletteList::insertPaletteAtLocation ( int  location,
int  elementId,
String &  name,
int  index 
)
slot

Adds a palette to this palette list at the position specified by 'index', returning a Palette object.

Parameters
locationOne of the valid PaletteLocation constants in that context. Any value except PaletteLocation.EXTERNAL.
elementIdThe element ID if location is PaletteLocation.ELEMENT. Ignored in other cases.
namePath to existing palette file
indexThe index of the position where the palette is inserted.
Note
Inserting palette in a palette list of type PaletteListType.Hidden is not allowed and will return an invalid palette.

◆ isLoaded

bool PaletteList::isLoaded ( )
slot

Was the palette list successfully loaded from disk (true or false)?

◆ isValid

bool PaletteList::isValid ( )
slot

Returns whether the javascript wrapper refers to a valid object.

◆ movePaletteDown

bool PaletteList::movePaletteDown ( String &  id)
slot

Move the specified palette down one place in this palette list.

Parameters
idID of the palette to move

◆ movePaletteUp

bool PaletteList::movePaletteUp ( String &  id)
slot

Move the specified palette up one place in this palette list.

Parameters
idID of the palette to move

◆ releaseLock

bool PaletteList::releaseLock ( )
slot

Release the lock.

◆ removePalette

bool PaletteList::removePalette ( String &  path)
slot

Remove the palette by path.

Parameters
paththe path of the palette to remove.

◆ removePaletteById

bool PaletteList::removePaletteById ( String  id)
slot

Remove the palette with the specified palette ID.

Parameters
idID of the palette to remove

◆ removePaletteByIndex

bool PaletteList::removePaletteByIndex ( int  index)
slot

Remove the palette at the position specified by 'index'.

Parameters
indexindex of palette to remove

Property Documentation

◆ elementId

int PaletteList::elementId
read

Will return the elementId of this palette list if the type is PaletteListType.Element will return -1 if the type is PaletteListType.Scene.

◆ id

String PaletteList::id
read

The palette list ID of this palette list.

◆ numPalettes

int PaletteList::numPalettes
read

Number of palettes in this palette list.

◆ type

int PaletteList::type
read

The type of palette list. One of the PaletteListType constants.