Project Class Reference

The project JavaScript global object. Retrieve and set global project attributes. More...

Public Slots

Project Saving and Loading
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...
 
bool openProject (String &filePath)
 Closes the current project, and open the one specified by it's file path. More...
 
bool isDirty ()
 Tells if the project has been modified since its last save. More...
 
bool hasBeenDirty ()
 Returns true if the project was ever modified. More...
 
Project Data
int projectVersion ()
 Returns the ID of the current version. More...
 
String currentProjectPath ()
 Returns the current project path. More...
 
String currentProjectPathRemapped ()
 For windows, returns the remapped path. More...
 
double unitsAspectRatioX ()
 Returns the X value of the aspect ratio of the cells in the grid. More...
 
double unitsAspectRatioY ()
 Returns the Y value of the aspect ratio of the cells in the grid. More...
 
int numberOfUnitsX ()
 Returns the number of units in the X axis of the grid. More...
 
int numberOfUnitsY ()
 Returns the number of units in the Y axis of the grid. More...
 
int numberOfUnitsZ ()
 Returns the number of units in the Z axis of the grid. More...
 
int coordAtCenterX ()
 Returns the X value of the centre coordinate of the grid. More...
 
int coordAtCenterY ()
 Returns the Y value of the centre coordinate of the 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 project 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...
 
Global Project Edition.
bool setUnitsAspectRatio (double x, double y)
 Sets the aspect ratio of the project. The project'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 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 project resolution and field of view. More...
 
bool setDefaultResolutionName (String name)
 This function sets the default project 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...
 
QScriptValue metadatas ()
 Return the list of metadatas for the current project. 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...
 
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...
 

Detailed Description

The project JavaScript global object. Retrieve and set global project attributes.

Member Function Documentation

◆ beginUndoRedoAccum

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

Parameters
commandName: The name of the command to be added to the undo/redo list.

◆ cancelUndoRedoAccum

void Project::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).

◆ clearHistory

void Project::clearHistory ( )
slot

Clears the command history.

◆ coordAtCenterX

int Project::coordAtCenterX ( )
slot

Returns the X value of the centre coordinate of the grid.

Returns
The X value of the centre coordinate of the grid.

◆ coordAtCenterY

int Project::coordAtCenterY ( )
slot

Returns the Y value of the centre coordinate of the grid.

Returns
The Y value of the centre coordinate of the grid.

◆ currentProjectPath

String Project::currentProjectPath ( )
slot

Returns the current project path.

Returns
The current project path.

◆ currentProjectPathRemapped

String Project::currentProjectPathRemapped ( )
slot

For windows, returns the remapped path.

Returns
The remapped path.

◆ currentResolutionX

int Project::currentResolutionX ( )
slot

Returns the X value of the current preview resolution.

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

Returns
The X value of the current preview resolution.

◆ currentResolutionY

int Project::currentResolutionY ( )
slot

Returns the Y value of the current preview resolution.

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

Returns
The Y value of the current preview resolution.

◆ defaultResolutionFOV

double Project::defaultResolutionFOV ( )
slot

Returns the default resolution field of view (FOV). The default FOV is a global project parameter.

Returns
The default resolution field of view (FOV).

◆ defaultResolutionName

String Project::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.

Returns
The default resolution name.

◆ defaultResolutionX

int Project::defaultResolutionX ( )
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 project resolution is 720x540 pixels this function will return 720.

Returns
The X value of the default resolution.

◆ defaultResolutionY

int Project::defaultResolutionY ( )
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 project resolution is 720x540 pixels this function will return 540.

Returns
The Y value of the default resolution.

◆ endUndoRedoAccum

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

◆ getFrameRate

double Project::getFrameRate ( )
slot

Returns the frame rate, as frames per second.

Returns
The frame rate, as frames per second.

◆ hasBeenDirty

bool Project::hasBeenDirty ( )
slot

Returns true if the project was ever modified.

It will return true even if the modifications have been saved.

Returns
True if the project has been modified since it was loaded, false if it was never modified in this session.

◆ isDirty

bool Project::isDirty ( )
slot

Tells if the project has been modified since its last save.

Returns
true if the project has been modified since its last save.

◆ metadata

QScriptValue Project::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" : "Storyboard Pro",
"version" : "1.0",
"value" : "foo"
}

Supported values for type are: string, int, double, bool.

Parameters
name: The name of the metadata object.
type: The metadata type.
Returns
A metadata object.

◆ metadatas

QScriptValue Project::metadatas ( )
slot

Return the list of metadatas for the current project.

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" : "Storyboard Pro",
"version" : "1.0",
"value" : "foo"
}

Supported values for type are: string, int, double, bool.

