Graph

A graph is a collection of nodes.

Constructor

new L3D.Graph(o)

Create a new Graph.

Parameters
o Object

options to configure the Graph with.

Extends

Properties

Overrides:
bypass bool

If the node is set as bypass, it will not be computed but instead will return data from the first compatible input.

Overrides:
disabled bool

If the node is disabled, it will not be computed.

Overrides:
enabled bool

If the node is enabled, it will be computed normally.

Overrides:
graph Graph

The graph this node belongs to.

Overrides:
id String

The unique identifier of the object. Changing a node's ID can have unintended consequences.

Overrides:
inputs Array

The list of inputs for the node.

Overrides:
isPlaying bool

Is the engine currently playing the scene?

Overrides:
name String

The name of the object.

Overrides:
nodePositionX number

The node's x position in the graph.

Overrides:
nodePositionY number

The node's y position in the graph.

nodes Array

The list of nodes in the graph.

Overrides:
nodeType String

The type of the node, as registered in the GraphManager.

Overrides:
numInputs number

The number of inputs for the node.

Overrides:
numOutputs number

The number of outputs for the node.

Overrides:
onModified Signal

Fired when the object has been modified.

Overrides:
onNameChanged Signal

Fired when the object's name changes.

Overrides:
outputs Array

The list of outputs for the node.

readOnly bool

If true, the nodes in the graph are read-only and can only be edited with referenceEdits.

Overrides:
scene Scene

The scene the graph belongs to.

Overrides:
state Object

Flags and other data for the node.

Overrides:
timeDependent bool

If true, the node will be invalidated before every update, forcing the nodes outputs to be recomputed.

Overrides:
title String

The title of the node

Methods

addInput(name, defaultValue, type, options) → nullable NodeInput

Overrides:

Add an input property to the node.

Parameters
name *

String name, or NodeInput to directly add.

defaultValue *
type *

If type is an Object, then it is the options, and the type is implied from the default value. If type is null, it is implied from the default value. Otherwise, if type is a string, it is an explicit declaration of the input's type.

options Object

Optional configuration for the input. Possible options are: {bool} isColor The Editor should tread this property as a color. {bool} noLabel The Editor should not display the label for this property. {String} label The label the Editor should use instead of the name. {bool} noConnections The property does not allow connections. It will not be displayed on the node graph node. {bool} isInt The number property should be treated as an integer. {number} min The minimum value of the property. {number} max The maximum value of the property. {number} precision The number of decimal places the Editor shows. {number} step The increment value to use for the number spinner in the Editor. {bool} disabled The Editor control should be shown as disabled. {Map,Array} enum The property should be treated as an enum by the Editor, and these are the strings (and associated values, if a Map) to allow the user to choose from.

Returns
NodeInput

addNode(node)

Add a node to the graph

Parameters
node GraphNode

The node to add

addOutput(name, type, options) → nullable NodeOutput

Overrides:

Add an output to the node.

Parameters
name String

The name of the output. This must be unique within the node.

type String

The data type of the output. If type is null, it is dynamic. If type is an Object, it is the options and type is considered dynamic.

options Object

Optional configuration for the output. Possible options are: {bool} noLabel Don't display the label for the output. {bool} noConnections Don't display a label or a connector for this output.

Returns
NodeOutput

attachCanvas(canvas)

Associate an Editor canvas with the graph, so that any changes to the graph can be communicated to the Editor.

Parameters
canvas GraphView

The editor graph view.

change()

Called when something visually changed. This will notify the editor.

clear()

Delete all nodes from the graph.

clearError()

Overrides:

Remove any error messages from the node.

clone(options) → Object

Overrides:

Creates a clone of this object.

Parameters
options Object

Options for the clone method.

Returns
Object

collapse(force)

Overrides:

Collapse the node to make it smaller on the canvas.

Parameters
force bool

configure(info)

Overrides:

Configure the graph from serialized JSON data

Parameters
info Object

connectionChanged()

Overrides:

Called when an input has been connected or disconnected.

createSceneObjects(scene)

Call the createSceneObjects method for all nodes.

Parameters
scene Scene

detachCanvas(The)

Detach a canvas from the graph.

Parameters
The GraphView

editor graph view.

findNodeById(id) → nullable GraphNode

Find a node given it's ID. This will also search sub-graphs.

