Class: wcNode

wcNode


new wcNode(parent, pos)

The foundation class for all nodes.
When inheriting, make sure to include 'this._super(parent, pos);' at the top of your init functions.
Should be inherited and never constructed directly.

Parameters:
Name Type Description
parent string The parent object of this node.
pos wcPlay~Coordinates The position of this node in the visual editor.
Source:

Members


<static> var CONNECT_RESULT

The connection result.

Type:
  • string
Properties:
Name Type Default Description
NOT_FOUND string not_found
ALREADY_CONNECTED string already_connected
REFUSED string refused
SUCCESS string success
Source:

The type of node link.

Type:
  • string
Properties:
Name Type Default Description
ENTRY string entry
EXIT string exit
INPUT string input
OUTPUT string output
Source:

var name

The title name of this node, editable by the user and shown in the editor view.

Type:
  • string
Source:

Methods


function activateEntry(name, fromNode, fromName [, tracker]) -> boolean

Activates an entry link and activates this node.

Parameters:
Name Type Argument Description
name string The name of the entry link to trigger.
fromNode wcNode The node triggering the entry.
fromName string The Exit link name.
tracker wcPlay~FlowTracker <optional>
Optional flow tracker.
Source:
Returns:
- Fails if the entry link does not exist.
Type
boolean

function activateExit(name [, done]) -> boolean

Activates an exit link.

Parameters:
Name Type Argument Description
name string The name of the exit link to trigger.
done function <optional>
An optional callback to call when the entire exit chain has finished.
Source:
Returns:
- Fails if the exit link does not exist or this node is disabled.
Type
boolean

function activateProperty(name, value [, upstream])

Activates a property that is about to be changed by the output of another property.

Parameters:
Name Type Argument Description
name string The name of the property.
value Object The new value of the property.
upstream boolean <optional>
If true, the activation was from a property in its output, and we are propagating in reverse.
Source:

function ajax( [url] [, options]) -> jqXHR | function

Utility function for performing an AJAX request in a way that is compatible with live debugging in the editor tool.
The success, error, and complete callback functions are changed so that the 'this' object is the node instance, or the custom context if you provided a context in your options.
Note: This method specifically uses JQuery for the ajax operation, so you will need to include that library if you intend to use this.

Parameters:
Name Type Argument Description
url string <optional>
Option URL to send the request, if not supplied, it should be provided in the options parameter.
options Object <optional>
The options for the request, as described here: http://api.jquery.com/jquery.ajax/.
Source:
Returns:
- The jQuery XHR object generated by the ajax request. If an older version of jQuery is used, you will receive a function instead.
Type
jqXHR | function

function beginThread(id) -> number

If your node takes time to process, call this to begin a thread that will keep the node 'active' until you close the thread with wcNode#finishThread.
This ensures that, even if a node is executed more than once at the same time, each 'thread' is kept track of individually.
Note: This is not necessary if your node executes immediately without a timeout. Also Note: If using a setTimeout event, it is recommended that you use wcNode#setTimeout instead.

Parameters:
Name Type Description
id Number | function The thread ID, generated by a call to setTimeout, setInterval, or a function to call when we want to force cancel the job.
Source:
Returns:
- The id that was given wcNode#finishThread.
Type
number
Example
onActivated: function(name) {
   this._super(name);

   // Always fire the 'out' link immediately.
   this.activateExit('out');

   // Now set a timeout to wait for 'Milliseconds' amount of time.
   var self = this;
   var delay = this.property('milliseconds');

   // Start a new thread that will keep the node alive until we are finished.
   var thread = this.beginThread(setTimeout(function() {
     // Once the time has completed, fire the 'Finished' link and finish our thread.
     self.activateExit('finished');
     self.finishThread(thread);
   }, delay));
 }

function connectEntry(name, targetNode, targetName) -> wcNode.CONNECT_RESULT

Connects an entry link on this node to an exit link of another.

Parameters:
Name Type Description
name string The name of the entry link on this node.
targetNode wcNode The target node to link to.
targetName string The name of the target node's exit link to link to.
Source:
Returns:
- The result.
Type
wcNode.CONNECT_RESULT

function connectExit(name, targetNode, targetName) -> wcNode.CONNECT_RESULT

Connects an exit link on this node to an entry link of another.

Parameters:
Name Type Description
name string The name of the exit link on this node.
targetNode wcNode The target node to link to.
targetName string The name of the target node's entry link to link to.
Source:
Returns:
- The result.
Type
wcNode.CONNECT_RESULT

function connectInput(name, targetNode, targetName) -> wcNode.CONNECT_RESULT

Connects a property input link to a target property output link.

Parameters:
Name Type Description
name string The name of the property being connected.
targetNode wcNode The target node to connect with.
targetName string The name of the property on the target node to connect with.
Source:
Returns:
- The result.
Type
wcNode.CONNECT_RESULT

