new $.oNodeLink(outNode, outPort, inNode, inPort)
openHarmony/openHarmony_nodeLink.js, line 94
The base class for the oTimeline.
Name | Type | Description |
---|---|---|
outNode |
oNode | The source oNode of the link. |
outPort |
int | The outport of the outNode that is connecting the link. |
inNode |
oNode | The destination oNode of the link. |
inPort |
int | The inport of the inNode that is connecting the link. |
Properties:
Name | Type | Description |
---|---|---|
autoDisconnect |
bool | Whether to auto-disconnect links if they already exist. Defaults to true. |
Example
//Connect two pegs together.
var peg1 = $.scene.getNodeByPath( "Top/Peg1" );
var peg2 = $.scene.getNodeByPath( "Top/Peg2" );
//Create a new $.oNodeLink -- We'll connect two pegs with this new nodeLink.
var link = new $.oNodeLink( peg1, //Out Node
0, //Out Port
peg2, //In Node
0 ); //In Port
//The node link doesn't exist yet, but lets apply it.
link.apply();
//This connection between peg1 and peg2 now exists.
//We can also get the outlinks for the entire node and all of its outputs.
var outLinks = peg2.outLinks;
//Lets connect peg3 to the chain with this existing outLink. This will use an existing link if its already there, or create a new one if none exists.
var peg3 = $.scene.getNodeByPath( "Top/Peg3" );
outLinks[0].linkIn( peg3, 0 );
//Uh oh! We need to connect a peg between 1 and 2.
var peg4 = $.scene.getNodeByPath( "Top/Peg4" );
//The link we already created above can have a node inserted between it easily.
link.insertNode( peg4, 0, 0 ); //Peg to insert, in port, out port.
//Oh no! Peg 5 is in a group. Well, it still works!
var peg5 = $.scene.getNodeByPath( "Top/Group/Peg5" );
var newLink = peg1.addOutLink( peg5 );
Members
-
existsbool
-
Whether the nodeLink exists in the provided state.
Example
//Connect two pegs together. var peg1 = $.scene.getNodeByPath( "Top/Peg1" ); var peg2 = $.scene.getNodeByPath( "Top/NodeDoesntExist" ); var link = new $.oNodeLink( peg1, //Out Node 0, //Out Port peg2, //In Node 0 ); //In Port link.exists == false; //FALSE, This link doesnt exist in this context, because the node doesnt exist.
-
inNode$.oNode
-
The inNode of this $.oNodeLink. The inNode that is accepting this link on its inport.
-
inPortArray.<oNode>
-
The inPort of this $.oNodeLink.
-
outLinkint
-
The outLink of this $.oNodeLink. The link index that the outNode connected to for this link.
-
outNode$.oNode
-
The outnode of this $.oNodeLink. The outNode that is outputting the connection for this link on its outPort and outLink.
-
outPortint
-
The outport of this $.oNodeLink. The port that the outNode connected to for this link.
Methods
-
apply(force)
openHarmony/openHarmony_nodeLink.js, line 433 -
Apply the links as needed after unfreezing the oNodeLink
Name Type Description force
bool Forcefully reconnect/disconnect the note given the current settings of this nodelink. Example
//Connect two pegs together. var peg1 = $.scene.getNodeByPath( "Top/Peg1" ); var peg2 = $.scene.getNodeByPath( "Top/Peg2" ); //Create a new $.oNodeLink -- We'll connect two pegs with this new nodeLink. var link = new $.oNodeLink( peg1, //Out Node 0, //Out Port peg2, //In Node 0 ); //In Port //The node link doesn't exist yet, but lets apply it. link.apply();
-
insertNode(nodeToInsert, inPort, outPort)
openHarmony/openHarmony_nodeLink.js, line 401 -
Insert a node in the middle of the link chain.
Name Type Description nodeToInsert
oNode The node to link on the output. inPort
int The port to link on the output. outPort
int The port to link on the output. Example
//Connect two pegs together. var peg1 = $.scene.getNodeByPath( "Top/Peg1" ); var peg2 = $.scene.getNodeByPath( "Top/Peg2" ); //Create a new $.oNodeLink -- We'll connect two pegs with this new nodeLink. var link = new $.oNodeLink( peg1, //Out Node 0, //Out Port peg2, //In Node 0 ); //In Port //The link we already created above can have a node inserted between it easily. var peg4 = $.scene.getNodeByPath( "Top/Peg4" ); link.insertNode( peg4, 0, 0 ); //Peg to insert, in port, out port.
-
linkIn(onode, port)
openHarmony/openHarmony_nodeLink.js, line 344 -
Changes both the in-node and in-port at once.
Name Type Description onode
oNode The node to link on the input. port
int The port to link on the input. Example
//Connect two pegs together. var peg1 = $.scene.getNodeByPath( "Top/Peg1" ); var peg2 = $.scene.getNodeByPath( "Top/Peg2" ); var outLinks = peg1.outLinks; outLinks[0].linkIn( peg2, 0 ); //Links the input of peg2, port 0 -- to this link, connecting its outNode [peg1] and outPort [0] and outLink [arbitrary].
-
linkOut(onode, port)
openHarmony/openHarmony_nodeLink.js, line 368 -
Changes both the out-node and out-port at once.
Name Type Description onode
oNode The node to link on the output. port
int The port to link on the output. Example
//Connect two pegs together. var peg1 = $.scene.getNodeByPath( "Top/Peg1" ); var peg2 = $.scene.getNodeByPath( "Top/Peg2" ); var inLinks = peg1.inLinks; inLinks[0].linkOut( peg2, 0 ); //Links the output of peg2, port 0 -- to this link, connecting its inNode [peg1] and inPort [0].
-
toString()
openHarmony/openHarmony_nodeLink.js, line 1026 -
Converts the node link to a string.