Parameters
id String
Returns
GraphNode

getDynamicType() → String

Overrides:

Get the type of a dynamic output

Returns
String

getInput(name) → nullable NodeInput

Overrides:

Find the input with the given name.

Parameters
name String
Returns
NodeInput

getOutput(name) → nullable NodeOutput

Overrides:

Fidn the output with the given name.

Parameters
name String
Returns
NodeOutput

getPropertyInfo(path) → Object

Overrides:

Get information about a particular property of this object.

Parameters
path String
Returns
Object

getTypeFromData(data) → String

Overrides:

Get the implicit property type for a given data.

Parameters
data *
Returns
String

initialize(options)

Overrides:

Called by the constructor for the node implementation to add any inputs, outputs, and other initialization it wants to do.

Parameters
options Object

initializeAudioNode(options)

Overrides:

Configure the node as an AudioNode, using object MixIns instead of class inheritance.

Parameters
options Object

initializeBehaviorNode(options)

Overrides:

Configure the node as an BehaviorNode, using object MixIns instead of class inheritance.

Parameters
options Object

initializeConstraintNode(options)

Overrides:

Configure the node as a ConstraintNode, using object MixIns instead of class inheritance.

Parameters
options Object

initializeGeometryNode(options)

Overrides:

Configure the node as a GeometryNode, using object MixIns instead of class inheritance.

Parameters
options Object

initializeImageCompositeNode(options)

Overrides:

Configure the node as an ImageFilterNode, using object MixIns instead of class inheritance.

Parameters
options Object

initializeImageFilterNode(options)

Overrides:

Configure the node as an ImageFilterNode, using object MixIns instead of class inheritance.

Parameters
options Object

initializeImageNode(options)

Overrides:

Configure the node as an ImageNode, using object MixIns instead of class inheritance.

Parameters
options Object

initializeParticleNode(options)

Overrides:

Configure the node as an ParticleNode, using object MixIns instead of class inheritance.

Parameters
options Object

initializeSceneNode(options)

Overrides:

Configure the node as a SceneNode, using object MixIns instead of class inheritance.

Parameters
options Object

initializeTransformNode(options)

Overrides:

Configure the node with transformation properties.

Parameters
options Object

mouseMove(e)

Called by the InputManger when the mouse moves.

Parameters
e Event

The MouseEvent from the browser

removeNode()

Remove the node from the graph

removeOutput(name)

Overrides:

Remove an output from the node.

Parameters
name String

renameInput(input, newName)

Overrides:

Rename an input property.

Parameters
input NodeInput
newName String

renameOutput(output, newName)

Overrides:

Rename an output property.

Parameters
output NodeOutput
newName String

sendActionToCanvas(action, params)

Call a method on the canvases rendering this graph.

Parameters
action String

The name of the method.

params Array

Optional arguments to call the function with.

sendActionToNodes(action, params)

Call a method on all nodes in this graph.

Parameters
action String

The name of the method

params Array

Optional arguments to call the function with.

serialize() → Object

Overrides:

Serialize the graph to a JSON structure.

Returns
Object

The serialized graph

setDependency(input, output)

Overrides:

Define an explicit dependency between an input and an output, so that when an input is changed, it only dirties specific outputs in the case when the node has multiple outputs.

Parameters
input NodeInput | NodeOutput

Can be a NodeInput or NodeOutput

output NodeOutput

setDirty(from, fromShaderUniform)

Overrides:

Mark the node as dirty.

Parameters
from NodeInput

The input that caused the node to be dirty.

fromShaderUniform bool

If the dirty propagation was originated from a shader uniform output. This is used by Material nodes to avoid invalidating shader data unnecessarily causing shaders to be regenerated when a uniform value changes.

setError(message)

Overrides:

Set an error message for the node.

Parameters
message String

setModified()

Overrides:

Fires the objects onModified signal.

setNodePosition(x, y)

Overrides:

Set the node's position in the graph.

Parameters
x number
y number

timeChanged()

Overrides:

Called before an update when timeDependent is true.

toJSON() → Object

Overrides:

Serialize the object to a JSON structure

Returns
Object

The serialized version of the object.

updateMaterial(material)

Overrides:

Called to allow shader nodes to update uniform values for the material

Parameters
material Material

validateInputs()

Overrides:

Called to ensure the node has valid input connections.