The Drawing JavaScript global object. Iterate and manipulate the drawings of an element node. More...
Public Slots | |
int | numberOf (int elementId) |
Returns the number of drawings in the element. More... | |
String | name (int elementId, int drawingIndex) |
Returns the drawing id. More... | |
bool | isExists (int elementId, String timing) |
Returns true if the given drawing exists in this element. More... | |
bool | create (int elementId, String timing, bool fileExists, bool storeInProjectFolder=false) |
Creates a new drawing inside an element. More... | |
String | filename (int elementId, String drawingName) |
Returns the filename of this drawing on disk. More... | |
QScriptValue | Key (QScriptValue object) |
Create a drawing key which can be used to test the availability of a drawing. More... | |
The Drawing JavaScript global object. Iterate and manipulate the drawings of an element node.
|
slot |
Creates a new drawing inside an element.
Create a new empty drawing inside the given element. The drawing file will physically exists in the temporary folder until the project is saved. Then, the file will reside in (scene folder)/elements/MyElement/ (where MyElement is the name of the element linked to the given elementId).
elementId | : The unique id of the element. |
timing | : The proposed drawing name. |
fileExists | : Used to indicate that the drawing exists. By default, drawings exist in the temporary folder. |
storeInProjectFolder | : Indicate that the drawing exits in the project folder, not in a temporary folder. |
|
slot |
Returns the filename of this drawing on disk.
This filename may be in the temp folder or project folder. Before the project is actually saved, the temporary folder is where the drawing must reside to be found by the application.
elementId | : The unique id of the element. |
drawingName | : The drawing name. |
|
slot |
Returns true if the given drawing exists in this element.
elementId | : The unique id of the element. |
timing | : The drawing name. |
|
slot |
Create a drawing key which can be used to test the availability of a drawing.
Create a drawing key from an object having one of the following property set.
object | an object with the following properties (see the example below). // Point to a drawing from the file system var fileDrawingKey = { filename : "C:/MySceneFolder/elements/Drawing/Drawing-1.tvg" }; var drawingKey = Drawing.Key(fileDrawingKey); if(!drawingKey.isValid) return; // Point to the drawing of a node exposed to a given frame var nodeDrawingKey = { node : "Top/MyDrawing", frame : 1 }; var drawingKey = Drawing.Key(nodeDrawingKey); if(!drawingKey.isValid) return; // Point to a drawing from an element var exposureDrawingKey = { elementId : 1, exposure : "2", layer : "Drawing_1" // [Optional] Name of the synced drawing layer. Get it from the "DRAWING.ELEMENT.LAYER" attribute from an element node. DO NOT SPECIFY if the drawing isn't a drawing layer. }; var drawingKey = Drawing.Key(exposureDrawingKey); if(!drawingKey.isValid) return; |
As a more complete example, here's how to get the properties of a drawing key from an element node.
|
slot |
Returns the drawing id.
elementId | : The unique id of the element. |
drawingIndex | : The drawing index. |
|
slot |
Returns the number of drawings in the element.
elementId | : The unique id of the element. |