node_edit
Build and modify Houdini node networks by creating, deleting, copying, moving, renaming, wiring, or laying out nodes in one undo group.
Instructions
Change the nodes in a network. One item, or a list in one undo group.
Modes: create, delete, copy, move, rename, flags, color, layout, insert, place_chain, wrangle, material, assign_material, take, current_network, note, box, split.
Use it to build a network. Then use parm_set for the values, and connect
for the wires. Keep the default names that Houdini gives: leave `name`
out, except for the one Output SOP of a network (OUT_<NAME>). A create
that breaks a house rule (an Expression SOP, a second Output SOP, a long
wrangle) gives `house_rule` in its result.
Do not compute positions: create with input_path, insert and place_chain
place the nodes the way the user lays out a graph, move a node of the user
only down to make room, and return every node that moved with its old and
new position. Each returns the layout faults it sees.
Do not use it to set parameters: parm_set does that, and it reports a write
that had no effect.
mode, and the arguments that each mode reads:
"create" — node_type, parent_path, name, position,
parameters, input_path. context selects the
network kind: "sop" (default), "cop", "chop",
"lop", "material_network".
"delete" — path or paths: nodes, dots, sticky notes or
network boxes. A node that still feeds a node
outside paths is refused, with the list of its
readers, unless force=true.
"copy" — paths (or path), destination_path, suffix,
names. Copies a set of nodes with the wires
between them; a wire from outside the set goes to
the same node. suffix is added to each name, or
names maps a source path or name to a new name.
Returns `copies`, each source path with the path
of its copy: use that map, never the order of a
list. Without destination_path the copies go to
the right of the sources.
"move" — path with destination_path to put it in another
network, or path with position to move it on the
canvas.
"rename" — path, new_name.
"flags" — path, display, render, bypass. The display flag
and the render flag are different flags.
"color" — path, color as [r, g, b] from 0 to 1.
"layout" — path: lay out the children of that network
with the user's Smart Layout shelf tool (the same
code): one row per input depth, each node under
its first input, other inputs in the columns to
the right. Give `paths` to lay out only
those nodes. Without it the whole network moves,
including the nodes the user placed by hand, and
the result says so.
"insert" — node_type (or path of a node), input_path, and
reader: put the node on every wire from
input_path into reader (all streams of a Vellum
chain), or into every reader. The nodes below
move down only by the room it needs.
"place_chain" — paths (in order), reader, input_index: wire the
chain into that input and place it as a side
chain, its own column right of the reader, last
node one row above it. Wire a side result into
the node that really reads it, not through
pass-through ports of a chain.
"split" — path (a SOP network) and stages: move the nodes
of each stage into a subnet of that name. Each
result that another stage reads gets an OUT_
Null, and each reader an IN_ Object Merge.
Node paths in parameters, expressions and VEX
code are rewritten for the new places. Returns
each rewrite and each path it could not
resolve. Undo puts it back in one step.
"wrangle" — parent_path with code to make a wrangle, or path
with code to write into one. code_file reads the
code from a file, so a long snippet travels once.
replace edits a snippet in place: a list of
{"old": ..., "new": ...}, and each `old` must
appear exactly once.
"material" — path, material_type, name, parameters.
"assign_material" — path, material_path.
"take" — name to make a take, or take_name to select one.
"current_network" — path: what the network editor shows.
"note" — parent_path, text, position, color: a sticky
note. Without position it goes to the right of
the nodes. Notes go here, never in a node
comment.
"box" — paths, text, color: a network box around those
nodes, with text as its title: one to three
words. A longer text is refused.
Returns JSON. Houdini adds a numeric suffix when a name is already used, so
read the path in the result and use that path from then on. Never look the
node up again by the name you asked for.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | wrangle: the VEX snippet. | |
| mode | No | One of "create", "delete", "copy", "move", "rename", "flags", "color", "layout", "insert", "place_chain", "wrangle", "material", "assign_material", "take", "current_network", "note", "box", "split". | create |
| name | No | create, material: the name of the new node. take: the name of a new take. | |
| path | No | The node to change. layout: the network. delete: a node, a sticky note or a network box. | |
| text | No | note: the text of the note. box: the comment of the box. | |
| color | No | color, note, box: [r, g, b] from 0 to 1. | |
| force | No | delete: delete a node that still feeds a node that stays. | |
| items | No | A list of items for a repeated action, each a dictionary with the keys of one call. An argument outside items is the default for each one. | |
| names | No | copy: a new name for each source, by source path or name. | |
| paths | No | copy: the nodes to copy. delete: the nodes to delete together. layout: place only these nodes. place_chain: the chain, in order. box: the nodes to put in the box. | |
| bypass | No | flags: the bypass flag. | |
| reader | No | insert: only the wires into this node. place_chain: the node that the chain feeds. | |
| render | No | flags: the render flag, which is not the display flag. | |
| stages | No | split: {"stage name": ["node", ...]}, the nodes of `path` for each subnet. | |
| suffix | No | copy: text added to the name of each copy. | |
| context | No | create: the network kind, "sop" (default), "cop", "chop", "lop" or "material_network". | |
| display | No | flags: the display flag. | |
| replace | No | wrangle: edit the snippet in place, a list of {"old": ..., "new": ...}. Each old must appear exactly once. | |
| new_name | No | rename: the new name. | |
| position | No | create, move, note: [x, y] on the canvas. | |
| code_file | No | wrangle: read the VEX from this file, so a long snippet travels once. | |
| node_type | No | create: the node type, for example "box" or "attribwrangle". | |
| take_name | No | take: the take to make current. | |
| input_path | No | create: the node that feeds the new node. It saves a connect call and places the node under its input. insert: the node whose output wires get the new node. | |
| parameters | No | create, material: values to set on the new node, by parameter name. | |
| input_index | No | place_chain: the input of reader that the chain feeds. | |
| parent_path | No | create, wrangle, note: the network that gets the new node. | |
| material_path | No | assign_material: the material node. | |
| material_type | No | material: the shader type, for example "principledshader". | |
| destination_path | No | copy, move: the network to put the nodes in. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |