# HairPrimitive Class Reference

This class represents the primitive of an X3DObject used for simulating hair in Softimage and can be accessed with X3DObject::GetActivePrimitive. More...

`#include <xsi_hairprimitive.h>`

Inheritance diagram for HairPrimitive:

List of all members.

## Public Member Functions
| HairPrimitive ()
| ~HairPrimitive ()
| HairPrimitive (const CRef &in_ref)
| HairPrimitive (const HairPrimitive &in_obj)
bool | IsA (siClassID in_ClassID) const
siClassID | GetClassID () const
HairPrimitive & | operator= (const HairPrimitive &in_obj)
HairPrimitive & | operator= (const CRef &in_ref)
CRenderHairAccessor | GetRenderHairAccessor (LONG in_nRequestedHairCount, LONG in_nChunksize=10000, double in_time=DBL_MAX) const

## Detailed Description

This class represents the primitive of an X3DObject used for simulating hair in Softimage and can be accessed with X3DObject::GetActivePrimitive.

HairPrimitive provides access to the CRenderHairAccessor object which allows you to extract the render hair data from the primitive.

See also:
  CRenderHairAccessor

Since:
  5.0

Example:

              using namespace XSI;

              Application app;
              Model root = app.GetActiveSceneRoot();

              X3DObject myCube;
              root.AddGeometry( L"Cube", L"MeshSurface",L"myCube",myCube);

              CValueArray args(1);
              CValue outArg;
              args[0] = myCube;
              app.ExecuteCommand( L"ApplyHairOp", args, outArg ) ;

              X3DObject myHair = myCube.FindChild( L"Hair", L"", CStringArray() );

              HairPrimitive myHairPrim = myHair.GetActivePrimitive();

              bool bHair = myHairPrim.IsValid() && myHairPrim.IsA( siHairPrimitiveID ) == true;
              app.LogMessage( L"Found Hair object: " + CValue(bHair).GetAsTest() );

## Constructor & Destructor Documentation

HairPrimitive | ( |  | ) |

Default constructor.

~HairPrimitive | ( |  | ) |

Default destructor.

HairPrimitive | ( | const CRef & | in_ref | ) |

Constructor.

Parameters:

  | in_ref | constant reference object.

HairPrimitive | ( | const HairPrimitive & | in_obj | ) |

Copy constructor.

Parameters:

  | in_obj | constant class object.

## Member Function Documentation

bool IsA | ( | siClassID | in_ClassID | ) | const`[virtual]`

Returns true if a given class type is compatible with this API class.

Parameters:

  | in_ClassID | class type.

Returns:
  true if the class is compatible, false otherwise.

Reimplemented from Primitive.

siClassID GetClassID | ( |  | ) | const`[virtual]`

Returns the type of the API class.

Returns:
  The class type.

Reimplemented from Primitive.

HairPrimitive& operator= | ( | const HairPrimitive & | in_obj | ) |

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:

  | in_obj | constant class object.

Returns:
  The new HairPrimitive object.

HairPrimitive& operator= | ( | const CRef & | in_ref | ) |

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:

  | in_ref | constant class object.

Returns:
  The new HairPrimitive object.

Reimplemented from Primitive.

CRenderHairAccessor GetRenderHairAccessor | ( | LONG | in_nRequestedHairCount,
|  | LONG | in_nChunksize = `10000`,
|  | double | in_time = `DBL_MAX` |
| ) |  |  | const

Returns a render hair accessor for this primitive. The render hair accessor generates a renderable representation of a groomed hair primitive. The render hair is iterated over in chunks, rather than all at once, to avoid problems with excessive memory consumption.

Parameters:

  | in_nRequestedHairCount | Maximum number of hairs desired. The actual number can be less depending on cut and density map settings.
  | in_nChunksize | Number of hairs to generate on each iteration. By default the chunk size is set to 10000.
  | in_time | Time (in frames) at which to get the accessor. The default value is DBL_MAX which means the current time in frames.

Returns:
  The new CRenderHairAccessor object.

  Invalid if in_nRequestedHairCount is 0 or in_nChunksize is larger than in_nRequestedHairCount.

See also:
  CRenderHairAccessor

The documentation for this class was generated from the following file:

- xsi_hairprimitive.h