Harmony
Scripting Interface Documentation
scene Class Reference

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 ()
 Return the current project path. More...
 
String currentProjectPathRemapped ()
 For windows, returns the remapped path. More...
 
String tempProjectPath ()
 Return 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 operation. If n is not specified, it will be 1 More...
 
void redo (int depth=1)
 redoes the last n operation. If n is not specified, it will be 1 More...
 
void clearHistory ()
 Clear 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 current preview resolution. For example, when the current resolution is 720x540 pixels this function will return 720. More...
 
int currentResolutionY ()
 returns the current preview resolution. For example, when the current resolution is 720x540 pixels this function will return 540. More...
 
String defaultResolutionName ()
 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. More...
 
int defaultResolutionX ()
 returns 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. More...
 
int defaultResolutionY ()
 returns 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. 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 resolution More...
 
int namedResolutionX (String name)
 returns the named resolution. For example, when the named resolution is 720x540 pixels this function will return 720. More...
 
int namedResolutionY (String name)
 returns the named resolution. For example, when the named resolution is 720x540 pixels this function will return 540. More...
 
int getFrameRate ()
 returns the frame rate, as frame per seconds. More...
 
Saving functions
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...
 
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)
 allows the default scene resolution and field of view to be changed. More...
 
bool setDefaultResolutionName (String name)
 This function allows the default scene resolution name to be changed. More...
 
bool setFrameRate (int frameRate)
 This function allows the default frame rate of the project to be changed. The frame rate is expressed as frame per second. Typical value is 12, 24 or 30. More...
 
QObject * getCameraMatrix (int frame)
 returns the model matrix for the default camera. More...
 
QObject * toOGL (QObject *pointOrVector)
 converts a field coordinate into an OGL coordinate More...
 
QObject * fromOGL (QObject *pointOrVector)
 converts an OGL coordinate into a field coordinate. More...
 
String getDefaultDisplay ()
 retrieves default display set in 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...
 
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 ()
 
QScriptValue metadata (String &name, String &type=QNTR("string"))
 
void setMetadata (QScriptValue &meta)
 
double defaultPixelPerModelUnitForBitmapLayers ()
 

Public Member Functions

 checkFiles (QVariant options)
 Performs the same operation as the "Scene->Check Files..." menu item. More...
 

Detailed Description

The scene JavaScript global object. Retrieve and set global scene attributes, like the aspect ratio of the cells in the scene grid.

function setScene()
{
// Sets the beginning of the undo/redo command wrapper
scene.beginUndoRedoAccum("Set Scene");
// Sets the aspect ratio of the scene to 4, 3
// Sets the number of units in the scene
scene.setNumberOfUnits(1200, 900, 12);
// Sets the value of the center coordinate
scene.setCoordAtCenter(5000, 5000);
// Terminates the undo/redo command wrapper
}

Member Function Documentation

◆ beginUndoRedoAccum

void scene::beginUndoRedoAccum ( String  commandName)
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.

◆ cancelUndoRedoAccum

void scene::cancelUndoRedoAccum ( )
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()

checkFiles ( QVariant  options)

Performs the same operation as the "Scene->Check Files..." menu item.

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.

var r = scene.checkFiles(true); // turns on all options to true

var s = scene.checkFiles({ allFiles : false }); // Will check only TVG files.

var t = scene.checkFiles({ allFiles : true, modeInfo :true, report : true }); // Will check all files and display bitmap information and layer informations on bitmap files. Will return a human-readable report in the report field of the returned object

◆ clearHistory

void scene::clearHistory ( )
slot

Clear command history.

◆ closeScene

void scene::closeScene ( )
slot

closes the current scene.

Exiting functions Anyone of these is final and absolute. Nothing in the script will be executed after these calls.

◆ closeSceneAndExit

void scene::closeSceneAndExit ( )
slot

closes the current scene and exits.

◆ closeSceneAndOpen

