» Back to Documentation

 

ORNAHAIR INTERFACE


This interface is used to operate on core hair structure used by Ornatrix. When using a guide interface you can use "guides.AsHair()" to obtain this hair interface to a guide object. You have to be very careful about using some of these functions as they can cause unexpected behaviour and crashing when not used correctly.

Hair interface to any Ornatrix hair object is obtained through "bakedHair.GetHair()" command on any baked hair object or any other object derived from OrnaDenseHair.


Function reference:


Roots:

.NumRoots()
return Integer
"Return total number of roots"

.SetNumRoots [count] [keep]
"Set number of roots and all associated data (specified in flags)"


Root Topology:

.HasRoots()
return Bool
"Does this hair use root topology data"

.GetRootGID [root]
return Integer
"Get starting index into vertex array of specified root"

.GetRootGNum [root]
return Integer
"Get number of vertices associated with specified root"

.SetRootGID [root] [gid]
"Set starting index into vertex array of specified root"

.SetRootGNum [root] [gnum]
"Set number of vertices associated with specified root"


Root Transform:

.HasRootTM()
return Bool
"Does this hair use root transform data"

.GetRootTM [root]
return Matrix3
"Return matrix associated with root"

.SetRootTM [root] [tm]
"Set a new matrix associated with root"


Surface Dependance:

.HasSurfDep()
return Bool
"Does this hair use surface dependance data"

.GetSurfDepFace [root]
return Integer

.GetSurfDepBary [root]
return Point3

.SetSurfDepFace [root] [face]

.SetSurfDepBary [root] [bary]


Guide Dependency:

.HasGuideDep()
return Bool
"Does this hair use guide dependance data"

.GetGuideDepCSR [root] [ind]
return Integer

.GetGuideDepDSR [root] [ind]
return Float

.SetGuideDepCSR [root] [ind] [csr]

.SetGuideDepDSR [root] [ind] [dsr]


Root transform ops. using distribution object:

.ComputeRootTM [root]
return Matrix3
"Computes root transform matrix for specified strand"

.UpdateRootTM [from] [num]
"Updates root transforms using surface dependency and distribution mesh normals"


Vertices:

.VertId [root]
return Integer
"Index into vertex array for the first point in specified root"

.NumPts [root]
return Integer
"Number of points in specified root"

.GetGlobSegNum()
return Integer
"Global number of points per strand (if OHF_GLOB_SEG_NUM is set)"

.SetGlobSegNum [num]
"Number of points per strand to set"

.NumVerts()
return Integer
"Total number of hair vertices"

.SetNumVerts [num] [keep]
"Sets the number of vertices and resizes all connected data (based on flags)"

.AppendVerts [verts] [num]
"Append a vertex array to the end of vertex list and update lookup tables (if used)"


Vertex Access:

.GetVert [ind]
return Point3
"Get vertex in root-space"

.GetVertT [ind]
return Point3
"Get vertex in object-space"

.SetVert [ind] [vert]
"Set vertex in root-space"

.SetVertT [ind] [vert]
"Set vertex in object-space"

.GetPoint [root] [ind]
return Point3
"Get point in root-space"

.GetPointT [root] [ind]
return Point3
"Get point in object-space"

.SetPoint [root] [ind] [vert]
"Set point in root-space"

.SetPointT [root] [ind] [vert]
"Set point in object-space"


Vertex Lookup Tables:

.HasVertInd()
return Bool
"Non-zero if class uses vertex lookup tables"

.GetVertInd [ind]
return Integer
"Returns root index associated with specified vertex indes"

.SetVertInd [ind] [vind]
"Sets root index associated with specified vertex indes"

.RemapVertInd()
"Updates vertex lookup tables based on available data"


Mapping Coordinates:

.GetPointUVW [root] [ind]
return Point3
"Computes per-strand UV coordinates for a single root and its relative vertex"

.GetVertUVW [ind]
return Point3
"Computes per-strand UV coordinates for a single root"


Bounding Box:

.UpdateBoundingBox ()

.GetBoundingBoxMin ()
return Point3

.GetBoundingBoxMax ()
return Point3


OXH File I/O:

.Save [filename]

.Load [filename]


Flag Access:

.GetFlag [flag]
return Integer

.SetFlag [flag]

.ClearFlag [flag]


Misc.:

.GetGuides()
"If this hair structure indirectly depends on guides, this will return an interface to those guides. You can see which guide each hair depends on by reading the guide dependence data."

.SetDistrObject() [triObject]
"If you would like your hair automatically deform with a mesh, you can assign a mesh here and then call UpdateRootTM() function to have all root transforms 'glued' to the surface. You also need to aset up surface dependence data for this to work. Mesh has to be valid when roots are updates, so take good care not to garbage-collect or delete the provided object by accident."


Flag reference:

Hair flags: OHF_INSTANCED (1), OHF_POLAR_INT (2), OHF_TOPO_ORIENT (4), OHF_GLOB_SEG_NUM (8)

Base display flags: OHF_NO_DISPLAY (2048), OHF_HIDE_BACKFACING (4096)

Optional data flags: OHF_USE_ROOT_TOPO (2097152), OHF_USE_ROOT_TM (4194304), OHF_USE_SURF_DEP (8388608), OHF_USE_GUIDE_DEP (16777216), OHF_USE_VERT_IND (33554432)