Working with Hair Operator Stack 

 

Overview 

To making working with hair easy and intuitive Ornatrix uses a special UI component called the Operator Stack. The Operator Stack contains a list of operators represented as items stacked on top of each other. At the bottom of the stack we have the base object and one or more operators such as deformers and converters are applied to this base object to achieve the final result.

Internally, the operator stack works with Maya nodes. It simplifies the process of creating, arranging, and connecting these nodes so that the artist can concentrate on styling instead of having to deal with Maya's dependency graph.

 

Opening the Operator Stack 

To open or close the operator stack:

 

Closing the Operator Stack 

To close the operator stack click the stack button again in the Ornatrix shelf or execute the OxShowHairStackDialog() command again.

 

Operator selection 

Selecting items within the Operator Stack will select the respective Maya node for the operator. This will highlight the node in the viewport and inside the Attribute Editor and enable any manipulators associated with the node.

Therefore, selection within the Operator Stack is a convenient way to quickly jump between various operators in your hair to see and adjust their parameters.

 

Renaming operators 

To rename an operator left-double click on its name, then enter a new name. This will also rename the Maya node for the operator.

 

Turning operators on and off 

Most operators can be toggled on and off using the On/Off state toggle. When an operator is turned off it will no longer have any effect on the hair and will thus be bypassed during the evaluation pipeline. This is a great way of quickly disabling various effects within the hair during the editing process.

 

Copying and pasting operators 

You can duplicate an effect of an operator by copying and pasting it. To do this:

  1. Select and right click on the operator you wish to copy
  2. Select Copy
  3. Select the operator above which you want to paste the copied operator
  4. Right click and select Paste

Operators can be pasted in a different hair stack from which they were copied.

 

Using the Show End Result toggle 

At the top of an operator stack you will find the Show End Result toggle icon. Click it to turn on or off the showing the end result of the operator stack vs. the result of the currently selected operator within the stack.

When Show End Result is off, you will see the hair as it would appear if the currently selected operator was the last in the stack. Otherwise, you will always see the result of applying all operators inside the stack inside the viewport.

 

Collapsing parts of the stack 

If you want to bake certain parts of the stack you can use the collapse feature. Collapsing the stack will consolidate all operators from the bottom of the stack to a specific operator into a single baked operator node. To collapse a part of the stack:

  1. Select the node up to which you want to collapse the stack
  2. Right click and select Collapse Up To Here

The base shape of the stack will remain in place and all collapsed operators will be replaced with a single baked operator.


Tutorial on baking guides and hairs
 

MEL Scripting 

The following functions can be used with MEL or PyMel to control the operator stack UI:

// Adds a new strand operator to the top of the stack or above curently selected operator node
// shapeOrNodeName: Name of the hair shape in the scene. If empty "" then currently selected shape is used.
// operatorNodeName: Name of the operator node to add. For example, "ChangeWidthNode" or "FrizzNode". 
OxAddStrandOperator( string $shapeOrNodeName, string $operatorNodeName );

// Removes specified operator from the stack
// operatorNodeName: Name of the operator node to remove. For example, "FrizzNode1".
OxRemoveStrandOperator( string $operatorNodeName );

// Updates the current hair stack dialog view
// Flag: -d (-disable) Disables update on select
// Flag: -e (-enable) Enables update on select
OxUpdateHairStackDialog( -d|-disable, -e|enable );

// Shows or hides the operator stack UI
// Flag: -ui (-createUI) If specified the stack view will be added into Maya's window layout system
OxShowHairStackDialog( -sh|-show, -hd|-hide, -ui|-createUI );