Справка Houdini на русском Networks and parameters

Using spare parameters

How to add extra parameters to an individual node.

On this page

Overview

Houdini lets you add your own custom spare parameters to an individual node’s user interface. You can then use the value of the spare parameters in expressions. This lets you set up an interface that lets you tweak parts of an expression without having to hand-edit numbers.

(Spare parameters only exist on a single node. If you want to create a new type of node that lets you create multiple nodes with the same customized user interface, you want a digital asset.)

Example

For example, you might have a Point geometry node that randomly jitters point positions up and down in Y using the expression:

Position Y

@P.y + (rand(@ptnum) - 0.5)

(Where @P.y is the current point’s position in Y, rand returns a number between 0 and 1, @ptnum is the current point’s number used as a random seed, and 0.5 is subtracted to change the random range from -0.5 to +0.5.)

You could add a multiplier to change the scale of the jitter:

Position Y

@P.y + (rand(@ptnum) - 0.5) * 5

…but if you want to play with the multiplier, it’s tedious to hand-edit the number in the expression. What you want is a parameter on the node that modifies the multiplier value in the expression.

You can change the expression to reference a parameter using the ch function:

Position Y

@P.y + (rand(@ptnum) - 0.5) * ch('jitter_scale')

…and add a spare parameter named jitter_scale. Then you can use the parameter interface to set the scale interactively using a slider.

(See the expression cookbook for more information on writing expressions.)

How to

  1. In the node’s parameter editor, click ▸ Edit parameter interface.

  2. In the Create Parameters list, drag a parameter type over to the Existing parameters list and drop it where you want it to go in the interface.

    For example, to add a floating point parameter under the Group field, drag Float from the left pane and drop it under Group in the Existing parameters list.

  3. Under Parameter description, set the options for the new parameters:

    • Set the Name to an internal name for the parameter. This is the value you will use in ch("name") function calls. It must not contain spaces, and can’t be the same as the name of any other parameters on the node.

    • Set the Label. This will be the label for the parameter in the user interface.

  4. Use ch in other parameters to reference the value of the new parameter (or chs for string parameters).

    For example, in an expression you can reference the value of the jitter_scale parameter on the same node using:

    ch('jitter_scale')
    

VEX snippets

Some nodes, such as the Attribute Wrangle geometry node let you write short VEX scripts to modify the node’s behavior. You can use parameter references in these snippets and automatically add the corresponding spare parameters.

  1. In a VEX snippet, use the chi, chf, chv, or chs functions wherever you want parameters.

    For example:

    @P.x += (random(@ptnum) - 0.5) * chf("scale");
    
  2. Click the Create Parameters button.

    Houdini finds any channel references in the snippet that don’t have corresponding parameters and creates parameters for them automatically. The parameters appear in the editor below the snippet.

Networks and parameters

Networks

  • Network editor

    How to create, move, copy, and edit nodes.

  • Network navigation

    How to move around the networks and move between networks.

  • Connecting (wiring) nodes

    How to connect nodes to each other to make them work together.

  • Network types and node flags

    Flags represent some state information on the node, such as which node represents the output of the network. Different network types have different flags.

  • Badges

    Badges indicate some status information about a node. They usually appear as a row of icons below the name of the node.

  • Find nodes in a network

    How to use the Find dialog to find nodes based on various criteria.

Editing parameters

Next steps

Expressions

Guru level

Reference