The scene JavaScript global object. Retrieve and set global scene attributes, like the aspect ratio of the cells in the scene grid. More...
Public Slots | |
int | currentVersion () |
Returns the ID of the current version. More... | |
String | currentVersionName () |
Returns the name or the number of the current scene version. More... | |
String | currentEnvironment () |
Returns the name of the current environment. More... | |
String | currentEnvironmentPath () |
Returns the path of the current environment. More... | |
String | currentJob () |
Returns the name of the current job. More... | |
String | currentJobPath () |
Returns the path of the current job. More... | |
String | currentScene () |
Returns the name of the current scene. More... | |
String | currentProjectPath () |
Returns the current project path. More... | |
String | currentProjectPathRemapped () |
For windows, returns the remapped path. More... | |
String | tempProjectPath () |
Returns the temporary project path. More... | |
String | tempProjectPathRemapped () |
For windows, returns the remapped temporary project path. More... | |
Undo / Redo | |
Functions will generate only one Undo/Redo entry if sandwiched by these two functions. | |
void | beginUndoRedoAccum (String commandName) |
This function starts the accumulation of all of the functions between it and the endUndoRedoAccum function as one command that will appear in the undo/redo list. If you do not use this function with endUndoRedoAccum, each function in the script generates a separate undo/redo entry. More... | |
void | endUndoRedoAccum () |
This function ends the accumulation all of the functions between it and the beginUndoRedoAccum function as one command that will appear in the undo/redo list. If you do not use this function with beginUndoRedoAccum, each function in the script generates a separate undo/redo entry. More... | |
void | cancelUndoRedoAccum () |
This function cancels the accumulation of undo/redo commands. No command will be added to the undo/redo list and all commands that have already been executed will be rolled-back (undone). More... | |
void | undo (int depth=1) |
Undoes the last n operations. If n is not specified, it will be 1. More... | |
void | redo (int depth=1) |
Redoes the last n operations. If n is not specified, it will be 1. More... | |
void | clearHistory () |
Clears the command history. More... | |
Global Scene Data. | |
double | unitsAspectRatioX () |
Returns the X value of the aspect ratio of the cells in the scene grid. More... | |
double | unitsAspectRatioY () |
Returns the Y value of the aspect ratio of the cells in the scene grid. More... | |
int | numberOfUnitsX () |
Returns the number of units in the X axis of the scene grid. More... | |
int | numberOfUnitsY () |
Returns the number of units in the Y axis of the scene grid. More... | |
int | numberOfUnitsZ () |
Returns the number of units in the Z axis of the scene grid. More... | |
int | coordAtCenterX () |
Returns the X value of the centre coordinate of the scene grid. More... | |
int | coordAtCenterY () |
Returns the Y value of the centre coordinate of the scene grid. More... | |
int | currentResolutionX () |
Returns the X value of the current preview resolution. More... | |
int | currentResolutionY () |
Returns the Y value of the current preview resolution. More... | |
String | defaultResolutionName () |
Returns the default resolution name. More... | |
int | defaultResolutionX () |
Returns the X value of the default resolution. More... | |
int | defaultResolutionY () |
Returns the Y value of the default resolution. More... | |
double | defaultResolutionFOV () |
Returns the default resolution field of view (FOV). The default FOV is a global scene parameter. More... | |
StringList | namedResolutions () |
Returns the list of known resolutions. More... | |
int | namedResolutionX (String name) |
Returns the X value of the named resolution. For example, when the named resolution is 720x540 pixels this function will return 720. More... | |
int | namedResolutionY (String name) |
Returns the Y value of the named resolution. For example, when the named resolution is 720x540 pixels this function will return 540. More... | |
double | getFrameRate () |
Returns the frame rate, as frames per second. More... | |
void | setDefaultTexturePixelDensityforVectorDrawings (double &normalizedDensity) |
Changes the default texture pixel density for new Vector Drawings. More... | |
void | setDefaultTexturePixelDensityforBitmapDrawings (double &normalizedDensity) |
Changes the default texture pixel density for new Bitmap Drawings. More... | |
int | getStartFrame () |
Returns the scene start frame. More... | |
int | getStopFrame () |
Returns the scene stop frame. More... | |
String | colorSpace () |
Returns the scene working colour space name. More... | |
StringList | colorSpaceNames () |
Returns the list of supported colour space names. More... | |
Saving functions | |
bool | isDirty () |
Tells if the scene has been modified since its last save. More... | |
bool | hasBeenDirty () |
Returns true if the scene was ever modified. More... | |
bool | saveAll () |
Performs the "save all" command. Effectively, this saves the entire project and all modified files. More... | |
bool | saveAsNewVersion (String &name, bool markAsDefault) |
Saves the project as a new version. More... | |
bool | saveAs (String &pathname) |
Save the current project to the specified folder. More... | |
Public Member Functions | |
checkFiles (QVariant options) | |
Performs the same operation as the "Scene->Check Files..." menu item. More... | |
Global Scene Edition. | |
bool | setUnitsAspectRatio (double x, double y) |
Sets the aspect ratio of the scene. The scene's final aspect ratio will be: X * numberOfUnitsX()/Y * numberOfUnitsY(). More... | |
bool | setNumberOfUnits (int x, int y, int z) |
Sets the number of X, Y, and Z units in the scene grid. More... | |
bool | setCoordAtCenter (int x, int y) |
Sets the value of the centre (X, Y) coordinates. More... | |
bool | setDefaultResolution (int x, int y, double fov) |
Sets the default scene resolution and field of view. More... | |
bool | setDefaultResolutionName (String name) |
This function sets the default scene resolution name. More... | |
bool | setFrameRate (double frameRate) |
This function set the default frame rate of the project. The frame rate is expressed as frames per second. Typical value is 12, 24 or 30. More... | |
bool | setStartFrame (int frame) |
This function sets the scene start frame. The value is validated to be below the number of frames, the stop frame is adjusted too if the specified value is bigger. More... | |
bool | setStopFrame (int frame) |
This function sets the scene stop frame. The value is validated to be below the number of frames, the start frame is adjusted too if the specified value is smaller. More... | |
bool | setColorSpace (String &name) |
This function sets the scene working colour space name. More... | |
QObject * | getCameraMatrix (int frame) |
Returns the model matrix for the default camera. More... | |
QScriptValue | toOGL (QObject *pointOrVector) |
Converts a field coordinate into an OGL coordinate. More... | |
double | toOGLX (double fieldX) |
Converts the X-value of a field coordinate to the X-value of an OpenGL coordinate. More... | |
double | toOGLY (double fieldY) |
Converts the Y-value of a field coordinate to the Y-value of an OpenGL coordinate. More... | |
double | toOGLZ (double fieldZ) |
Converts the Z-value of a field coordinate to the Z-value of an OpenGL coordinate. More... | |
QScriptValue | fromOGL (QObject *pointOrVector) |
Converts an OGL coordinate into a field coordinate. More... | |
double | fromOGLX (double oglX) |
Converts the X-value of an OpenGL coordinate to the X-value of a field coordinate. More... | |
double | fromOGLY (double oglY) |
Converts the Y-value of an OpenGL coordinate to the Y-value of a field coordinate. More... | |
double | fromOGLZ (double oglZ) |
Converts the Z-value of an OpenGL coordinate to the Z-value of a field coordinate. More... | |
String | getDefaultDisplay () |
Retrieves the default display set in the current scene. More... | |
void | closeScene () |
Closes the current scene. More... | |
void | closeSceneAndExit () |
Closes the current scene and exits. More... | |
bool | closeSceneAndOpen (String &envName, String &jobName, String &sceneName, String &versionName) |
Closes the current scene and open the scene specified by env, job, scene and version. More... | |
bool | closeSceneAndOpenOffline (String &filePath) |
Closes the current scene and open the scene specified by it's file path. More... | |
StringList | getMissingPalettes (bool unrecovered, bool recoveredNotYetSaved) |
Returns all palettes that were either unrecovered or recovered but not yet saved, depending on the arguments of the function. More... | |
QScriptValue | metadatas () |
Return the list of metadatas for the current scene. More... | |
QScriptValue | metadata (String &name, String &type=QNTR("string")) |
Return a metadata object corresponding to the given name and type. More... | |
void | setMetadata (QScriptValue &meta) |
Either inserts a new metadata object or sets the value of an existing metadata object. More... | |
bool | removeMetadata (QScriptValue &meta) |
Removes a metadata object from the list of metadata objects. More... | |
The scene JavaScript global object. Retrieve and set global scene attributes, like the aspect ratio of the cells in the scene grid.
|
slot |
This function starts the accumulation of all of the functions between it and the endUndoRedoAccum function as one command that will appear in the undo/redo list. If you do not use this function with endUndoRedoAccum, each function in the script generates a separate undo/redo entry.
commandName | : The name of the command to be added to the undo/redo list. |
|
slot |
This function cancels the accumulation of undo/redo commands. No command will be added to the undo/redo list and all commands that have already been executed will be rolled-back (undone).
checkFiles | ( | QVariant | options | ) |
Performs the same operation as the "Scene->Check Files..." menu item.
It can be passed an object that contains options.
report | : default false ; returns a human-readable report in the report field |
summary | : default false ; returns a human-readable summary in the summary field |
colors | : default true ; returns a list of missing colors in the missingColors field |
moreInfo | : default false ; returns information about the bitmaps found in the scene |
layers | : default true ; returns layer information of bitmaps when moreInfo is true (for PSD files) |
allFiles | : default true ; returns the list of TVG and bitmaps if true. If false returns only TVG files. |
The function can also be passed true to make all the options true.
e.g.
|
slot |
Clears the command history.
|
slot |
Closes the current scene.
Exiting functions Anyone of these is final and absolute. Nothing in the script will be executed after these calls.
|
slot |
Closes the current scene and exits.
|
slot |
Closes the current scene and open the scene specified by env, job, scene and version.
envName | : The environment name. |
jobName | : The job name. |
sceneName | : The scene name. |
versionName | : The version name. |
|
slot |
Closes the current scene and open the scene specified by it's file path.
filePath | : The full path to the file to open. |
|
slot |
Returns the scene working colour space name.
The empty name corresponds to disabled colour space management.
|
slot |
Returns the list of supported colour space names.
The list is empty if colour space management is disabled.
|
slot |
Returns the X value of the centre coordinate of the scene grid.
|
slot |
Returns the Y value of the centre coordinate of the scene grid.
|
slot |
Returns the name of the current environment.
|
slot |
Returns the path of the current environment.
|
slot |
Returns the name of the current job.
|
slot |
Returns the path of the current job.
|
slot |
Returns the current project path.
|
slot |
For windows, returns the remapped path.
|
slot |
Returns the X value of the current preview resolution.
For example, when the current resolution is 720x540 pixels this function will return 720.
|
slot |
Returns the Y value of the current preview resolution.
For example, when the current resolution is 720x540 pixels this function will return 540.
|
slot |
Returns the name of the current scene.
|
slot |
Returns the ID of the current version.
|
slot |
Returns the name or the number of the current scene version.
|
slot |
Returns the default resolution field of view (FOV). The default FOV is a global scene parameter.
|
slot |
Returns the default resolution name.
The resolution name is a global parameter saved with the project. It may be empty when the project is used as a custom resolution, which is not one of the pre-defined resolutions.
|
slot |
Returns the X value of the default resolution.
This resolution is a global parameter saved with the project, not the current preview resolution. For example, when the default scene resolution is 720x540 pixels this function will return 720.
|
slot |
Returns the Y value of the default resolution.
This resolution is a global parameter saved with the project, not the current preview resolution. For example, when the default scene resolution is 720x540 pixels this function will return 540.
|
slot |
This function ends the accumulation all of the functions between it and the beginUndoRedoAccum function as one command that will appear in the undo/redo list. If you do not use this function with beginUndoRedoAccum, each function in the script generates a separate undo/redo entry.
|
slot |
Converts an OGL coordinate into a field coordinate.
pointOrVector | can be either a 2D point or a 3D point or a vector object. |
|
slot |
Converts the X-value of an OpenGL coordinate to the X-value of a field coordinate.
oglX | : The X-value of an OpenGL coordinate. |
|
slot |
Converts the Y-value of an OpenGL coordinate to the Y-value of a field coordinate.
oglY | : The Y-value of an OpenGL coordinate. |
|
slot |
Converts the Z-value of an OpenGL coordinate to the Z-value of a field coordinate.
oglZ | : The Z-value of an OpenGL coordinate. |
|
slot |
Returns the model matrix for the default camera.
frame | : The frame to retrieve the camera matrix at. |
|
slot |
Retrieves the default display set in the current scene.
|
slot |
Returns the frame rate, as frames per second.
|
slot |
Returns all palettes that were either unrecovered or recovered but not yet saved, depending on the arguments of the function.
unrecovered | : Whether or not to return unrecovered palettes. |
recoveredNotYetSaved | : Whether or not to return recovered but not yet saved palettes. |
|
slot |
Returns the scene start frame.
|
slot |
Returns the scene stop frame.
|
slot |
Returns true if the scene was ever modified.
It will return true even if the modifications have been saved.
|
slot |
Tells if the scene has been modified since its last save.
|
slot |
Return a metadata object corresponding to the given name and type.
Here is an example of a metadata object:
Supported values for type are: string, int, double, bool.
name | : The name of the metadata object. |
type | : The metadata type. |
|
slot |
Return the list of metadatas for the current scene.
This method returns an array of javascript objects where each object represent a single metadata object. Here is an example of a metadata object:
Supported values for type are: string, int, double, bool.
|
slot |
Returns the list of known resolutions.
|
slot |
Returns the X value of the named resolution. For example, when the named resolution is 720x540 pixels this function will return 720.
name | : The name of the resolution to get the value from. |
|
slot |
Returns the Y value of the named resolution. For example, when the named resolution is 720x540 pixels this function will return 540.
name | : The name of the resolution to get the value from. |
|
slot |
Returns the number of units in the X axis of the scene grid.
|
slot |
Returns the number of units in the Y axis of the scene grid.
|
slot |
Returns the number of units in the Z axis of the scene grid.
|
slot |
Redoes the last n operations. If n is not specified, it will be 1.
depth | : The number of operations to redo. |
|
slot |
Removes a metadata object from the list of metadata objects.
meta | : A metadata object. |
|
slot |
Performs the "save all" command. Effectively, this saves the entire project and all modified files.
|
slot |
Save the current project to the specified folder.
Save the current project to the specified folder. Folder must not exists. The current project is updated to use that folder. Any error or message is reported using the standard error logger (so, in non batch mode, user will see message popup).
This API only works in standalone as you cannot 'Save As' in database.
pathname | : New folder of the project (ie: /Users/a_user/Documents/my_save_as_project ) |
|
slot |
Saves the project as a new version.
name | : The name of the version. |
markAsDefault | : This is boolean to indicate to mark this version as the default version. |
|
slot |
This function sets the scene working colour space name.
name | : Set the scene working colour space name. |
|
slot |
Sets the value of the centre (X, Y) coordinates.
x | : The value of the X coordinate at the centre of the grid. |
y | : The value of the Y coordinate at the centre of the grid. |
|
slot |
Sets the default scene resolution and field of view.
x | : Set the X resolution for the scene in pixels. |
y | : Set the Y resolution for the scene in pixels. |
fov | : Set the field of view in degree. Typical value is 41.112. |
|
slot |
This function sets the default scene resolution name.
name | : Set the current resolution preset name to this value. |
|
slot |
Changes the default texture pixel density for new Bitmap Drawings.
The example below uses scene.setDefaultTexturePixelDensityforBitmapDrawings() to reduce the scene settings' default pixel density for bitmap drawings to 20%.
normalizedDensity | : The new normalized default pixel density (1.0 = 100%) |
|
slot |
Changes the default texture pixel density for new Vector Drawings.
The example below uses scene.setDefaultTexturePixelDensityforVectorDrawings() to increase the scene settings' default pixel density for vector drawings to 300%.
normalizedDensity | : The new normalized default pixel density (1.0 = 100%) |
|
slot |
This function set the default frame rate of the project. The frame rate is expressed as frames per second. Typical value is 12, 24 or 30.
frameRate | : The new frame rate. |
|
slot |
Either inserts a new metadata object or sets the value of an existing metadata object.
If a metadata object already exist with the given name and type properties, then sets its value with the given value property. Otherwise, inserts a new metadata object with the given name, type(default is string), creator(default is executable), version(default is 1.0) and values properties. Here is an example of a metadata object:
Supported values for type are: string, int, double, bool.
meta | : A metadata object. |
|
slot |
Sets the number of X, Y, and Z units in the scene grid.
x | : The X value of the scene grid. |
y | : The Y value of the scene grid. |
z | : The Z value of the scene grid. |
|
slot |
This function sets the scene start frame. The value is validated to be below the number of frames, the stop frame is adjusted too if the specified value is bigger.
frame | : The scene start frame. |
|
slot |
This function sets the scene stop frame. The value is validated to be below the number of frames, the start frame is adjusted too if the specified value is smaller.
frame | : The scene stop frame. |
|
slot |
Sets the aspect ratio of the scene. The scene's final aspect ratio will be: X * numberOfUnitsX()/Y * numberOfUnitsY().
x | : The X value of the new aspect ratio. |
y | : The Y value of the new aspect ratio. |
|
slot |
Returns the temporary project path.
|
slot |
For windows, returns the remapped temporary project path.
The remapped temporary project path.
|
slot |
Converts a field coordinate into an OGL coordinate.
pointOrVector | can be either a 2D point or a 3D point or a vector object. |
|
slot |
Converts the X-value of a field coordinate to the X-value of an OpenGL coordinate.
fieldX | : The X-value of a field coordinate. |
|
slot |
Converts the Y-value of a field coordinate to the Y-value of an OpenGL coordinate.
fieldY | : The Y-value of a field coordinate. |
|
slot |
Converts the Z-value of a field coordinate to the Z-value of an OpenGL coordinate.
fieldZ | : The Z-value of a field coordinate. |
|
slot |
Undoes the last n operations. If n is not specified, it will be 1.
depth | : The number of operations to undo. |
|
slot |
Returns the X value of the aspect ratio of the cells in the scene grid.
|
slot |
Returns the Y value of the aspect ratio of the cells in the scene grid.