Returns
An array of metadata objects.

◆ namedResolutions

StringList Project::namedResolutions ( )
slot

Returns the list of known resolutions.

Returns
The list of the known resolutions.

◆ namedResolutionX

int Project::namedResolutionX ( String  name)
slot

Returns the X value of the named resolution. For example, when the named resolution is 720x540 pixels this function will return 720.

Parameters
name: The name of the resolution to get the value from.
Returns
The X value of the named resolution.

◆ namedResolutionY

int Project::namedResolutionY ( String  name)
slot

Returns the Y value of the named resolution. For example, when the named resolution is 720x540 pixels this function will return 540.

Parameters
name: The name of the resolution to get the value from.
Returns
The Y value of the named resolution.

◆ numberOfUnitsX

int Project::numberOfUnitsX ( )
slot

Returns the number of units in the X axis of the grid.

Returns
The number of units in the X axis of the grid.

◆ numberOfUnitsY

int Project::numberOfUnitsY ( )
slot

Returns the number of units in the Y axis of the grid.

Returns
The number of units in the Y axis of the grid.

◆ numberOfUnitsZ

int Project::numberOfUnitsZ ( )
slot

Returns the number of units in the Z axis of the grid.

Returns
The number of units in the Z axis of the grid.

◆ openProject

bool Project::openProject ( String &  filePath)
slot

Closes the current project, and open the one specified by it's file path.

Parameters
filePath: The full path to the file to open.
Returns
Returns true if the project is successfully closed, and the specified one opened.

◆ projectVersion

int Project::projectVersion ( )
slot

Returns the ID of the current version.

Returns
The ID of the current version.

◆ redo

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

Redoes the last n operations. If n is not specified, it will be 1.

Parameters
depth: The number of operations to redo.

◆ removeMetadata

bool Project::removeMetadata ( QScriptValue &  meta)
slot

Removes a metadata object from the list of metadata objects.

Parameters
meta: A metadata object.
Returns
true if the metadata was successfully removed from the list.

◆ saveAll

bool Project::saveAll ( )
slot

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

Returns
true if the project and files are successfully saved.

◆ saveAs

bool Project::saveAs ( String &  pathname)
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.

Parameters
pathname: New folder of the project (ie: /Users/a_user/Documents/my_save_as_project )
Returns
true if successfully saved the project.

◆ saveAsNewVersion

bool Project::saveAsNewVersion ( String &  name,
bool  markAsDefault 
)
slot

Saves the project as a new version.

Parameters
name: The name of the version.
markAsDefault: This is boolean to indicate to mark this version as the default version.
Returns
true if the project is successfully saved.

◆ setCoordAtCenter

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

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

Parameters
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.
Returns
true if the new centre coordinate is set.

◆ setDefaultResolution

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

Sets the default project resolution and field of view.

Parameters
x: Set the X resolution for the project in pixels.
y: Set the Y resolution for the project in pixels.
fov: Set the field of view in degree. Typical value is 41.112.
Returns
true if the default resolution is set.

◆ setDefaultResolutionName

bool Project::setDefaultResolutionName ( String  name)
slot

This function sets the default project resolution name.

Parameters
name: Set the current resolution preset name to this value.
Returns
true if the default resolution name is set.

◆ setFrameRate

bool Project::setFrameRate ( double  frameRate)
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.

Parameters
frameRate: The new frame rate.
Returns
true if the frame rate is set.

◆ setMetadata

void Project::setMetadata ( QScriptValue &  meta)
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:

{
"name" : "myMetadata",
"type" : "string",
"creator" : "Storyboard Pro",
"version" : "1.0",
"value" : "foo"
}

Supported values for type are: string, int, double, bool.

Parameters
meta: A metadata object.

◆ setNumberOfUnits

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

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

Parameters
x: The X value of the grid.
y: The Y value of the grid.
z: The Z value of the grid.
Returns
true if the new aspect ratio is successfully set.

◆ setUnitsAspectRatio

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

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

Parameters
x: The X value of the new aspect ratio.
y: The Y value of the new aspect ratio.
Returns
true if the new aspect ratio is successfully set.

◆ undo

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

Undoes the last n operations. If n is not specified, it will be 1.

Parameters
depth: The number of operations to undo.

◆ unitsAspectRatioX

double Project::unitsAspectRatioX ( )
slot

Returns the X value of the aspect ratio of the cells in the grid.

Returns
The X value of the aspect ratio of the cells in the grid.

◆ unitsAspectRatioY

double Project::unitsAspectRatioY ( )
slot

Returns the Y value of the aspect ratio of the cells in the grid.

Returns
The Y value of the aspect ratio of the cells in the grid.