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> varCONNECT_RESULT -
The connection result.
Type:
- string
- Source:
Properties:
Name Type Default Description NOT_FOUNDstring not_found ALREADY_CONNECTEDstring already_connected REFUSEDstring refused SUCCESSstring success -
<static> varLINK_TYPE -
The type of node link.
Type:
- string
- Source:
Properties:
Name Type Default Description ENTRYstring entry EXITstring exit INPUTstring input OUTPUTstring output -
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 namestring The name of the entry link to trigger. fromNodewcNode The node triggering the entry. fromNamestring The Exit link name. trackerwcPlay~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 namestring The name of the exit link to trigger. donefunction <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 namestring The name of the property. valueObject The new value of the property. upstreamboolean <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 urlstring <optional>
Option URL to send the request, if not supplied, it should be provided in the options parameter. optionsObject <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 idNumber | 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 namestring The name of the entry link on this node. targetNodewcNode The target node to link to. targetNamestring The name of the target node's exit link to link to. - Source:
Returns:
- The 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 namestring The name of the exit link on this node. targetNodewcNode The target node to link to. targetNamestring The name of the target node's entry link to link to. - Source:
Returns:
- The result. -
function connectInput(name, targetNode, targetName) -> wcNode.CONNECT_RESULT -
Connects a property input link to a target property output link.
Parameters:
Name Type Description namestring The name of the property being connected. targetNodewcNode The target node to connect with. targetNamestring The name of the property on the target node to connect with. - Source:
Returns:
- The result. -
function connectOutput(name, targetNode, targetName) -> wcNode.CONNECT_RESULT -
Connects a property output link to a target property input link.
Parameters:
Name Type Description namestring The name of the property being connected. targetNodewcNode The target node to connect with. targetNamestring The name of the property on the target node to connect with. - Source:
Returns:
- The result. -
function createEntry(name [, description]) -> boolean -
Creates a new entry link on the node.
Parameters:
Name Type Argument Description namestring The name of the entry link. descriptionstring <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 namestring The name of the exit link. descriptionstring <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 namestring The name of the property. typewcPlay.PROPERTY The type of property. initialValueObject <optional>
A initial value for this property when the script starts. optionsObject <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 enabledboolean <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 enabledboolean <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 descriptionstring <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 detailsstring <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 namestring The name of the entry link. targetNodewcNode <optional>
If supplied, will only remove links to the specified target node. targetNamestring <optional>
If supplied, will only remove links to the specified named exit links. - Source:
Returns:
- The result of the disconnection. -
function disconnectExit(name [, targetNode] [, targetName]) -> wcNode.CONNECT_RESULT -
Disconnects a chain, or all chains, from an exit link.
Parameters:
Name Type Argument Description namestring The name of the exit link. targetNodewcNode <optional>
If supplied, will only remove links to the specified target node. targetNamestring <optional>
If supplied, will only remove links to the specified named entry links. - Source:
Returns:
- The result of the disconnection. -
function disconnectInput(name [, targetNode] [, targetName]) -> wcNode.CONNECT_RESULT -
Disconnects a chain, or all chains, from a property input.
Parameters:
Name Type Argument Description namestring The name of the property. targetNodewcNode <optional>
If supplied, will only remove links to the specified target node. targetNamestring <optional>
If supplied, will only remove links to the specified named property output links. - Source:
Returns:
- The result of the disconnection. -
function disconnectOutput(name [, targetNode] [, targetName]) -> wcNode.CONNECT_RESULT -
Disconnects a chain, or all chains, from a property output.
Parameters:
Name Type Argument Description namestring The name of the property. targetNodewcNode <optional>
If supplied, will only remove links to the specified target node. targetNamestring <optional>
If supplied, will only remove links to the specified named property input links. - Source:
Returns:
- The result of the disconnection. -
function enabled( [enabled]) -> boolean -
Sets, or Gets this node's enabled state.
Parameters:
Name Type Argument Description enabledboolean <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 argsstring <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 minimalboolean <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 classNamestring The class name for your node, this should be unique between all global class names. displayNamestring The display name of your node. categorystring The category to display your node in the editor palette. classDefObject 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 urlstring URL to send the request. optionsObject <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 idNumber | 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 dataObject The data to import. idMapArray.<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 namestring The name of the property. valueObject <optional>
If supplied, will assign a new default value to the property. forceOrSilentboolean <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. forceUpstreamboolean <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. undoexternal: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 namestring <optional>
The entry link, if omitted, all link chains are retrieved. ignoreNodesArray.<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 namestring <optional>
The exit link, if omitted, all link chains are retrieved. ignoreNodesArray.<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 namestring <optional>
The property input link, if omitted, all link chains are retrieved. ignoreNodesArray.<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 namestring <optional>
The property output link, if omitted, all link chains are retrieved. ignoreNodesArray.<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 minimalboolean <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 argsstring <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 namestring 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 isConnectingboolean True if a connection is being made, false if it is a disconnection. namestring The name of the link being connected to. typewcNode.LINK_TYPE The link's type. targetNodewcNode The target node being connected to. targetNamestring The link name on the target node being connected to. targetTypewcNode.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 dataObject The export data for this node. minimalboolean <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 namestring The name of the global property. oldValueObject The old value of the global property. newValueObject 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 namestring The name of the global property. oldValueObject The old value of the global property. newValueObject 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 namestring 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 oldNamestring The old name of the global property. newNamestring 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 dataObject The data being imported. idMapArray.<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 dataObject The data being imported. idMapArray.<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 namestring The name of the property. oldValueObject The old value of the property. newValueObject The new value of the property. undoexternal: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 namestring The name of the property. oldValueObject The current value of the property. newValueObject The new, proposed, value of the property. undoexternal: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 namestring 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 oldPoswcPlay~Coordinates The old position of the node. newPoswcPlay~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 oldPoswcPlay~Coordinates The current position of the node. newPoswcPlay~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 oldNamestring The current name. newNamestring The new name. undoexternal: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 oldNamestring The current name. newNamestring 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 namestring The name of the property. oldValueObject The old value of the property. newValueObject The new value of the property. undoexternal: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 namestring The name of the property. oldValueObject The current value of the property. newValueObject The new, proposed, value of the property. undoexternal: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 namestring 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 contextexternal: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. readOnlyboolean 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 eventObject The original jquery mouse event. poswcPlay~Coordinates The position of the mouse relative to the viewport area (top left corner is 0,0). readOnlyboolean 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 eventObject The original jquery mouse event. poswcPlay~Coordinates The position of the mouse relative to the viewport area (top left corner is 0,0). readOnlyboolean 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 eventObject The original jquery mouse event. poswcPlay~Coordinates The position of the mouse relative to the viewport area (top left corner is 0,0). readOnlyboolean 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 eventObject The original jquery mouse event. poswcPlay~Coordinates The position of the mouse relative to the viewport area (top left corner is 0,0). readOnlyboolean 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 eventObject The original jquery mouse event. readOnlyboolean 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 eventObject The original jquery mouse event. poswcPlay~Coordinates The position of the mouse relative to the viewport area (top left corner is 0,0). readOnlyboolean 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 eventObject The original jquery mouse event. poswcPlay~Coordinates The position of the mouse relative to the viewport area (top left corner is 0,0). readOnlyboolean 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 eventObject The original jquery mouse event. poswcPlay~Coordinates The position of the mouse relative to the viewport area (top left corner is 0,0). scrollDeltanumber The scroll amount and direction. readOnlyboolean 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 pausedboolean 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 poswcPlay~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 namestring The name of the property. valueObject <optional>
If supplied, will assign a new value to the property. forceOrSilentboolean <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. forceUpstreamboolean <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. undoexternal: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 namestring 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 namestring 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 namestring 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 namestring 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 namestring 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 oldNamestring The old (current) name of the link. newNamestring 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 oldNamestring The old (current) name of the link. newNamestring 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 oldNamestring The old (current) name of the link. newNamestring 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:
-
function search(search) -> boolean -
Determines whether a search value matches this node.
Parameters:
Name Type Description searchstring 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 callbackfunction A callback function to call each time the time interval has elapsed. As an added convenience, 'this' will be the node instance. intervalnumber 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 callbackfunction A callback function to call when the time has elapsed. As an added convenience, 'this' will be the node instance. delaynumber 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 widthnumber <optional>
If supplied, assigns the width of the viewport desired. Use 0 or null to disable the viewport. heightnumber <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
- Source:
Properties:
Name Type Description inNameString The name of the input or entry link this chain is connected to. inNodeIdNumber The ID of the input or entry node this chain is connected to. outNameString The name of the output or exit link this chain is connected to. outNodeIdNumber The ID of the output or exit node this chain is connected to. -
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 nodewcNode The node. nameString The property name being changed. valueObject The property value. isInitialBoolean If true, the property being changed is the initial value. onChangedwcNode~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 newValueObject The new value. - Source:
-
typedef var CustomOptions -
Options for a CUSTOM value.
Type:
- Object
- Source:
Properties:
Name Type Argument Description descriptionString <optional>
An optional description to display as a tooltip for this property. displaywcNode~PropertyDisplay <optional>
An optional function that will be called to retrieve the display string for the value/initial value for this property. exportValuewcNode~ExportValue <optional>
An optional function that will retrieve the property's value when it is about to be exported to file. inputBoolean <optional>
If true, this property will have an input link so its value can be changed through script. outputBoolean <optional>
If true, this property will have an output link so its value can be retrieved through script. inputConditionwcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property input. outputConditionwcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property output. linkedBoolean <optional>
If true, the value and initial values will be linked and can not be separated. Changing either will change them both. readOnlyBoolean <optional>
If true, clicking this property will not show an editor. onCreatewcNode~CustomCreateFunc <optional>
If supplied, will be called when the property control is being edited and should return an element to display the control. -
typedef var NumberOptions -
Options for a NUMBER value.
Type:
- Object
- Source:
Properties:
Name Type Argument Default Description descriptionString <optional>
An optional description to display as a tooltip for this property. displaywcNode~PropertyDisplay <optional>
An optional function that will be called to retrieve the display string for the value/initial value for this property. exportValuewcNode~ExportValue <optional>
An optional function that will retrieve the property's value when it is about to be exported to file. inputBoolean <optional>
If true, this property will have an input link so its value can be changed through script. outputBoolean <optional>
If true, this property will have an output link so its value can be retrieved through script. inputConditionwcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property input. outputConditionwcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property output. linkedBoolean <optional>
If true, the value and initial values will be linked and can not be separated. Changing either will change them both. readOnlyBoolean <optional>
If true, clicking this property will not show an editor. minNumber <optional>
-Infinity The minimum value of the number range. maxNumber <optional>
Infinity The maximum value of the number range. stepNumber <optional>
1 The amount the value will go up or down when the user clicks the up and down arrow controls. -
typedef var PropertyData -
Basic information for a property.
Type:
- Object
- Source:
Properties:
Name Type Description nameString The name of the property. typewcPlay.PROPERTY The type of the property. valueObject The current value of the property. initialValueObject The initial value of the property. optionsObject The options for this property. -
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 valueObject The value or initial value of the property to display. isInitialBoolean 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 nameString The name of your link being connected to. targetNodewcNode The target node being connected with. targetLinkString The name of the targets link. - Source:
-
typedef var PropertyOptions -
A set of options that apply to all property types.
Type:
- Object
- Source:
Properties:
Name Type Argument Description descriptionString <optional>
An optional description to display as a tooltip for this property. displaywcNode~PropertyDisplay <optional>
An optional function that will be called to retrieve the display string for the value/initial value for this property. exportValuewcNode~ExportValue <optional>
An optional function that will retrieve the property's value when it is about to be exported to file. inputBoolean <optional>
If true, this property will have an input link so its value can be changed through script. outputBoolean <optional>
If true, this property will have an output link so its value can be retrieved through script. inputConditionwcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property input. outputConditionwcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property output. linkedBoolean <optional>
If true, the value and initial values will be linked and can not be separated. Changing either will change them both. readOnlyBoolean <optional>
If true, clicking this property will not show an editor. -
typedef var SelectItem -
A select property item.
Type:
- Object
- Source:
Properties:
Name Type Description nameString The display text to display for this item. valueString | Number The value to assign to the property when this property is selected. -
typedef function SelectItemFunc(items) -
A callback that dynamically retrieves a list of items to display in a Select property.
Parameters:
Name Type Description itemsArray.<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
- Source:
Properties:
Name Type Argument Default Description descriptionString <optional>
An optional description to display as a tooltip for this property. displaywcNode~PropertyDisplay <optional>
An optional function that will be called to retrieve the display string for the value/initial value for this property. exportValuewcNode~ExportValue <optional>
An optional function that will retrieve the property's value when it is about to be exported to file. inputBoolean <optional>
If true, this property will have an input link so its value can be changed through script. outputBoolean <optional>
If true, this property will have an output link so its value can be retrieved through script. inputConditionwcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property input. outputConditionwcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property output. linkedBoolean <optional>
If true, the value and initial values will be linked and can not be separated. Changing either will change them both. readOnlyBoolean <optional>
If true, clicking this property will not show an editor. itemsArray.<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. allowNoneBoolean <optional>
true If true, will allow the user to select ' ' as an option. noneValueObject <optional>
If supplied, and allowNone is true, will assign the internal value of the ' ' option. -
typedef var StringOptions -
Options for a STRING value.
Type:
- Object
- Source:
Properties:
Name Type Argument Default Description descriptionString <optional>
An optional description to display as a tooltip for this property. displaywcNode~PropertyDisplay <optional>
An optional function that will be called to retrieve the display string for the value/initial value for this property. exportValuewcNode~ExportValue <optional>
An optional function that will retrieve the property's value when it is about to be exported to file. inputBoolean <optional>
If true, this property will have an input link so its value can be changed through script. outputBoolean <optional>
If true, this property will have an output link so its value can be retrieved through script. inputConditionwcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property input. outputConditionwcNode~PropertyLinkCondition <optional>
If supplied, returns whether a specified connection can be made to your property output. linkedBoolean <optional>
If true, the value and initial values will be linked and can not be separated. Changing either will change them both. readOnlyBoolean <optional>
If true, clicking this property will not show an editor. maxlengthNumber <optional>
Infinity The maximum number of characters allowed. multilineBoolean <optional>
false Whether to use a multi-line text editor for this property. itemsArray.<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.