cook
Run Houdini node evaluations and simulations over frames, write parameters, manage caches, and rerun failing nodes to return errors, warnings, counts, bounds, and per-frame timing.
Instructions
Force work to happen, and report what the work said and what it cost.
Modes: cook, cache_write, cache_clear, sim_step, sim_reset, recook.
Use it to run a test: write a few parameters, cook a range of frames, and
read the seconds for each frame. That is one call, and it is the loop that
every look iteration needs.
Do not use it to read the result: geometry_inspect does that, and it cooks
the node as well.
mode:
"cook" — cook the nodes and return the errors, the warnings and
the time. `frames` or `frame_range` cooks over more
than one frame; the playbar goes back to where it was.
"cache_write" — write the file cache of the node. frame_range is
[start, end]; without it the node writes its own range.
"cache_clear" — remove the cached files of the node.
"sim_step" — step a DOP network num_steps frames.
"sim_reset" — clear the cache of a simulation, so that the next cook
runs it again. It accepts a DOP network and a solver
SOP such as a Pyro, FLIP, Vellum or RBD solver. After
you change anything inside a solver, reset it: the node
gives its old result back with no error and no warning.
On a solver SOP it cooks the sources first, cooks the
start frame after the reset, and reports the
primitives there. It fails when the result is empty
while the sources are not: that simulation stays
empty on every frame.
"recook" — cook again each node at or under `paths` that holds
an error or a warning, the deepest first, and say
which messages were stale (gone) and which are
current. Use it when an error names a cause that the
network does not have, such as "Infinite recursion"
with no cycle.
Cook frames here, not in an execute loop of hou.setFrame and geometry():
the viewport cooks the same nodes during the loop, and that can leave
false errors on the nodes inside a solver.
Returns JSON: the seconds in total, for each frame, and the slowest frame,
with the errors and the warnings of every node. Each frame also gives the
point count, the primitive count and the bounds of each SOP: one call
checks that a result moves or grows over a range. `ok` is false when a
node failed to cook, and `failed` then names each node upstream of it or
inside it that holds an error, with the text: the node that broke is
often another node than the one you cooked. A cook, a cache or a
simulation can take hours, and the call waits for it: a client that reads
MCP tasks gets a task at once and polls it. Houdini answers no other call
until the cook ends; session action='interrupt' stops it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | One of "cook", "cache_write", "cache_clear", "sim_step", "sim_reset", "recook". The description says what each one does. | cook |
| force | No | Cook even when Houdini thinks the node is up to date. | |
| paths | Yes | The node to cook, or a list of nodes. | |
| frames | No | One frame, a list of frames, or {"start": 1001, "end": 1010, "step": 2}. For cook. The playbar goes back after. | |
| num_steps | No | How many frames sim_step steps the DOP network. | |
| parameters | No | Values to write before the cook, as {"/obj/geo1/pyro": {"divsize": 0.05}}. The result says which writes changed nothing. | |
| frame_range | No | [start, end]: every frame between. For cook and cache_write. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |