The Replicator Component creates a node for every row of a table, creating nodes ("replicants") and deleting them as the table changes. A node can be a full component and its contents.
It takes the node specified in the Master Node parameter, and for every row in the Template Table, makes a copy of the master.
The nodes that are created can be named in two ways. Copies can be named/numbered sequentially using
the prefix specified by the Node Prefix parameter:
item2, ... Alternately, copies can be named based on the string in a column of the table, specified with the Name from Table parameter.
If you want to create a node for the first row of the table, un-set the Ignore First Row parameter.
The replicants get laid out in a grid in the network, determined by the Layout and Layout Origin parameters.
The Replicator does not assume or require that the master and replicants are components – they can all be Movie File In TOPs if you want. It also does not assume or require that the replicants are clones. However the Master Node can be a component whose Clone parameter is set to itself, so that all nodes created are clones of the master.
For every replicant, you can run a script in the callback DAT where you can see some examples of typical cases that you can adapt. Here are some others:
- change the expression of a parameter:
c.par.display.expr = "op('thing')[op.digits, 'display']"
- Change the parameter expression mode:
c.par.display.mode = ParMode.EXPRESSIONThe mode is one of:
If only one line of a table changes, the other existing replicants are not changed or re-created.
This is an extremely powerful node type. Examples: a button gadget for each row of the table. a geometry component, which is replicated at every point of a 3D particle system, each behaving separately. You can feed the table of a Multi Touch In DAT directly to the Replicator to create something at each fingertip.
Example Files : see examples in the OP Snippets
Parameters - Replicator Page
/method - Choose between using a Template DAT Table where each row will create a replicant or using the Number of Replicants parameter below to set how many replications to make.
Number of Replicants
/numreplicants - Set number of replicants when using Replication Method = By Number above.
/template - Path to the table DAT that will drive the replicating.
Name from Table
/namefromtable - How the node names will be generated.
- Row Index: Uses the Node Prefix parameter followed by the row number. The default creates nodes named
item3.... (The top row is 0).
- Column by Index: The node name is in the column specified by a column number.
- Column by Name: The node name is in a column specified by a column name in the first row.
Ignore First Row
/ignorefirstrow - Do not create a node for the first row.
/colname - Name at the top of the column.
/colindex - Column number, starting from 0.
/nodeprefix - Add this prefix to all nodes.
/master - Which node or component to replicate.
/location - Where to put the replicant nodes. If the location is
.., it puts the nodes inside the parent, which is actually alongside the Replicator component. If you put
., it will put it inside itself, that is, inside the Replicator component. If left blank, it will error.
/maxnodes - Max number of nodes, to keep it under control.
/script - Tscript only (use callback DAT in python): For every replicant, you can run a script to customize it relative to the master, such as setting the Display or Clone parameters, or a Render flag. Replicator runs the script command to customize each replicant versus the master.
me.curItem can be used here to access the current item and make changes to it. Select one of the 3 entries in the drop menu to the right for some examples.
If you are using Tscript, some local variables are defined:
- $ITEM Name of current node being replicated.
- $MASTER Name of master node.
- $LOCATION Name of the location component.
The most common need is for the master to not display, and the replicants to display. For Panel components it is most commonly "
opparm $ITEM paneldisplay ( 1 )", and for Geometry components it is most commonly "
opset -d on $ITEM". Use the popup menu for some common scripts.
/callbacks - Path to a DAT containing callbacks for each event received. See replicatorCOMP_Class for usage.
/layout - How to lay out the new nodes - all in one place (Off), horizontally, vertically, or in a grid.
/layoutorigin1, layoutorigin2 - Where to lay out the new nodes, giving the XY location of the top-left node's bottom-left corner.
/increment - Staggers the replication of operaots to avoid large frame drops when creating replicants.
Recreate All Operators
/recreateall - Deletes all nodes it has created, then re-creates them using the template and its current parameters.
Recreate Missing Operators
/recreatemissing - Re-creates missing operators from the template table but does not delete and re-create already existing replicants.
Parameters - Common Page
/tileview - what is displayed in the Node Viewer.
- Network Viewer - displays the component's internal network in the viewer.
- Parameters - displays the component's parameters in the viewer.
- Operator Viewer - displays the viewer of the operator referenced in the Operator Viewer parameter below.
/opviewer - path to the operator used when the Node View parameter is set to Operator Viewer.
/clone - path to a Master Clone for this component.
/pathvar - set the name of a Path Variable for this component.