Houdini 18.0 Nodes LOP nodes

Store Parameter Values

Lets you store temporary (unsaved) data in the stage.

On this page

Overview

Sometimes you want to store some data that gets passed to downstream nodes. For example, one node might parse relationships between polygons in a mesh, and create a cache that downstream nodes can access for fast lookups.

USD does not provide for temporary/unsaved data storage. USD is expected to be immutable (you can only make changes by layering new information), and all data in USD is expected to be saved.

However, Houdini needs to store temporary data (mostly about how in-memory layers should be written to disk). It stores this temporary data in the /HoudiniLayerInfo prim. When Houdini writes out USD, it knows to skip/strip this particular prim.

This prim provides a convenient place in the stage to store your own data (as attributes) that should not be saved to disk.

The Store Parameter Values node works on a model of copying the contents of a parameter on this node (usually generated by a script) into a property on /HoudiniLayerInfo, then, in a downstream node, generating the value of a parameter by reading the stored value. This is why the name of the node references parameter values.

Note

This node is a workaround to allow you to store arbitrary temporary data. A future version of Houdini may have a more straightforward, dedicated way of passing temporary data down through the network.

How to

To...Do this

Store temporary data using Store Parameter Values node

The node works by saving the contents of a parameter. You will usually generate the parameter’s contents using a Python script.

  1. In the Store Parameter Values node’s parameters, set the Name to the name you want to store the temporary data under.

    This should be a valid USD property name that doesn’t conflict with existing property names. You may want to add a double-underscore at the start to make it more unique. For example, __indices.

  2. Use the pop-up menu to the right of the Name to set the USD data type of the value you want to store.

    • You should probably stick to int, float, double, or string. If you have more complex data, choose string and encode it as JSON (see Tips below).

    • If you want to store an array, set the type to "auto".

  3. Right-click the Value parameter and choose Expression ▸ Change language to Python.

  4. Right-click the Value parameter again and choose Expression ▸ Edit expression.

    This opens a floating multi-line editor where you can create/edit the Python expression driving the parameter’s value.

  5. Write the Python script so it returns the value you want want to store.

    • For scalar numbers (int, float, double) and strings, just return the value.

    • For compound values (for example float3) and arrays (int[]), use the repr() function to return a string containing the Python representation of a list of values.

      For example:

      list_of_value_to_store = [1, 2, 3, 5, 10, 15, 100]
      return repr(list_of_value_to_store)
      
    • For more complex data (such as dictionaries and/or nested data), encode the data as a JSON string (see Tips below).

Set the value of a parameter downstream using stored data

A convenient way to use the stored value is to use it to set a parameter value.

  1. In the downstream node’s parameters, right-click the parameter you want to drive using the stored data, and choose Expression ▸ Change language to Python.

  2. Right-click the parameter again and choose Expression ▸ Edit expression.

  3. In the Python script you can retrieve the stored value using a function loputils.fetchParameterValues(input_node, property_name) on the node’s input. The script should return the value you want to set the parameter to.

    import loputils
    
    # Get a reference to this node
    this_node = how.pwd()
    # Get a reference to the node connected to the input
    input_node = node.inputs()[0]
    # Get the value we stored under a certain name
    value = loputils.fetchParameterValues(input_node, "__indices")
    
    # This script should return the value you want to set the parameter to.
    # Note that the parameter has its own expected data type, which might
    # be int, float, or string.
    return str(value)
    

Tips

  • If you want to encode something more complicated than a string, scalar number, or array (such as a Python dictionary), you should JSON-encode it, store it in a string, and JSON-decode it in downstream nodes to access the data.

    Store Parameter script for "foo"

    from json import dumps
    
    mydict = build_cache_dictionary()
    jsonstring = dumps(mydict)
    return jsonstring
    

    Retrieve dictionary in downstream node

    from json import loads
    import loputils
    
    this_node = how.pwd()
    input_node = node.inputs()[0]
    jsonstring = loputils.fetchParameterValues(input_node, "foo")
    mydict = loads(jsonstring)
    

    Warning

    Never use Python’s eval() function to extract data from a string. Encode and decode the data as JSON.

  • If you want to use the stored value in a VEX snippet:

    • Create a parameter for the value on the Bindings tab, or (if the node doesn’t have a Bindings tab), create a spare parameter to hold the value.

    • Put a Python script on the the new parameter to get its value from the stored value.

    • In the VEX snippet, use the bound attribute (if the node has a Bindings tab), or if you created a spare parameter, read the parameter value using a ch() function.

  • You can’t store an array of mixed data types in a native USD array. If you use "auto" and return a list with floats and ints, it will store them as a float array. If you really need mixed types in a list, encode the list as a JSON string.