bool scene::closeSceneAndOpen ( String &  envName,
String &  jobName,
String &  sceneName,
String &  versionName 
)
slot

closes the current scene and open the scene specified by env, job, scene and version

◆ coordAtCenterX

int scene::coordAtCenterX ( )
slot

returns the X value of the centre coordinate of the scene grid.

◆ coordAtCenterY

int scene::coordAtCenterY ( )
slot

returns the Y value of the centre coordinate of the scene grid.

◆ currentEnvironment

String scene::currentEnvironment ( )
slot

returns the name of the current environment.

◆ currentEnvironmentPath

String scene::currentEnvironmentPath ( )
slot

returns the path of the current environment.

◆ currentJob

String scene::currentJob ( )
slot

returns the name of the current job.

◆ currentJobPath

String scene::currentJobPath ( )
slot

returns the path of the current job.

◆ currentProjectPath

String scene::currentProjectPath ( )
slot

Return the current project path.

◆ currentProjectPathRemapped

String scene::currentProjectPathRemapped ( )
slot

For windows, returns the remapped path.

◆ currentResolutionX

int scene::currentResolutionX ( )
slot

returns the current preview resolution. For example, when the current resolution is 720x540 pixels this function will return 720.

◆ currentResolutionY

int scene::currentResolutionY ( )
slot

returns the current preview resolution. For example, when the current resolution is 720x540 pixels this function will return 540.

◆ currentScene

String scene::currentScene ( )
slot

returns the name of the current scene.

◆ currentVersion

int scene::currentVersion ( )
slot

returns the ID of the current version.

◆ currentVersionName

String scene::currentVersionName ( )
slot

returns the name or the number of the current scene version.

◆ defaultPixelPerModelUnitForBitmapLayers

double scene::defaultPixelPerModelUnitForBitmapLayers ( )
slot

◆ defaultResolutionFOV

double scene::defaultResolutionFOV ( )
slot

returns the default resolution field of view (FOV). The default FOV is a global scene parameter.

◆ defaultResolutionName

String scene::defaultResolutionName ( )
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.

◆ defaultResolutionX

int scene::defaultResolutionX ( )
slot

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

◆ defaultResolutionY

int scene::defaultResolutionY ( )
slot

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

◆ endUndoRedoAccum

void scene::endUndoRedoAccum ( )
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.

◆ fromOGL

QObject* scene::fromOGL ( QObject *  pointOrVector)
slot

converts an OGL coordinate into a field coordinate.

Parameters
pointOrVectorcan be either a 2D point or a 3D point or a vector object.

◆ getCameraMatrix

QObject* scene::getCameraMatrix ( int  frame)
slot

returns the model matrix for the default camera.

Parameters
frame: at which frame

◆ getDefaultDisplay

String scene::getDefaultDisplay ( )
slot

retrieves default display set in current scene.

◆ getFrameRate

int scene::getFrameRate ( )
slot

returns the frame rate, as frame per seconds.

◆ getMissingPalettes

StringList scene::getMissingPalettes ( bool  unrecovered,
bool  recoveredNotYetSaved 
)
slot

returns all palettes that were either unrecovered or recovered but not yet saved, depending on the arguments of the function.

◆ metadata

QScriptValue scene::metadata ( String &  name,
String &  type = QNTR("string") 
)
slot

Return a metadata object corresponding to the given name and type. Here is an example of a metadata object: { "name" : "myMetadata", "type" : "string", "creator" : "Harmony Premium", "version" : "1.0", "value" : "foo" }
Supported values for type are: string, int, double, bool.

Returns
a metadata object

◆ metadatas

QScriptValue scene::metadatas ( )
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: { "name" : "myMetadata", "type" : "string", "creator" : "Harmony Premium", "version" : "1.0", "value" : "foo" }
Supported values for type are: string, int, double, bool.

Returns
an array of metadata objects

◆ namedResolutions

StringList scene::namedResolutions ( )
slot

returns the list of known resolution

◆ namedResolutionX

int scene::namedResolutionX ( String  name)
slot

returns the named resolution. For example, when the named resolution is 720x540 pixels this function will return 720.

◆ namedResolutionY

int scene::namedResolutionY ( String  name)
slot

returns the named resolution. For example, when the named resolution is 720x540 pixels this function will return 540.

◆ numberOfUnitsX

int scene::numberOfUnitsX ( )
slot

returns the number of units in the X axis of the scene grid.

◆ numberOfUnitsY

int scene::numberOfUnitsY ( )
slot

returns the number of units in the Y axis of the scene grid.

◆ numberOfUnitsZ

int scene::numberOfUnitsZ ( )
slot

returns the number of units in the Z axis of the scene grid.

◆ redo

void scene::redo ( int  depth = 1)
slot

redoes the last n operation. If n is not specified, it will be 1

◆ saveAll

bool scene::saveAll ( )
slot

performs the " save all " command. Effectively, this saves the entire project and all modified files.

◆ saveAsNewVersion

bool scene::saveAsNewVersion ( String  name,
bool  markAsDefault 
)
slot

saves the project as a new version.

Parameters
nameThe name of the version.
markAsDefaultThis is boolean to indicate to mark this version as the default version.

◆ setCoordAtCenter

bool scene::setCoordAtCenter ( int  x,
int  y 
)
slot

sets the value of the centre (X, Y) coordinates.

Parameters
x,yThe value of the X and Y coordinate at the centre of the grid.

◆ setDefaultResolution

bool scene::setDefaultResolution ( int  x,
int  y,
double  fov 
)
slot

allows the default scene resolution and field of view to be changed.

Parameters
x,ySet the X and Y resolution for the scene in pixels.
fovSet the field of view in degree. Typical value is 41.112.

◆ setDefaultResolutionName

bool scene::setDefaultResolutionName ( String  name)
slot

This function allows the default scene resolution name to be changed.

Parameters
nameSet the current resolution preset name to this value.

◆ setFrameRate

bool scene::setFrameRate ( int  frameRate)
slot

This function allows the default frame rate of the project to be changed. The frame rate is expressed as frame per second. Typical value is 12, 24 or 30.

Parameters
frameRate: frame rate

◆ setMetadata

void scene::setMetadata ( QScriptValue &  meta)
slot

Either inserts a new metadata object of 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: { "name" : "myMetadata", "type" : "string", "creator" : "Harmony Premium", "version" : "1.0", "value" : "foo" }
Supported values for type are: string, int, double, bool.

◆ setNumberOfUnits

bool scene::setNumberOfUnits ( int  x,
int  y,
int  z 
)
slot

sets the number of X, Y, and Z units in the scene grid.

Parameters
x,y,zThe X, Y and Z values of the scene grid.

◆ setUnitsAspectRatio

bool scene::setUnitsAspectRatio ( double  x,
double  y 
)
slot

sets the aspect ratio of the scene. The scene's final aspect ratio will be: X * numberOfUnitsX()/Y * numberOfUnitsY()

Parameters
x,y: The X, Y value of the new aspect ratio.

◆ tempProjectPath

String scene::tempProjectPath ( )
slot

Return the temporary project path.

◆ tempProjectPathRemapped

String scene::tempProjectPathRemapped ( )
slot

For windows, returns the remapped temporary project path.

◆ toOGL

QObject* scene::toOGL ( QObject *  pointOrVector)
slot

converts a field coordinate into an OGL coordinate

Parameters
pointOrVectorcan be either a 2D point or a 3D point or a vector object.

◆ undo

void scene::undo ( int  depth = 1)
slot

undoes the last n operation. If n is not specified, it will be 1

◆ unitsAspectRatioX

double scene::unitsAspectRatioX ( )
slot

returns the X value of the aspect ratio of the cells in the scene grid.

◆ unitsAspectRatioY

double scene::unitsAspectRatioY ( )
slot

returns the Y value of the aspect ratio of the cells in the scene grid.