function connectOutput(name, targetNode, targetName) -> wcNode.CONNECT_RESULT

Connects a property output link to a target property input link.

Parameters:
Name Type Description
name string The name of the property being connected.
targetNode wcNode The target node to connect with.
targetName string The name of the property on the target node to connect with.
Source:
Returns:
- The result.
Type
wcNode.CONNECT_RESULT

function createEntry(name [, description]) -> boolean

Creates a new entry link on the node.

Parameters:
Name Type Argument Description
name string The name of the entry link.
description string <optional>
An optional description to display as a tooltip for this link.
Source:
Returns:
- Fails if the entry link name already exists.
Type
boolean

function createExit(name [, description]) -> boolean

Creates a new exit link on the node.

Parameters:
Name Type Argument Description
name string The name of the exit link.
description string <optional>
An optional description to display as a tooltip for this link.
Source:
Returns:
- Fails if the exit link name already exists.
Type
boolean

function createProperty(name, type [, initialValue] [, options]) -> boolean

Creates a new property.

Parameters:
Name Type Argument Description
name string The name of the property.
type wcPlay.PROPERTY The type of property.
initialValue Object <optional>
A initial value for this property when the script starts.
options Object <optional>
Additional options for this property, see wcPlay.PROPERTY.
Source:
Returns:
- Fails if the property does not exist.
Type
boolean

function debugBreak( [enabled]) -> boolean

Sets, or Gets this node's debug pause state.

Parameters:
Name Type Argument Description
enabled boolean <optional>
If supplied, will assign a new debug pause state.
Source:
Returns:
- The current debug pause state.
Type
boolean

function debugLog( [enabled]) -> boolean

Sets, or Gets this node's debug log state.

Parameters:
Name Type Argument Description
enabled boolean <optional>
If supplied, will assign a new debug log state.
Source:
Returns:
- The current debug log state.
Type
boolean

function description( [description]) -> string

Gets, or Sets the description for this node. This is usually shown as a tooltip for the node within the editor tool.

Parameters:
Name Type Argument Description
description string <optional>
If supplied, will assign a new description for this node.
Source:
Returns:
- The current description of this node.
Type
string

function destroy()

Destroys and removes the node.

Source:

function details( [details]) -> string

Gets, or Sets the very verbose description details for this node. This is usually shown as a popup dialog to further explain the user of the node.

Parameters:
Name Type Argument Description
details string <optional>
If supplied, will assign a new description details for this node.
Source:
Returns:
- The current description details of this node.
Type
string

function disconnectEntry(name [, targetNode] [, targetName]) -> wcNode.CONNECT_RESULT

Disconnects a chain, or all chains, from an entry link.

Parameters:
Name Type Argument Description
name string The name of the entry link.
targetNode wcNode <optional>
If supplied, will only remove links to the specified target node.
targetName string <optional>
If supplied, will only remove links to the specified named exit links.
Source:
Returns:
- The result of the disconnection.
Type
wcNode.CONNECT_RESULT

function disconnectExit(name [, targetNode] [, targetName]) -> wcNode.CONNECT_RESULT

Disconnects a chain, or all chains, from an exit link.

Parameters:
Name Type Argument Description
name string The name of the exit link.
targetNode wcNode <optional>
If supplied, will only remove links to the specified target node.
targetName string <optional>
If supplied, will only remove links to the specified named entry links.
Source:
Returns:
- The result of the disconnection.
Type
wcNode.CONNECT_RESULT

function disconnectInput(name [, targetNode] [, targetName]) -> wcNode.CONNECT_RESULT

Disconnects a chain, or all chains, from a property input.

Parameters:
Name Type Argument Description
name string The name of the property.
targetNode wcNode <optional>
If supplied, will only remove links to the specified target node.
targetName string <optional>
If supplied, will only remove links to the specified named property output links.
Source:
Returns:
- The result of the disconnection.
Type
wcNode.CONNECT_RESULT

function disconnectOutput(name [, targetNode] [, targetName]) -> wcNode.CONNECT_RESULT

Disconnects a chain, or all chains, from a property output.

Parameters:
Name Type Argument Description
name string The name of the property.
targetNode wcNode <optional>
If supplied, will only remove links to the specified target node.
targetName string <optional>
If supplied, will only remove links to the specified named property input links.
Source:
Returns:
- The result of the disconnection.
Type
wcNode.CONNECT_RESULT

function enabled( [enabled]) -> boolean

Sets, or Gets this node's enabled state.

Parameters:
Name Type Argument Description
enabled boolean <optional>
If supplied, will assign a new enabled state.
Source:
Returns:
- The current enabled state.
Type
boolean

function engine() -> wcPlay | null

Retrieves the wcPlay engine that owns this node.

Source:
Returns:
- Either the wcPlay engine, or null if it doesn't belong to one.
Type
wcPlay | null

