MaxScript SDK 

To allow its users for expandibility that extends beyonds what is already possible, Ornatrix provides MaxScript access to the two core components: hair and guides. It also provides interfaces to many objects and modifiers to make it easier to create macro scripts and incorporate Ornatrix functionality into UI. Some of the components that do provide interfaces include baked hair object, baked guides object, edit guides modifier, hair from guides modifier, surface comb modifier and many others. You may find a "MaxScript Access" section at the bottom of documentation for each Ornatrix component to see instructions on how to use MaxScript with that particular component.

Several examples are included with Ornatrix which should help you get started scripting custom strand and hair structures. You should be familiar with Ornatrix concepts on dealing with sparse and dense hair relationship, as well as optional hair data, and guide channels. However many high-level functions take care of the most work in these areas so you don't have to worry about accessing them directly (unless you need to). In any case, being familiar with all Ornatrix core concepts is a plus.

 

Global Settings 

The following are Ornatrix settings which are exposed globally through MaxScript:

-- Get current version of Ornatrix. type is 0 to get a string, or 1 to get an integer as a result.
OxGetVersion type

-- Shows Ornatrix global settings dialog
OrnaAbout()

-- Sets whether viewport hair preview should contain final render hairs. This will force viewports to display the same hairs as the ones being rendered.
OxSetDisplayRenderHairInViewports true|false

-- Useful MaxScript function which determines whether specified scene node can be instanced or not
OxCanInstanceNode sceneNode
 

Global Functions 

Use these globally available functions on any Ornatrix hair object:

-- Gets the number of strands in the specified hair object
strandCount = OxGetStrandCount hairObject

-- Gets the number of points in a strand in the specified hair object
pointCount = OxGetStrandPointCount hairObject strandIndex

-- Gets an array containing all vertices of the hair object. If isUsingObjectCoordinates is true, the vertices will be returned in object coordinates. 
-- Otherwise they will be returned in local strand coordinates.
OxGetVertices hairObject isUsingObjectCoordinates

-- Gets specified point of a hair strand in either local strand or object coordinates
OxGetStrandPoint hairObject strandIndex pointIndex isUsingObjectCoordinates

-- Gets texture coordinates for a given hair object
-- dataType can be 0:per-strand or 1:per-vertex
OxGetTextureCoordinates hairObject textureChannelIndex firstElementIndex elementCount dataType

-- Gets a list of unique per-strand ids for strands in a given hair or guides object
OxGetStrandIds hairObject