Node

From sfx
Jump to navigation Jump to search

The Node object generates output (usually an image) based on a set of inputs (image data and properties).

Base Class: Object

Creation[edit]

Nodes are created with the Node(type) constructor, where type is the "node type id". A list of available nodes can be queried with the global fx.nodes attribute.

Note that internal nodes have names like RotoNode and PaintNode. Most of the rest of the stock Silhouette nodes are implemented using OFX, and have node IDs such as com.digitalfilmtools.ofx.silhouette.sfx_composite and com.digitalfilmtools.ofx.silhouette.blur.

Nodes can be connected to other nodes using Pipes and Ports. Ports have specific types (usuallying image or data) and can only be connected to other ports with the same type. Output ports can have multiple pipes connected to them but input ports may only have one.

<syntaxhighlight lang="python"> roto = Node("RotoNode") activeSession().addNode(roto)

slapComp = Node("com.digitalfilmtools.ofx.silhouette.slapComp") activeSession().addNode(slapComp)

roto.port("output").connect(slapComp.port("input")) </syntaxhighlight>

Attributes[edit]

Attributes are read-only except where noted.

Name Description Added
active True if the active node
enabled True if enabled (read/write)
imageToWorldTransform the Matrix used to transform from image coordinates to world coordinates
inputs List of input Ports
outputs List of output Ports
session the Session the node is in (same as parent)
worldToImageTransform the Matrix used to transform from world coordinates to image coordinates
outputMask the output streams it can produce. 6.0
state a dictionary of any extra node-specific state 6.0
connectedInputs list of connected input Ports 6.0
connectedOutputs list of connected output Ports 6.0
pipes list of connected pipes Pipes 6.0
ports list of all Ports 6.0
matte the "obey matte" input Port, or None if the node does not have one 6.0

Methods[edit]

Name Description Added
render(frame, stream=Stream_Left, channels=Channel_RGBA, depth=None, resolution=Proxy_FullRes, roi=None, port=None) render at the desired frame and returns a Raster with the result. depth and roi default to the Session's depth and ROI, respectively. If port is omitted, the first output Port will be used.
metadata(frame) returns a metadata dictionary derived from up-stream Sources for the specified frame 6.0
setState(key, value) sets the node state for key to value 6.0
disconnect(port) disconnect the Port 6.0
port(name) return the Port with the given name 6.0
getInput(index=0) return the input Port at index 6.0
getOutput(index=0) return the output Port at index 6.0