function error(args)

Outputs an error message.

Parameters:
Name Type Argument Description
args string <repeatable>
The log messages.
Source:

function export( [minimal]) -> Object

Exports information about this node as well as all connected chain data so it can be imported later.

Parameters:
Name Type Argument Description
minimal boolean <optional>
If true, only the most important data should be exported, this means current values and redundant link connections are omitted.
Source:
Returns:
- The exported data for this node.
Type
Object

function extend(className, displayName, category, classDef)

Inherits a new class from this node.

Parameters:
Name Type Description
className string The class name for your node, this should be unique between all global class names.
displayName string The display name of your node.
category string The category to display your node in the editor palette.
classDef Object An object that defines your class with all functions and variables.
Source:

function fetch(url [, options]) -> Promise.<Object>

Utility function for performing a fetch request in a way that is compatible with live debugging in the editor tool.
The success, error, and complete callback functions are changed so that the 'this' object is the node instance, or the custom context if you provided a context in your options.
Note: This method specifically uses browsers fetch which is an experimental technology and not supported by all browsers unless a polyfill is used.

Parameters:
Name Type Argument Description
url string URL to send the request.
options Object <optional>
The options for the request, as described here: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch.
Source:
See:
Returns:
- The promise object that carries the response. This will throw if the response was not a success.
Type
Promise.<Object>

function finishThread(id)

Finishes a previously started thread from wcNode#beginThread.
Note: If you do not properly finish a thread that was generated, your node will remain forever in its active state.

Parameters:
Name Type Description
id Number | function The thread ID to close, returned to you by the call to wcNode#beginThread.
Source:

function import(data [, idMap])

Imports previously exported data to generate this node.

Parameters:
Name Type Argument Description
data Object The data to import.
idMap Array.<Number> <optional>
If supplied, identifies a mapping of old ID's to new ID's, any not found in this list will be unchanged.
Source:

function initialProperty(name [, value] [, forceOrSilent] [, forceUpstream] [, undo]) -> Object | undefined

Gets, or Sets the initial value of a property.

Parameters:
Name Type Argument Description
name string The name of the property.
value Object <optional>
If supplied, will assign a new default value to the property.
forceOrSilent boolean <optional>
If supplied, true will force the change event to be sent to all chained properties even if this value didn't change while false will force the change to not be chained.
forceUpstream boolean <optional>
Contrary to normal operation, if this is true then the property change will be sent backwards, from this property's input link to any outputs connected to it.
undo external:wcUndoManager <optional>
If the change is triggered by the user and undo management is enabled, this will be the undo manager.
Source:
Returns:
- The default value of the property, or undefined if not found.
Type
Object | undefined

function isBroken() -> boolean

Retrieves whether the node has been broken via breakpoint in the debugger tool.

Source:
Returns:
- Whether the script is 'broken' (paused).
Type
boolean

function listEntryChains( [name] [, ignoreNodes]) -> Array.<wcNode~ChainData>

Retrieves a list of all chains connected to an entry link on this node.

Parameters:
Name Type Argument Description
name string <optional>
The entry link, if omitted, all link chains are retrieved.
ignoreNodes Array.<wcNode> <optional>
If supplied, will ignore all chains connected to a node in this list.
Source:
Returns:
- A list of all chains connected to this link, if the link was not found, an empty list is returned.
Type
Array.<wcNode~ChainData>

function listExitChains( [name] [, ignoreNodes]) -> Array.<wcNode~ChainData>

Retrieves a list of all chains connected to an exit link on this node.

Parameters:
Name Type Argument Description
name string <optional>
The exit link, if omitted, all link chains are retrieved.
ignoreNodes Array.<wcNode> <optional>
If supplied, will ignore all chains connected to a node in this list.
Source:
Returns:
- A list of all chains connected to this link, if the link was not found, an empty list is returned.
Type
Array.<wcNode~ChainData>

function listInputChains( [name] [, ignoreNodes]) -> Array.<wcNode~ChainData>

Retrieves a list of all chains connected to a property input link on this node.

Parameters:
Name Type Argument Description
name string <optional>
The property input link, if omitted, all link chains are retrieved.
ignoreNodes Array.<wcNode> <optional>
If supplied, will ignore all chains connected to a node in this list.
Source:
Returns:
- A list of all chains connected to this link, if the link was not found, an empty list is returned.
Type
Array.<wcNode~ChainData>

function listOutputChains( [name] [, ignoreNodes]) -> Array.<wcNode~ChainData>

Retrieves a list of all chains connected to a property output link on this node.

Parameters:
Name Type Argument Description
name string <optional>
The property output link, if omitted, all link chains are retrieved.
ignoreNodes Array.<wcNode> <optional>
If supplied, will ignore all chains connected to a node in this list.
Source:
Returns:
- A list of all chains connected to this link, if the link was not found, an empty list is returned.
Type
Array.<wcNode~ChainData>

function listProperties( [minimal]) -> Array.<wcNode~PropertyData>

Retrieves a list of all properties and their values for this node.

Parameters:
Name Type Argument Description
minimal boolean <optional>
If true, only the minimal data is listed, this means current values will be omitted.
Source:
Returns:
- A list of all property data.
Type
Array.<wcNode~PropertyData>

function log(args)

Outputs a log message.

Parameters:
Name Type Argument Description
args string <repeatable>
The log messages.
Source:

function onActivated(name)

Event that is called when an entry link has been activated.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
name string The name of the entry link triggered.
Source:

function onConnect(isConnecting, name, type, targetNode, targetName, targetType)

Event that is called when a connection has been made.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
isConnecting boolean True if a connection is being made, false if it is a disconnection.
name string The name of the link being connected to.
type wcNode.LINK_TYPE The link's type.
targetNode wcNode The target node being connected to.
targetName string The link name on the target node being connected to.
targetType wcNode.LINK_TYPE The target link's type.
Source:

function onDestroyed()

Event that is called after the node has been destroyed.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Source:

function onDestroying()

Event that is called when the node is about to be destroyed.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Source:

function onDraw()

Event that is called when this node is about to be drawn.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Source:

function onExport(data [, minimal])

Event that is called when the node is being exported, after the export data has been configured.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Argument Description
data Object The export data for this node.
minimal boolean <optional>
If true, only the most important data should be exported, this means current values and redundant link connections are omitted.
Source:

function onGlobalInitialPropertyChanged(name, oldValue, newValue)

Event that is called when a global property initial value has changed. Overload this in inherited nodes.
Note: Do not call 'this._super(..)' for this function, as the parent does not implement it.

Parameters:
Name Type Description
name string The name of the global property.
oldValue Object The old value of the global property.
newValue Object The new value of the global property.
Source:

function onGlobalPropertyChanged(name, oldValue, newValue)

Event that is called when a global property value has changed. Overload this in inherited nodes.
Note: Do not call 'this._super(..)' for this function, as the parent does not implement it.

Parameters:
Name Type Description
name string The name of the global property.
oldValue Object The old value of the global property.
newValue Object The new value of the global property.
Source:

function onGlobalPropertyRemoved(name)

Event that is called when a global property has been removed. Overload this in inherited nodes.
Note: Do not call 'this._super(..)' for this function, as the parent does not implement it.

Parameters:
Name Type Description
name string The name of the global property.
Source:

function onGlobalPropertyRenamed(oldName, newName)

Event that is called when a global property has been renamed. Overload this in inherited nodes.
Note: Do not call 'this._super(..)' for this function, as the parent does not implement it.

Parameters:
Name Type Description
oldName string The old name of the global property.
newName string The new name of the global property.
Source:

function onImported(data [, idMap])

Event that is called after the node has imported.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Argument Description
data Object The data being imported.
idMap Array.<Number> <optional>
If supplied, identifies a mapping of old ID's to new ID's, any not found in this list will be unchanged.
Source:

function onImporting(data [, idMap])

Event that is called when the node is about to be imported. This is your chance to prepare the node for import, or possibly modify the import data.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Argument Description
data Object The data being imported.
idMap Array.<Number> <optional>
If supplied, identifies a mapping of old ID's to new ID's, any not found in this list will be unchanged.
Source:

function onInitialPropertyChanged(name, oldValue, newValue [, undo])

Event that is called when a property initial value has changed.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Argument Description
name string The name of the property.
oldValue Object The old value of the property.
newValue Object The new value of the property.
undo external:wcUndoManager <optional>
If the change is triggered by the user and undo management is enabled, this will be the undo manager. Note: The value change is already recorded, use this only if you have other things to record.
Source:

function onInitialPropertyChanging(name, oldValue, newValue [, undo]) -> Object

Event that is called when a property initial value is about to be changed.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Argument Description
name string The name of the property.
oldValue Object The current value of the property.
newValue Object The new, proposed, value of the property.
undo external:wcUndoManager <optional>
If the change is triggered by the user and undo management is enabled, this will be the undo manager. Note: The value change is already recorded, use this only if you have other things to record.
Source:
Returns:
- Return the new value of the property (usually newValue unless you are proposing restrictions). If no value is returned, newValue is assumed.
Type
Object

function onInitialPropertyGet(name) -> Object | undefined

Event that is called when the property initial value is being asked its value, before the value is actually retrieved.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
name string The name of the property.
Source:
Returns:
- If a value is returned, that value is what will be retrieved from the get.
Type
Object | undefined

function onMoved(oldPos, newPos)

Event that is called after the node has changed its position.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
oldPos wcPlay~Coordinates The old position of the node.
newPos wcPlay~Coordinates The new position of the node.
Source:

function onMoving(oldPos, newPos) -> wcPlay~Coordinates | undefined

Event that is called when the node is about to change its position.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
oldPos wcPlay~Coordinates The current position of the node.
newPos wcPlay~Coordinates The new position to move the node.
Source:
Returns:
- Return the new position of the node (usually newPos unless you are restricting the position). If no value is returned, newPos is assumed.
Type
wcPlay~Coordinates | undefined

function onNameChanged(oldName, newName [, undo])

Event that is called when the name of this node has changed.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Argument Description
oldName string The current name.
newName string The new name.
undo external:wcUndoManager <optional>
If the change is triggered by the user and undo management is enabled, this will be the undo manager. Note: The value change is already recorded, use this only if you have other things to record.
Source:

function onNameChanging(oldName, newName) -> string | undefined

Event that is called when the name of this node is about to change.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
oldName string The current name.
newName string The new name.
Source:
Returns:
- Return the new value of the name (usually newValue unless you are restricting the name). If no value is returned, newValue is assumed.
Type
string | undefined

function onNameEditSuggestion() -> Array.<wcNode~SelectItem> | Array.<String> | undefined

Event that is called when the node's name is about to be edited by the user.
You can use this to suggest a list of names that the user can conveniently choose from.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Source:
See:
Returns:
- An option list of options to display for the user as suggestions.
Type
Array.<wcNode~SelectItem> | Array.<String> | undefined

function onPropertyChanged(name, oldValue, newValue [, undo])

Event that is called when a property has changed.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Argument Description
name string The name of the property.
oldValue Object The old value of the property.
newValue Object The new value of the property.
undo external:wcUndoManager <optional>
If the change is triggered by the user and undo management is enabled, this will be the undo manager. Note: The value change is already recorded, use this only if you have other things to record.
Source:

function onPropertyChanging(name, oldValue, newValue [, undo]) -> Object

Event that is called when a property is about to be changed.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Argument Description
name string The name of the property.
oldValue Object The current value of the property.
newValue Object The new, proposed, value of the property.
undo external:wcUndoManager <optional>
If the change is triggered by the user and undo management is enabled, this will be the undo manager. Note: The value change is already recorded, use this only if you have other things to record.
Source:
Returns:
- Return the new value of the property (usually newValue unless you are proposing restrictions). If no value is returned, newValue is assumed.
Type
Object

function onPropertyGet(name) -> Object | undefined

Event that is called when the property is being asked its value, before the value is actually retrieved.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
name string The name of the property.
Source:
Returns:
- If a value is returned, that value is what will be retrieved from the get.
Type
Object | undefined

function onReset()

Event that is called when the node is about to be reset.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Source:

function onStart()

Event that is called as soon as the Play script has started.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Source:

function onStop()

Event that is called as soon as the Play script has stopped.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Source:

function onViewportDraw(context, readOnly)

Event that is called when it is time to draw the contents of your custom viewport. It is up to you to stay within the wcNode.viewportSize you've specified.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
context external:Canvas~Context The canvas context to draw on, coordinates 0,0 will be the top left corner of your viewport. It is up to you to stay within the viewport bounds you have assigned.
readOnly boolean The editors readonly status, when true, you should not allow changes to the node.
Source:
See:

function onViewportMouseClick(event, pos, readOnly)

Event that is called when the mouse button is pressed and released in the same spot over your viewport area.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
event Object The original jquery mouse event.
pos wcPlay~Coordinates The position of the mouse relative to the viewport area (top left corner is 0,0).
readOnly boolean The editors readonly status, when true, you should not allow changes to the node.
Source:

function onViewportMouseDoubleClick(event, pos, readOnly) -> Boolean | undefined

Event that is called when the mouse button is double clicked in the same spot over your viewport area.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
event Object The original jquery mouse event.
pos wcPlay~Coordinates The position of the mouse relative to the viewport area (top left corner is 0,0).
readOnly boolean The editors readonly status, when true, you should not allow changes to the node.
Source:
Returns:
- Return true if you want to disable node auto-collapse when double clicking.
Type
Boolean | undefined

function onViewportMouseDown(event, pos, readOnly) -> Boolean | undefined

Event that is called when the mouse button is pressed over your viewport area.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
event Object The original jquery mouse event.
pos wcPlay~Coordinates The position of the mouse relative to the viewport area (top left corner is 0,0).
readOnly boolean The editors readonly status, when true, you should not allow changes to the node.
Source:
Returns:
- Return true if you want to disable node dragging during mouse down within your viewport.
Type
Boolean | undefined

function onViewportMouseEnter(event, pos, readOnly)

Event that is called when the mouse has entered the viewport area.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
event Object The original jquery mouse event.
pos wcPlay~Coordinates The position of the mouse relative to the viewport area (top left corner is 0,0).
readOnly boolean The editors readonly status, when true, you should not allow changes to the node.
Source:

