A list of different menu scripts which make HDAs easier to use in Houdini. Note that you need to change the Menu Script Language to Python vs HScript for all of these. Updated as I create them.
- Group Selection
- Attribute Selection
- Attribute Values as Menu
- List All Parameters on a Node (Int and Float only)
Fairly straightforward. Generates a menu with the existing groups of a particular type. There are a couple variations of the code depending on if you want to use a different parameter to control the type being selected (which is how the group node works).
Simple Attribute Selection (Point Attributes)
The only modification needed is to select the type of attributes to find. Options listed here.
Full Attribute Selection
By default, the below script will select Point, Prim, and Vertex Attributes. The datatypes (options listed here) vary, as do the min and max sizes in order to demonstrate different ways to change or extend the code.
Float Attribute Selection with Separators
Similar to above, the below script will select Point, Prim, and Vertex Attributes. It only selects floats up to a size of 3, but puts a separator between different classes in a fairly elegant way.
Attribute Values as Menu
Once in a while, you need to create a menu of the values of a specific attribute. An example could be if you want certain transform attributes to only apply to say, the polygons with their variant attribute set to "dog". The expectation in the below code is that you have a string attribute (called "targetAttrib" in this case) being used to say which attribute to target, but you could also hard-set it by typing
List all Parameters on a node (Int and Float only)
Setting up Multiple Action Buttons for 1 Parameter
This splits parameter names so they appear in an order designed to find "random" controls first. Sorts by parameters that have the following in their names, in this order: seed -> iter -> parameters with size 1 -> parameters with size 3.
FURTHERMORE, it is designed to work inside of a multiparm so you will see kwargs['script_multiparm_index'] which represents the mparm number. It also adds separators into the menu if you don't know how to do that.