Parameters

Parameters

You can store multiple parameter values in a single node. Set this to the number of values you want to store, or click the plus and minus buttons to add or remove values.

Enable

For each value, whether to actually compute and store the value.

Name

The property name to use to store the value. This should be a valid USD property name that doesn’t conflict with existing property names. You may want to add a double-underscore at the start to make it more unique. For example, __indices.

Type

USD data type of the value you want to store. If you want to store an array, set the type to "auto" and return a string that looks like a Python list literal (for example "[1,2,3]"). You should probably stick to int, float, double, or string. If you have more complex data, choose string and encode it as JSON.

Value

A string representation of the value to store. You will usually want to drive the value of this parameter with a Python script (see "how to" above). If you want to store an array, set the type to "auto" and make this a string that looks like a Python list literal (for example [1,2,3])

LOP nodes

  • Add Variant

    Adds one or more variants to a variant set on a primitive. This node creates the primitive if it doesn’t exist.

  • Additional Render Vars

    Create multiple render vars.

  • Assign Material

    Assigns a material to one or more USD primitives. You can use also programmatically assign materials using VEX, programmatically override material settings for each assignment, and programmatically assign materials to geometry subsets.

  • Attribute Wrangle

    Create/edit USD primitive attributes using a VEX snippet.

  • Auto Select LOD

    Automatically selects a level-of-detail variant based on the primitive’s distance from the camera.

  • Bake Skinning

    "Bakes" animation driven by a UsdSkel into transforms and point positions.

  • Begin Context Options Block

    This node begins a block of LOP nodes, within which certain context options have certain values.

  • Blend

    Partially applies edits to a layer’s attributes based on a fractional weight.

  • Cache

    Caches the results of cooking the network at different times, increasing playback speed.

  • Camera

    Adds a USD camera to the scene.

  • Capsule

    Creates or edits a "capsule" (tube with hemispherical ends) shape primitive.

  • Collection

    Creates/edits a collection using selected prims.

  • Cone

    Creates or edits a cone shape primitive.

  • Configure Layer

    Edits metadata on a layer.

  • Configure Primitives

    Edits various metadata on one or more primitives.

  • Configure Properties

    Configures metadata on properties (relationships and attributes).

  • Configure Stage

    Configures metadata for how to load layers into the stage and asset resolution.

  • Create LOD

    Uses the PolyReduce SOP to automatically generate multiple levels of detail from a high-res model, and stores them as USD variants.

  • Cube

    Creates or edits a cube shape primitive.

  • Cylinder

    Creates or edits a cylinder shape primitive.

  • Dome Light

    Creates or edits a USD Dome Light prim. A dome light emits light inward, simulating light coming from the sky/environment surrounding the scene.

  • Drop

    Runs a simulation to drop primitives under gravity.

  • Duplicate

    Creates copies of a prim (and its descendants).

  • Edit

    Interactively transforms prims in the viewer. Can use physics collisions to position props realistically.

  • Edit Context Options

  • Edit Material

    Allows you to edit an existing USD material by modifying parameters and shader connections. This can be useful if the existing material is on a non-editable layer.

  • Edit Properties

    Lets you build a spare parameter interface to directly edit attribute and relationship values.

  • Edit Prototype

    Switch point instances or USD instanceable prims to instance a different prototype.

  • Edit Target Layer

    Allows you to apply edits directly in a lower layer, instead of overriding prims and attributes in the active layer.

  • Error

    Generates a message, warning, or error, which can show up on a parent asset.

  • Extract Instances

    Converts an instance into a "real" editable prim.

  • Fetch

    Grabs the output of another LOP, potentially in another LOP network.

  • Follow Path Constraint

    Constrains a prim to follow a path curve.

  • For Each

    The end node of a For-Each loop block.

  • Geometry Subset VOP

    Creates USD geometry subsets within geometry prims (similar to groups in SOPs) based on evaluating a VEXpression or VOP network.

  • Graft

    Takes scene graph trees from other inputs and attaches them onto branches of the scene graph tree in the first input.

  • Inline USD

    Parses usda code representing a layer and adds it to the layer stack.

  • Instancer

    Instances or copies primitives onto points.

  • Karma Procedural

    Sets up render-time instantiation for Karma.

  • Karma Render Properties

    Configure Render Properties for Karma (Beta).

  • Karma Standard Render Vars

    Create standard karma render vars (AOVs/Image Planes).

  • LOP nodes

    LOP nodes generate USD describing characters, props, lighting, and rendering.

  • Layer Break

    Starts a new active sublayer that subsequent nodes will edit.

  • Layer Replace

    Replaces all uses of a certain layer with a substitute layer from its second input.

  • Light

    Creates or edits a USD Light prim. This node also adds some useful Karma-specific attributes.

  • Light Linker

    Creates USD light link properties based on rules.

  • Light Mixer

    Lets you interactively edit USD properties for multiple lights.

  • Load Layer

  • Look At Constraint

    Constrains a prim to always point toward a target.

  • Material Library

    Imports Material VOP nodes as USD material prims.

  • Material Linker

    Creates material assignments based on rules.

  • Material Variation

    Creates attributes/primvars to override material parameters per-prim/instance.

  • Merge LOP

    Merges the layers from incoming stages into a unified layer stack.

  • Modify Point Instances

    Modify point transforms and property values for individual point instances.

  • Null

    This node does nothing. It can be useful to insert a Null into a network as a "fixed point" in the network that you can refer to by name in expressions/scripts.

  • Output

    Represents the output of a subnetwork. Allows you to design a node asset with multiple outputs.

  • Parent Constraint

    Makes a primitive appear to inherit the transform hierarchy of another prim somewhere else in the tree.

  • Points Constraint

    Position and Orient primitives using point positions from a geometry.

  • Primitive

    Bulk-creates one or more attributes of a certain type.

  • Prune

    Hides or deactivates primitives and point instances.

  • Python Script

    Lets you write Python code in the node to use the USD API to directly manipulate the stage.

  • Reference

    References the contents of an external USD file into a branch of the existing scene graph tree, or removes/replaces existing references.

  • Render Geometry Settings

    Applies renderer-specific geometry settings to geometry in the scene graph.

  • Render Product

    Creates or edits a UsdRenderProduct prim, which represents an output of a renderer (such as a rendered image file or other file-like artifact produced by a renderer), with attributes configuring how to generate the product.

  • Render Settings

    Creates or edits a UsdRenderSettings prim, which holds the general settings for rendering the scene.

  • Render Var

    Specifies a custom variable computed by the renderer and/or shaders, either a shader output or a light path expression (LPE).

  • Retime Instances

    Offsets and/or scales the timing of animation on selected instances.

  • SOP Create

    Lets you create geometry in a SOP subnetwork inside this node, so you can create geometry in-place in the LOP network instead of needing a separate SOP network.

  • SOP Import

    Imports geometry from a SOP network into the USD scene graph.

  • SOP Modify

    Converts USD geometry into SOP geometry, runs the SOP subnet inside this node on the geometry, and converts the changes back to USD overrides.

  • Scene Import

    Imports models, materials, and lights from the Object level into the LOP network.

  • Scope

    Creates a "scope" primitive. Scope is the simplest form of grouping, and does not have a transform. Scopes can be useful for organizing the scene tree.

  • Set Extents

    Sets the bounding box metadata of selected primitives.

  • Set Variant

    Selects (switches to) one of the variants stored in a variant set on a primitive.

  • Simulation Proxy

    Generates low-poly collison geometry suitable for physical simulation and creates a proxy relationship to the original model.

  • Sphere

    Creates or edits a sphere shape primitive.

  • Stage Manager

    Provides a convenient interface to reference in many files at once and place them in the scene graph tree.

  • Store Parameter Values

    Lets you store temporary (unsaved) data in the stage.

  • Sublayer

    Imports from USD files or other LOP node chains into as sublayers, or removes/replaces/reorders existing sublayers.

  • Subnet

    Encapsulates a LOP subnetwork, allowing you to organize and hide parts of the network.

  • Surface Constraint

    Constrain a prim to stick to a surface.

  • Switch

    Passes through one of several inputs, based on a parameter choice or expression.

  • TimeShift

    Outputs the stage as it is at a different point in the timeline.

  • Transform

    Edits the transforms of selected USD primitives.

  • Transform UV

    Moves, rotates, and scales texture coordinates on USD primitives.

  • USD ROP

  • USD Render ROP

  • Value Clip

  • Vary Material Assignment

    Assign different materials across a number of prims to create variation.

  • Volume

    References volume data on disk into a volume prim containing field prims.

  • Xform

    Creates or edits an Xform prim. Xform (and its sub-classes) represents a transform in the scene tree.

  • attribvop