function onViewportMouseLeave(event, readOnly)

Event that is called when the mouse has left the viewport area.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
event Object The original jquery mouse event.
readOnly boolean The editors readonly status, when true, you should not allow changes to the node.
Source:

function onViewportMouseMove(event, pos, readOnly)

Event that is called when the mouse has moved over your viewport area.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
event Object The original jquery mouse event.
pos wcPlay~Coordinates The position of the mouse relative to the viewport area (top left corner is 0,0).
readOnly boolean The editors readonly status, when true, you should not allow changes to the node.
Source:

function onViewportMouseUp(event, pos, readOnly)

Event that is called when the mouse button is released over your viewport area.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
event Object The original jquery mouse event.
pos wcPlay~Coordinates The position of the mouse relative to the viewport area (top left corner is 0,0).
readOnly boolean The editors readonly status, when true, you should not allow changes to the node.
Source:

function onViewportMouseWheel(event, pos, scrollDelta, readOnly)

Event that is called when the mouse wheel is used over your viewport area.
Overload this in inherited nodes, be sure to call 'this._super(..)' at the top.

Parameters:
Name Type Description
event Object The original jquery mouse event.
pos wcPlay~Coordinates The position of the mouse relative to the viewport area (top left corner is 0,0).
scrollDelta number The scroll amount and direction.
readOnly boolean The editors readonly status, when true, you should not allow changes to the node.
Source:

function paused(paused) -> boolean

Gets, or Sets whether this node is paused, or any nodes inside if it is a composite.
When pausing, all wcNode#setTimeout events are also paused so they don't jump ahead of the debugger.

Parameters:
Name Type Description
paused boolean If supplied, will assign a new paused state.
Source:
Returns:
- Whether this, or inner nodes, are paused.
Type
boolean

function pos( [pos]) -> wcPlay~Coordinates

Gets, or Sets the current position of the node.

Parameters:
Name Type Argument Description
pos wcPlay~Coordinates <optional>
If supplied, will assign a new position for this node.
Source:
Returns:
- The current position of this node.
Type
wcPlay~Coordinates

function property(name [, value] [, forceOrSilent] [, forceUpstream] [, undo]) -> Object | undefined

Gets, or Sets the value of a property.

Parameters:
Name Type Argument Description
name string The name of the property.
value Object <optional>
If supplied, will assign a new value to the property.
forceOrSilent boolean <optional>
If supplied, true will force the change event to be sent to all chained properties even if this value didn't change while false will force the change to not be chained.
forceUpstream boolean <optional>
Contrary to normal operation, if this is true then the property change will be sent backwards, from this property's input link to any outputs connected to it.
undo external:wcUndoManager <optional>
If the change is triggered by the user and undo management is enabled, this will be the undo manager.
Source:
Returns:
- The value of the property, or undefined if not found.
Type
Object | undefined

function propertyOptions(name) -> Object | null

Gets the options assigned to a property, you may change attributes from here.

Parameters:
Name Type Description
name string The name of the property.
Source:
Returns:
- The options object associated with the property, or null if the property does not exist.
Type
Object | null

function propertyType(name) -> wcPlay.PROPERTY | null

Gets the type of a property.

Parameters:
Name Type Description
name string The name of the property.
Source:
Returns:
- Returns null if the property was not found.
Type
wcPlay.PROPERTY | null

function removeEntry(name) -> boolean

Removes an entry link from the node.

Parameters:
Name Type Description
name string The name of the entry link to remove.
Source:
Returns:
- Fails if the link does not exist.
Type
boolean

function removeExit(name) -> boolean

Removes an exit link from the node.

Parameters:
Name Type Description
name string The name of the exit link to remove.
Source:
Returns:
- Fails if the link does not exist.
Type
boolean

function removeProperty(name) -> boolean

Removes a property from the node.

Parameters:
Name Type Description
name string The name of the property to remove.
Source:
Returns:
- Fails if the property does not exist.
Type
boolean

function renameEntry(oldName, newName) -> boolean

Renames an entry link on this node while preserving all connected chains.

Parameters:
Name Type Description
oldName string The old (current) name of the link.
newName string The new name of the link.
Source:
Returns:
- Fails if the new name already exists, or the old name does not.
Type
boolean

function renameExit(oldName, newName) -> boolean

Renames an exit link on this node while preserving all connected chains.

Parameters:
Name Type Description
oldName string The old (current) name of the link.
newName string The new name of the link.
Source:
Returns:
- Fails if the new name already exists, or the old name does not.
Type
boolean

function renameProperty(oldName, newName) -> boolean

Renames a property on this node while preserving all connected chains.

Parameters:
Name Type Description
oldName string The old (current) name of the link.
newName string The new name of the link.
Source:
Returns:
- Fails if the new name already exists, or the old name does not.
Type
boolean

function reset()

Resets all properties to their initial values.

