![]() |
Represents and provides the methods for a Palette in a project.
Behaves as a container list for Palette colour object types.
Palettes are referenced by ID and are accessible through the OMC::PaletteList object.
f
A Simple Example - Creating a new Palette in the project's PaletteList and adding a colour and a texture.
Public Member Functions | |
OMC::PaletteList * | palette_list () |
Gets the parent PaletteList, or throws error if currently parentless. More... | |
OMC::Element * | element () |
Retrieves the element object that owns the Palette, if the Palette is stored in an element. More... | |
void | lock () |
Try to obtain the database lock. The lock will be held until it is released in script or the ui. Safe to call multiple time to get the lock state. Throws error if unsuccessful. More... | |
void | release () |
Try to release the database lock. Release access to the Palette. Other users will be able to obtain the access rights to the Palette. Throws error if unsuccessful. More... | |
OMC::PaletteColour * | create_solid_colour (QString name, QVariant colourData=QVariant(), int index=-1) |
Create a new solid colour of a given type. More... | |
OMC::PaletteColour * | create_linear_gradient_colour (QString name=QString(), QVariant startColourData=QVariant(), float startPercentage=0.0f, QVariant endColourData=QVariant(), float endPercentage=100.0f, int index=-1) |
Create a new colour with linear gradient of a given type. More... | |
OMC::PaletteColour * | create_radial_gradient_colour (QString name=QString(), QVariant startColourData=QVariant(), float startPercentage=0.0f, QVariant endColourData=QVariant(), float endPercentage=100.0f, int index=-1) |
Create a new colour with radial gradient of a given type. More... | |
OMC::PaletteTexture * | create_texture (QString filePath, QString name=QString(), int index=-1, bool tiled=false) |
Create a new texture colour object. More... | |
OMC::PaletteBaseColour * | insert (OMC::PaletteBaseColour *colour, int index, bool duplicate=false) |
Inserts an existing colour object to this Palette. If the pallete ID already exists on the list, it will requeire the moveType argument to be specified as "Clone" or "Duplicate". More... | |
OMC::PaletteBaseColour * | append (OMC::PaletteBaseColour *colour, bool duplicate=false) |
Appends an existing colour object to the back of this Palette. If the pallete ID already exists on the list, it will require the duplicate paremeter to be true". More... | |
OMC::PaletteBaseColour * | pop (int index) |
Pops given index colour from the Palette. More... | |
void | remove (OMC::PaletteBaseColour *colour) |
Removes colour from the Palette. Throws error if unsuccessful. More... | |
void | reorder (OMC::PaletteBaseColour *colour, int index) |
Reorders the internal list by moving a the specified Palette id to the given index. Throws error if unsuccessful. More... | |
void | clear () |
Removes and deletes all colour objects from the Palette. Throws an error if failed to remove the colour. More... | |
void | acquire (OMC::PaletteBaseColour *colorObj) |
Move a color to this Palette. Will remove the colour from its original Palette and move it to this one. Throws error if unsuccessful, e.g. if the colour is invalid or if this is the same Palette as the current PaletteBaseColour. If this Palette has a colour with the same colour ID as the source colour, it will return false also. More... | |
Array [QString] | colour_names () |
Lists the Palette colours and/or textures names. More... | |
bool | contains (PaletteBaseColour *item) |
Identifies if the list contains the colour. More... | |
Array [OMC::PaletteBaseColour *] | list () |
Converts the dynamic list into a concrete list of PaletteBaseColour objects. More... | |
Public Attributes | |
QString | path |
The path to the palette file, containing this palette, in system. More... | |
QString | name |
The name of this Palette. The extension (".plt") is not included. More... | |
bool | valid |
True if the Palette object is valid. More... | |
bool | loaded |
True if the Palette was successfully loaded from the disk. More... | |
bool | found |
True if the Palette was found at the location specified by the path and name. More... | |
QString | type |
The type of the Palette, can be used to change the Palette type if it can be converted. More... | |
bool | locked |
Whether the Palette is currently locally locked by the session, and can be modified. More... | |
QString | id |
The ID of this Palette. More... | |
QString | location |
The storage location of this Palette (e.g. Environment, Job, Scene, Element, External). More... | |
int | element_id |
The element id in which the Palette is stored if location is ELEMENT. Returns None if the Palette is not stored in an element. More... | |
OMC::PaletteBaseColour * | operator[int index] |
Provides the PaletteBaseColour object at the given index. More... | |
void OMC::Palette::acquire | ( | OMC::PaletteBaseColour * | colorObj | ) |
Move a color to this Palette. Will remove the colour from its original Palette and move it to this one. Throws error if unsuccessful, e.g. if the colour is invalid or if this is the same Palette as the current PaletteBaseColour. If this Palette has a colour with the same colour ID as the source colour, it will return false also.
Example:
OMC::PaletteBaseColour* OMC::Palette::append | ( | OMC::PaletteBaseColour * | colour, |
bool | duplicate = false |
||
) |
Appends an existing colour object to the back of this Palette. If the pallete ID already exists on the list, it will require the duplicate paremeter to be true".
Example:
void OMC::Palette::clear | ( | ) |
Removes and deletes all colour objects from the Palette. Throws an error if failed to remove the colour.
Example:
Array [QString] OMC::Palette::colour_names | ( | ) |
Lists the Palette colours and/or textures names.
Example:
bool OMC::Palette::contains | ( | PaletteBaseColour * | item | ) |
Identifies if the list contains the colour.
Examplified in acquire().
OMC::PaletteColour* OMC::Palette::create_linear_gradient_colour | ( | QString | name = QString() , |
QVariant | startColourData = QVariant() , |
||
float | startPercentage = 0.0f , |
||
QVariant | endColourData = QVariant() , |
||
float | endPercentage = 100.0f , |
||
int | index = -1 |
||
) |
Create a new colour with linear gradient of a given type.
Example:
OMC::PaletteColour* OMC::Palette::create_radial_gradient_colour | ( | QString | name = QString() , |
QVariant | startColourData = QVariant() , |
||
float | startPercentage = 0.0f , |
||
QVariant | endColourData = QVariant() , |
||
float | endPercentage = 100.0f , |
||
int | index = -1 |
||
) |
Create a new colour with radial gradient of a given type.
Examplified in create_linear_gradient_colour() method. Where 'create_linear_gradient_colour()' becomes 'create_radial_gradient_colour()'.
OMC::PaletteColour* OMC::Palette::create_solid_colour | ( | QString | name, |
QVariant | colourData = QVariant() , |
||
int | index = -1 |
||
) |
Create a new solid colour of a given type.
Example:
OMC::PaletteTexture* OMC::Palette::create_texture | ( | QString | filePath, |
QString | name = QString() , |
||
int | index = -1 , |
||
bool | tiled = false |
||
) |
Create a new texture colour object.
Example:
OMC::Element* OMC::Palette::element | ( | ) |
Retrieves the element object that owns the Palette, if the Palette is stored in an element.
Example:
OMC::PaletteBaseColour* OMC::Palette::insert | ( | OMC::PaletteBaseColour * | colour, |
int | index, | ||
bool | duplicate = false |
||
) |
Inserts an existing colour object to this Palette. If the pallete ID already exists on the list, it will requeire the moveType argument to be specified as "Clone" or "Duplicate".
Example:
Array [OMC::PaletteBaseColour*] OMC::Palette::list | ( | ) |
Converts the dynamic list into a concrete list of PaletteBaseColour objects.
void OMC::Palette::lock | ( | ) |
Try to obtain the database lock. The lock will be held until it is released in script or the ui. Safe to call multiple time to get the lock state. Throws error if unsuccessful.
Example:
OMC::PaletteList* OMC::Palette::palette_list | ( | ) |
Gets the parent PaletteList, or throws error if currently parentless.
OMC::PaletteBaseColour* OMC::Palette::pop | ( | int | index | ) |
Pops given index colour from the Palette.
Example:
void OMC::Palette::release | ( | ) |
void OMC::Palette::remove | ( | OMC::PaletteBaseColour * | colour | ) |
Removes colour from the Palette. Throws error if unsuccessful.
Example:
void OMC::Palette::reorder | ( | OMC::PaletteBaseColour * | colour, |
int | index | ||
) |
Reorders the internal list by moving a the specified Palette id to the given index. Throws error if unsuccessful.
Example:
|
read |
|
read |
True if the Palette was found at the location specified by the path and name.
|
read |
The ID of this Palette.
|
read |
True if the Palette was successfully loaded from the disk.
|
read |
|
read |
Whether the Palette is currently locally locked by the session, and can be modified.
|
readwrite |
The name of this Palette. The extension (".plt") is not included.
OMC::PaletteBaseColour* OMC::Palette::operator[int index] |
Provides the PaletteBaseColour object at the given index.
Example:
|
read |
The path to the palette file, containing this palette, in system.
|
readwrite |
|
read |
True if the Palette object is valid.