new $.oDrawingNode(path, oSceneObject)
openHarmony/openHarmony_node.js, line 1967
Constructor for the $.oDrawingNode class
Name | Type | Description |
---|---|---|
path |
string | Path to the node in the network. |
oSceneObject |
$.oScene | Access to the oScene object of the DOM. |
Example
// Drawing Nodes are more than a node, as they do not work without an associated Drawing column and element.
// adding a drawing node will automatically create a column and an element, unless they are provided as arguments.
// Creating an element makes importing a drawing file possible.
var doc = $.scn;
var drawingName = "myDrawing";
var myElement = doc.addElement(drawingName, "TVG"); // add an element that holds TVG(Toonboom Vector Drawing) files
var myDrawingColumn = doc.addColumn("DRAWING", drawingName, myElement); // create a column and link the element created to it
var sceneRoot = doc.root; // grab the scene root group
// Creating the Drawing node and linking the previously created element and column
var myDrawingNode = sceneRoot.addDrawingNode(drawingName, new $.oPoint(), myDrawingColumn, myElement);
// This also works:
var myOtherNode = sceneRoot.addDrawingNode("Drawing2");
Extends
Members
-
static$.oDrawingNode.timingColumn$.oDrawingColumn
-
The column that holds the drawings displayed by the node.
-
readonlyattributesoAttribute
-
An object containing all attributes of this node.
Example
// You can get access to the actual oAttribute object for a node parameter by using the dot notation: var myNode = $.scn.$node("Top/Drawing") var drawingAttribute = myNode.attributes.drawing.element // from there, it's possible to set/get the value of the attribute, get the column, the attribute keyword etc. drawingAttribute.setValue ("1", 5); // creating an exposure of drawing 1 at frame 5 var drawingColumn = drawingAttribute.column; // grabbing the column linked to the attribute that holds all the animation $.log(drawingAttribute.keyword); // "DRAWING.ELEMENT" // for a more direct way to access an attribute, it's possible to also call: var drawingAttribute = myNode.getAttributeByName("DRAWING.ELEMENT");
-
readonlyboundsoBox
-
The bounds of the node rectangle in the node view.
-
readonlycanCreateInPortsbool
-
Whether the node can create new in-ports.
-
readonlycanCreateOutPortsbool
-
Whether the node can create new out-ports.
-
readonlychildrenArray.<$.oNode>
-
The $.oNode objects contained in this group. This is deprecated and was moved to oGroupNode
- Deprecated
- Use oGroupNode.children instead.
-
readonlycontainingBackdropsArray.<$.oBackdrop>
-
The list of backdrops which contain this node.
-
element$.oElement
-
The element that holds the drawings displayed by the node.
-
enabledbool
-
Is the node enabled?
-
readonlyexistsbool
-
Does the node exist?
-
readonlyfullPathstring
-
The derived path to the node.
- Deprecated
- use oNode.path instead
-
readonlygroupoGroupNode
-
The group containing the node.
-
readonlyheightfloat
-
The height of the node in the node view.
-
readonlyinLinksArray.<$.oNodeLink>
-
The list of oNodeLinks objects descibing the connections to the inport of this node, in order of inport.
- Deprecated
- returns $.oNodeLink instances but $.oLink is preferred. Use oNode.getInLinks() instead.
-
readonlyinNodesArray.<$.oNode>
-
The list of nodes connected to the inport of this node, in order of inport.
- Deprecated
- returns $.oNodeLink instances but $.oLink is preferred. Use oNode.linkedInNodes instead.
-
readonlyinPortsint
-
The number of link ports on top of the node, connected or not.
-
readonlyinsArray.<$.oNode>
-
The list of nodes connected to the inport of this node, in order of inport. Similar to oNode.inNodes
- Deprecated
- alias for deprecated oNode.inNodes property
-
readonlyisGroupbool
-
Is the node a group?
- Deprecated
- check if the node is an instance of oGroupNode instead
-
readonlyisRootbool
-
Is the node the root?
-
readonlylinkedColumnsArray.<oColumn>
-
The list of all columns linked across all the attributes of this node.
-
readonlylinkedInNodesArray.<$.oNode>
-
The list of nodes connected to the inport of this node, as a flat list, in order of inport.
-
readonlylinkedOutNodesArray.<$.oNode>
-
The list of nodes connected to the inport of this node, as a flat list, in order of inport.
-
lockedbool
-
Is the node locked?
-
readonlymatrixoMatrix
-
The transformation matrix of the node at the currentFrame.
-
namestring
-
The node's name.
-
nodeColor$.oColorValue
-
The color of the node
-
nodePositionoPoint
-
The position of the node.
-
readonlyoutLinksArray.<$.oNodeLink>
-
The list of oNodeLinks objects descibing the connections to the outports of this node, in order of outport.
- Deprecated
- returns $.oNodeLink instances but $.oLink is preferred. Use oNode.getOutLinks instead.
-
readonlyoutNodesArray.<Array.<$.oNode>>
-
The list of nodes connected to the outports of this node
- Deprecated
- returns $.oNodeLink instances but $.oLink is preferred. Use oNode.linkedOutNodes instead.
-
readonlyoutPortsint
-
The number of link ports at the bottom of the node, connected or not.
-
readonlyoutsArray.<Array.<$.oNode>>
-
The list of nodes connected to the outport of this node, in order of outport and links. Similar to oNode.outNodes
- Deprecated
- alias for deprecated oNode.outNodes property
-
palettesArray.<$.oPalette>
-
The element palettes linked to the node.
-
readonlyparent$.oNode
-
The $.oNode object for the parent in which this node exists.
-
readonlypathstring
-
The path of the node (includes all groups from 'Top' separated by forward slashes). To change the path of a node, use oNode.moveToGroup()
-
selectedbool
-
Is the node selected?
-
timingsArray.<$.oFrames>
-
The drawing.element keyframes.
Example
// The timings hold the keyframes that display the drawings across time. var timings = $.scn.$node("Top/Drawing").timings; for (var i in timings){ $.log( timings.frameNumber+" : "+timings.value); // outputs the frame and the value of each keyframe } // timings are keyframe objects, so they are dynamic. timings[2].value = "5"; // sets the displayed image of the second key to the drawing named "5" // to set a new value to a frame that wasn't a keyframe before, it's possible to use the attribute keyword like so: var myNode = $.scn.$node("Top/Drawing"); myNode.drawing.element = {frameNumber: 5, value: "10"} // setting the value of the frame 5 myNode.drawing.element = {frameNumber: 6, value: timings[1].value} // setting the value to the same as one of the timings
-
readonlytypestring
-
The type of the node.
-
usedColorIdsArray.<int>
-
An array of the colorIds contained within the drawings displayed by the node.
-
usedColorsArray.<$.oColor>
-
An array of the colors contained within the drawings displayed by the node, found in the palettes.
-
readonlywidthfloat
-
The width of the node in the node view.
-
xfloat
-
The horizontal position of the node in the node view.
-
yfloat
-
The vertical position of the node in the node view.
-
zfloat
-
The depth position of the node in the node view.
Methods
-
addDrawing(atFrame, name, filename, convertToTvg){$.oDrawing}
openHarmony/openHarmony_node.js, line 2183 -
Adds a new empty drawing to the drawingNode at the given frame. Can specify a file for the drawing (to import it)
Name Type Default Description atFrame
int 1 optional The frame at which to add the drawing on the $.oDrawingColumn. Values < 1 create no exposure name
string optional The name of the drawing to add. filename
string optional Optionally, a path for a drawing file to use for this drawing. Can pass an oFile object as well. convertToTvg
bool false optional If the filename isn't a tvg file, specify if you want it converted (this doesn't vectorize the drawing). - See:
-
- $#oElement.addDrawing
Returns:
Type Description $.oDrawing the created drawing -
inherited addOutLink(nodeToLink, ownPort, destPort){$.oNodeLink}
openHarmony/openHarmony_node.js, line 1809 -
Creates an $.oNodeLink and connects this node to the target via this nodes outport.
Name Type Description nodeToLink
oNode The target node as an in node. ownPort
int The out port on this node to connect to. destPort
int The in port on the inNode to connect to. Returns:
Type Description $.oNodeLink the resulting created link. Example
var peg1 = $.scene.getNodeByPath( "Top/Peg1" ); var peg2 = $.scene.getNodeByPath( "Top/Group/Peg2" ); var newLink = peg1.addOutLink( peg2, 0, 0 );
-
inherited centerAbove(oNodeArray, xOffset, yOffset){oPoint}
openHarmony/openHarmony_node.js, line 1392 -
Place a node above one or more nodes with an offset.
Name Type Description oNodeArray
Array.<$.oNode> The array of nodes to center this above. xOffset
float The horizontal offset to apply after centering. yOffset
float The vertical offset to apply after centering. Returns:
Type Description oPoint The resulting position of the node. -
inherited centerBelow(oNodeArray, xOffset, yOffset){oPoint}
openHarmony/openHarmony_node.js, line 1421 -
Place a node below one or more nodes with an offset.
Name Type Description oNodeArray
Array.<$.oNode> The array of nodes to center this below. xOffset
float The horizontal offset to apply after centering. yOffset
float The vertical offset to apply after centering. Returns:
Type Description oPoint The resulting position of the node. -
inherited clone(newName, newPosition)
openHarmony/openHarmony_node.js, line 1610 -
Create a clone of the node.
Name Type Description newName
string The new name for the cloned module. newPosition
oPoint The new position for the cloned module. -
inherited createAttribute(attrName, type, displayName, linkable){$.oAttribute}
openHarmony/openHarmony_node.js, line 1828 -
Creates a new dynamic attribute in the node.
Name Type Default Description attrName
string The attribute name to create. type
string "string" optional The type of the attribute ["string", "bool", "double", "int"] displayName
string attrName optional The visible attribute name to the GUI user. linkable
bool false optional Whether the attribute can be linked to a column. Returns:
Type Description $.oAttribute The resulting attribute created. -
duplicate(newName, newPosition, duplicateElement)
openHarmony/openHarmony_node.js, line 2230 -
Duplicates a node by creating an independent copy.
Name Type Description newName
string optional The new name for the duplicated node. newPosition
oPoint optional The new position for the duplicated node. duplicateElement
bool optional Wether to also duplicate the element. -
exposeAllDrawings(framesPerDrawing)
openHarmony/openHarmony_node.js, line 2157 -
Displays all the drawings from the node's element onto the timeline
Name Type Default Description framesPerDrawing
int 1 optional The number of frames each drawing will be shown for -
extractPeg(){$.oPegNode}
openHarmony/openHarmony_node.js, line 2273 -
Extracts the position information on a drawing node, and applies it to a new peg instead.
Returns:
Type Description $.oPegNode The created peg. -
Traverses the node hierarchy up until if finds a node of the given type.
Name Type Description type
string the type of node we are looking for lookInsideGroups
bool wether to consider the nodes inside connected groups Returns:
Type Description $.oNode the found node -
Traverses the node hierarchy up until if finds a node matching the condition.
Name Type Description condition
function a function returning true or false which can be used to find the node lookInsideGroups
bool wether to consider the nodes inside connected groups Returns:
Type Description $.oNode the found node -
Traverses the node hierarchy up until if finds a node of the given type.
Name Type Description type
string the type of node we are looking for lookInsideGroups
bool wether to consider the nodes inside connected groups Returns:
Type Description $.oNode the found node -
Traverses the node hierarchy up until if finds a node of the given type.
Name Type Description type
string the type of node we are looking for lookInsideGroups
bool wether to consider the nodes inside connected groups Returns:
Type Description $.oNode the found node -
Traverses the node hierarchy down until if finds a node matching the condition.
Name Type Description condition
function a function returning true or false which can be used to find the node lookInsideGroups
bool wether to consider the nodes inside connected groups Returns:
Type Description $.oNode the found node -
Traverses the node hierarchy down until if finds a node of the given type.
Name Type Description type
string the type of node we are looking for lookInsideGroups
bool wether to consider the nodes inside connected groups Returns:
Type Description $.oNode the found node -
inherited getAttributeByColumnName(columnName){oAttribute}
openHarmony/openHarmony_node.js, line 1737 -
Provides a matching attribute based on the column name provided. Assumes only one match at the moment.
Name Type Description columnName
string The column name to search. Returns:
Type Description oAttribute The matched attribute object, given the column name. -
inherited getAttributeByName(keyword){oAttribute}
openHarmony/openHarmony_node.js, line 1701 -
Provides a matching attribute based on provided keyword name. Keyword can include "." to get subattributes.
Name Type Description keyword
string The attribute keyword to search. Returns:
Type Description oAttribute The matched attribute object, given the keyword. -
getContourCurves(count, frame){Array.<Array.<oPoint>>}
openHarmony/openHarmony_node.js, line 2316 -
Gets the contour curves of the drawing, as a concave hull.
Name Type Description count
int optional The number of points on the contour curve to derive. frame
int optional The frame to derive the contours. Returns:
Type Description Array.<Array.<oPoint>> The contour curves. -
getDrawingAtFrame(frameNumber){$.oDrawing}
openHarmony/openHarmony_node.js, line 2123 -
Gets the drawing name at the given frame.
Name Type Description frameNumber
int Returns:
Type Description $.oDrawing -
inherited getFreeInPort(createNew){int}
openHarmony/openHarmony_node.js, line 930 -
Returns a free unconnected in-port
Name Type Default Description createNew
bool true optional Whether to allow creation of new ports Returns:
Type Description int the port number that isn't connected -
inherited getFreeOutPort(createNew){int}
openHarmony/openHarmony_node.js, line 1067 -
Returns a free unconnected out-port
Name Type Default Description createNew
bool false optional Whether to allow creation of new ports Returns:
Type Description int the port number that isn't connected -
Returns the oLink object representing the connection of a specific inPort
Name Type Description inPort
int the number of the port to get links from. Returns:
Type Description $.oLink the oLink Object representing the link connected to the inport -
Returns all the valid oLink objects describing the links that are connected into this node.
Returns:
Type Description Array.<$.oLink> An array of $.oLink objects. -
inherited getInLinksNumber(inPort)
openHarmony/openHarmony_node.js, line 882 -
Returns the number of links connected to an in-port
Name Type Description inPort
int the number of the port to get links from. -
Returns the node connected to a specific in-port
Name Type Description inPort
int the number of the port to get the linked Node from. Returns:
Type Description $.oNode The node connected to this in-port -
Returns the node connected to a specific outPort
Name Type Default Description outPort
int the number of the port to get the node from. outLink
int 0 optional the index of the link. Returns:
Type Description $.oNode The node connected to this outPort and outLink -
inherited getMatrixAtFrame(frameNumber){oMatrix}
openHarmony/openHarmony_node.js, line 1327 -
Get the transformation matrix for the node at the given frame
Name Type Description frameNumber
int Returns:
Type Description oMatrix the matrix object -
Returns the $.oLink object representing the connection of a specific outPort / link
Name Type Description outPort
int the number of the port to get the link from. outLink
int optional the index of the link. Returns:
Type Description $.oLink The link object describing the connection -
Returns all the valid oLink objects describing the links that are coming out of this node.
Returns:
Type Description Array.<$.oLink> An array of $.oLink objects. -
inherited getOutLinksNumber(outPort){int}
openHarmony/openHarmony_node.js, line 1014 -
Returns the number of links connected to an outPort
Name Type Description outPort
int the number of the port to get links from. Returns:
Type Description int the number of links -
inherited getTimelineLayer(timeline){int}
openHarmony/openHarmony_node.js, line 1338 -
Retrieves the node layer in the timeline provided.
Name Type Description timeline
oTimeline optional Optional: the timeline object to search the column Layer. (by default, grabs the current timeline) Returns:
Type Description int The index within that timeline. -
getUsedPalettes(){Array.<$.oPalette>}
openHarmony/openHarmony_node.js, line 2135 -
Gets the list of palettes containing colors used by a drawing node. This only gets palettes with the first occurence of the colors.
Returns:
Type Description Array.<$.oPalette> The palettes that contain the color IDs used by the drawings of the node. -
inherited insertInNode(inPort, oNodeObject, inPortTarget, outPortTarget){bool}
openHarmony/openHarmony_node.js, line 1257 -
Inserts the $.oNodeObject provided as an innode to this node, placing it between any existing nodes if the link already exists.
Name Type Description inPort
int This node's inport to connect. oNodeObject
$.oNode The node to link this one's outport to. inPortTarget
int The target node's inPort to connect. outPortTarget
int The target node's outPort to connect. Returns:
Type Description bool The result of the link, if successful. -
inherited linkInNode(nodeToLink, ownPort, destPort, createPorts){bool}
openHarmony/openHarmony_node.js, line 954 -
Links this node's inport to the given module, at the inport and outport indices.
Name Type Description nodeToLink
$.oNode The node to link this one's inport to. ownPort
int optional This node's inport to connect. destPort
int optional The target node's outport to connect. createPorts
bool optional Whether to create new ports on the nodes. Returns:
Type Description bool The result of the link, if successful. -
inherited linkOutNode(nodeToLink, ownPort, destPort, createPorts){bool}
openHarmony/openHarmony_node.js, line 1183 -
Links this node's out-port to the given module, at the inport and outport indices.
Name Type Description nodeToLink
$.oNode The node to link this one's outport to. ownPort
int optional This node's outport to connect. destPort
int optional The target node's inport to connect. createPorts
bool optional Whether to create new ports on the nodes. Returns:
Type Description bool The result of the link, if successful. -
linkPalette(oPaletteObject, index){$.oPalette}
openHarmony/openHarmony_node.js, line 2206 -
Links a palette to a drawing node as Element Palette.
Name Type Description oPaletteObject
$.oPalette the palette to link to the node index
int optional The index of the list at which the palette should appear once linked Returns:
Type Description $.oPalette The linked element Palette. -
inherited moveToGroup(group)
openHarmony/openHarmony_node.js, line 1277 -
Moves the node into the specified group. This doesn't create any composite or links to the multiport nodes. The node will be unlinked.
Name Type Description group
oGroupNode the group node to move the node into. -
inherited orderAboveNodes(verticalSpacing, horizontalSpacing)
openHarmony/openHarmony_node.js, line 1473 -
Sorts the nodes above this node in a grid like manner, based on their links.
Name Type Default Description verticalSpacing
int 120 optional optional: The spacing between two rows of nodes. horizontalSpacing
int 40 optional optional: The spacing between two nodes horizontally. -
inherited placeAtCenter(oNodeArray, xOffset, yOffset){oPoint}
openHarmony/openHarmony_node.js, line 1450 -
Place at center of one or more nodes with an offset.
Name Type Description oNodeArray
Array.<$.oNode> The array of nodes to center this below. xOffset
float The horizontal offset to apply after centering. yOffset
float The vertical offset to apply after centering. Returns:
Type Description oPoint The resulting position of the node. -
inherited refreshAttributes(oNodeObject){bool}
openHarmony/openHarmony_node.js, line 1880 -
Refreshes/rebuilds the attributes and getter/setters.
Name Type Description oNodeObject
$.oNode The node to link this one's inport to. Returns:
Type Description bool The result of the unlink. -
inherited remove(deleteColumns, deleteElements){void}
openHarmony/openHarmony_node.js, line 1673 -
Removes the node from the scene.
Name Type Description deleteColumns
bool Should the columns of drawings be deleted as well? deleteElements
bool Should the elements of drawings be deleted as well? Returns:
Type Description void -
inherited removeAttribute(attrName){bool}
openHarmony/openHarmony_node.js, line 1869 -
Removes an existing dynamic attribute in the node.
Name Type Description attrName
string The attribute name to remove. Returns:
Type Description bool The result of the removal. -
showDrawingAtFrame(drawing, frameNum)
openHarmony/openHarmony_node.js, line 2193 -
Displays the given drawing at the given frame
Name Type Description drawing
$.oDrawing frameNum
int -
obtains the nodes contained in the group, allows recursive search. This method is deprecated and was moved to oGroupNode
Name Type Description recurse
bool Whether to recurse internally for nodes within children groups. - Deprecated
- Yes
Returns:
Type Description Array.<$.oNode> The subbnodes contained in the group. -
inherited timelineIndex(timeline){int}
openHarmony/openHarmony_node.js, line 1355 -
Retrieves the node index in the timeline provided.
Name Type Description timeline
oTimeline optional Optional: the timeline object to search the column Layer. (by default, grabs the current timeline) Returns:
Type Description int The index within that timeline. -
inherited toString(){string}
openHarmony/openHarmony_node.js, line 1727 -
Used in converting the node to a string value, provides the string-path.
Returns:
Type Description string The node path's as a string. -
inherited unlinkInNode(oNodeObject){bool}
openHarmony/openHarmony_node.js, line 970 -
Searches for and unlinks the $.oNode object from this node's inNodes.
Name Type Description oNodeObject
$.oNode The node to link this one's inport to. Returns:
Type Description bool The result of the unlink. -
inherited unlinkInPort(inPort){bool}
openHarmony/openHarmony_node.js, line 990 -
Unlinks a specific port from this node's inport.
Name Type Description inPort
int The inport to disconnect. Returns:
Type Description bool The result of the unlink, if successful. -
inherited unlinkOutNode(oNodeObject){bool}
openHarmony/openHarmony_node.js, line 1200 -
Links this node's out-port to the given module, at the inport and outport indices.
Name Type Description oNodeObject
$.oNode The node to unlink from this node's outports. Returns:
Type Description bool The result of the link, if successful. -
inherited unlinkOutPort(outPort, outLink){bool}
openHarmony/openHarmony_node.js, line 1233 -
Unlinks a specific port/link from this node's output.
Name Type Description outPort
int The outPort to disconnect. outLink
int The outLink to disconnect. Returns:
Type Description bool The result of the unlink, if successful. -
unlinkPalette(oPaletteObject){bool}
openHarmony/openHarmony_node.js, line 2217 -
Unlinks an Element Palette from a drawing node.
Name Type Description oPaletteObject
$.oPalette the palette to unlink from the node Returns:
Type Description bool The success of the unlink operation. -
update(sourcePath, drawingName)
openHarmony/openHarmony_node.js, line 2258 -
Updates the imported drawings in the node.
Name Type Description sourcePath
$.oFile the oFile object pointing to the source to update from drawingName
string optional the drawing to import the updated bitmap into - TODO
-
- implement a memory of the source through metadata