Source:

function resetThreads()

Resets only latent running threads.

Source:

Determines whether a search value matches this node.

Parameters:
Name Type Description
search string The search value.
Source:
Returns:
- True if the search matches this node.
Type
boolean

function setInterval(callback, interval)


Utility function for setting an interval update in a way that is compatible with live debugging in the editor tool. Note: You can call wcNode#resetThreads if you want to cancel any existing intervals running on your node.

Parameters:
Name Type Description
callback function A callback function to call each time the time interval has elapsed. As an added convenience, 'this' will be the node instance.
interval number The time interval, in milliseconds, between each call to callback.
Source:
Example
onActivated: function(name) {
  var interval = this.property('milliseconds');
  this.resetThreads();

  this.setInterval(function() {
    this.activateExit('out');
  }, interval);
}

function setTimeout(callback, delay)

Utility function for setting a timed event in a way that is compatible with live debugging in the editor tool.

Parameters:
Name Type Description
callback function A callback function to call when the time has elapsed. As an added convenience, 'this' will be the node instance.
delay number The time delay, in milliseconds, to wait before calling the callback function.
Source:
Example
onActivated: function(name) {
  this._super(name);

  // Now set a timeout to wait for 'Milliseconds' amount of time.
  var delay = this.property('milliseconds');

  // Start a timeout event using the node's built in timeout handler.
  this.setTimeout(function() {
    this.activateExit('out');
  }, delay);
}

function viewportSize( [width] [, height]) -> wcPlay~Coordinates

Sets a size for the custom viewport.
The custom viewport is a rectangular area embedded into the node's visual display in which you can 'draw' whatever you wish. It appears below the title text and above properties.

Parameters:
Name Type Argument Description
width number <optional>
If supplied, assigns the width of the viewport desired. Use 0 or null to disable the viewport.
height number <optional>
If supplied, assigns the height of the viewport desired. Use 0 or null to disable the viewport.
Source:
See:
Returns:
- The current size of the viewport.
Type
wcPlay~Coordinates

Type Definitions


typedef var PROPERTY_ENABLED

Enabled property name.

Type:
  • string
Source:

typedef var ChainData

Basic information about a chain connection.

Type:
  • Object
Properties:
Name Type Description
inName String The name of the input or entry link this chain is connected to.
inNodeId Number The ID of the input or entry node this chain is connected to.
outName String The name of the output or exit link this chain is connected to.
outNodeId Number The ID of the output or exit node this chain is connected to.
Source:

typedef function CustomCreateFunc(node, name, value, isInitial, onChanged) -> external:jQuery~Object

A callback function to generate a custom property control, this should generate the necessary controls and return a containing control element.

Parameters:
Name Type Description
node wcNode The node.
name String The property name being changed.
value Object The property value.
isInitial Boolean If true, the property being changed is the initial value.
onChanged wcNode~CustomOnChangedFunc A function to call when the property value has been changed.
Source:
Returns:
- A containing element that contains the control.
Type
external:jQuery~Object

typedef function CustomOnChangedFunc(newValue)

Used with the custom property type, a callback to call when the property value has changed. This allows for proper undo management.

Parameters:
Name Type Description
newValue Object The new value.
Source:

typedef var CustomOptions

Options for a CUSTOM value.

Type:
  • Object
Properties:
Name Type Argument Description
description String <optional>
An optional description to display as a tooltip for this property.
display wcNode~PropertyDisplay <optional>
An optional function that will be called to retrieve the display string for the value/initial value for this property.
exportValue wcNode~ExportValue <optional>
An optional function that will retrieve the property's value when it is about to be exported to file.
input Boolean <optional>
If true, this property will have an input link so its value can be changed through script.
output Boolean <optional>
If true, this property will have an output link so its value can be retrieved through script.
inputCondition wcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property input.
outputCondition wcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property output.
linked Boolean <optional>
If true, the value and initial values will be linked and can not be separated. Changing either will change them both.
readOnly Boolean <optional>
If true, clicking this property will not show an editor.
onCreate wcNode~CustomCreateFunc <optional>
If supplied, will be called when the property control is being edited and should return an element to display the control.
Source:

typedef var NumberOptions

Options for a NUMBER value.

Type:
  • Object
Properties:
Name Type Argument Default Description
description String <optional>
An optional description to display as a tooltip for this property.
display wcNode~PropertyDisplay <optional>
An optional function that will be called to retrieve the display string for the value/initial value for this property.
exportValue wcNode~ExportValue <optional>
An optional function that will retrieve the property's value when it is about to be exported to file.
input Boolean <optional>
If true, this property will have an input link so its value can be changed through script.
output Boolean <optional>
If true, this property will have an output link so its value can be retrieved through script.
inputCondition wcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property input.
outputCondition wcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property output.
linked Boolean <optional>
If true, the value and initial values will be linked and can not be separated. Changing either will change them both.
readOnly Boolean <optional>
If true, clicking this property will not show an editor.
min Number <optional>
-Infinity The minimum value of the number range.
max Number <optional>
Infinity The maximum value of the number range.
step Number <optional>
1 The amount the value will go up or down when the user clicks the up and down arrow controls.
Source:

typedef var PropertyData

Basic information for a property.

Type:
  • Object
Properties:
Name Type Description
name String The name of the property.
type wcPlay.PROPERTY The type of the property.
value Object The current value of the property.
initialValue Object The initial value of the property.
options Object The options for this property.
Source:

typedef function PropertyDisplay(value, isInitial) -> String

Allows for overriding the display string for a property value as displayed on the node.
The `this` object will reference the node.

Parameters:
Name Type Description
value Object The value or initial value of the property to display.
isInitial Boolean If true, displaying the initial value for the property.
Source:
Returns:
- A string value to display on the node.
Type
String

typedef function PropertyLinkCondition(name, targetNode, targetLink)

A callback handler for testing whether a property link can connect with another.
The `this` object will reference the node.

Parameters:
Name Type Description
name String The name of your link being connected to.
targetNode wcNode The target node being connected with.
targetLink String The name of the targets link.
Source:

typedef var PropertyOptions

A set of options that apply to all property types.

Type:
  • Object
Properties:
Name Type Argument Description
description String <optional>
An optional description to display as a tooltip for this property.
display wcNode~PropertyDisplay <optional>
An optional function that will be called to retrieve the display string for the value/initial value for this property.
exportValue wcNode~ExportValue <optional>
An optional function that will retrieve the property's value when it is about to be exported to file.
input Boolean <optional>
If true, this property will have an input link so its value can be changed through script.
output Boolean <optional>
If true, this property will have an output link so its value can be retrieved through script.
inputCondition wcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property input.
outputCondition wcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property output.
linked Boolean <optional>
If true, the value and initial values will be linked and can not be separated. Changing either will change them both.
readOnly Boolean <optional>
If true, clicking this property will not show an editor.
Source:

typedef var SelectItem

A select property item.

Type:
  • Object
Properties:
Name Type Description
name String The display text to display for this item.
value String | Number The value to assign to the property when this property is selected.
Source:

typedef function SelectItemFunc(items)

A callback that dynamically retrieves a list of items to display in a Select property.

Parameters:
Name Type Description
items Array.<wcNode~SelectItem> | Array.<String> A list of items to display in the combo box.
Source:

typedef var SelectOptions

Options for a SELECT value.

Type:
  • Object
Properties:
Name Type Argument Default Description
description String <optional>
An optional description to display as a tooltip for this property.
display wcNode~PropertyDisplay <optional>
An optional function that will be called to retrieve the display string for the value/initial value for this property.
exportValue wcNode~ExportValue <optional>
An optional function that will retrieve the property's value when it is about to be exported to file.
input Boolean <optional>
If true, this property will have an input link so its value can be changed through script.
output Boolean <optional>
If true, this property will have an output link so its value can be retrieved through script.
inputCondition wcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property input.
outputCondition wcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property output.
linked Boolean <optional>
If true, the value and initial values will be linked and can not be separated. Changing either will change them both.
readOnly Boolean <optional>
If true, clicking this property will not show an editor.
items Array.<wcNode~SelectItem> | Array.<String> | wcNode~SelectItemFunc A list of items to display in the combo box, or a callback function that can dynamically retrieve a list.
allowNone Boolean <optional>
true If true, will allow the user to select '' as an option.
noneValue Object <optional>
If supplied, and allowNone is true, will assign the internal value of the '' option.
Source:

typedef var StringOptions

Options for a STRING value.

Type:
  • Object
Properties:
Name Type Argument Default Description
description String <optional>
An optional description to display as a tooltip for this property.
display wcNode~PropertyDisplay <optional>
An optional function that will be called to retrieve the display string for the value/initial value for this property.
exportValue wcNode~ExportValue <optional>
An optional function that will retrieve the property's value when it is about to be exported to file.
input Boolean <optional>
If true, this property will have an input link so its value can be changed through script.
output Boolean <optional>
If true, this property will have an output link so its value can be retrieved through script.
inputCondition wcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property input.
outputCondition wcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property output.
linked Boolean <optional>
If true, the value and initial values will be linked and can not be separated. Changing either will change them both.
readOnly Boolean <optional>
If true, clicking this property will not show an editor.
maxlength Number <optional>
Infinity The maximum number of characters allowed.
multiline Boolean <optional>
false Whether to use a multi-line text editor for this property.
items Array.<wcNode~SelectItem> | Array.<String> | wcNode~SelectItemFunc A list of items to drop down in a suggestion as the user types, or a callback function that can dynamically retrieve a list. See here for browser compatability information.
Source: