c4d.modules.hair.HairGuides

class c4d.modules.hair.HairGuides

Helper class for guides/hair.

Overview

Coordinate Conversion

HairGuides.GetMg()

Gets the global matrix.

HairGuides.SetMg()

Sets the global matrix.

HairGuides.ToLocal()

Changes all the points for the guides into a local coordinate system.

HairGuides.ToWorld()

Changes all the points for the guides into the world coordinate system.

Flags

HairGuides.GetFlags()

Gets the flags.

HairGuides.SetFlags()

Sets the flags.

Geometry Conversion

HairGuides.CreateSpline()

Create splines from the guides.

HairGuides.GetTangent()

Gets the tangent of guide at segment and t.

Object And Copy Operations

HairGuides.CopyFrom()

Copies the guide data from src to this instance.

HairGuides.GetObject()

Gets the corresponding hair object.

Point Editing

HairGuides.GetPoints()

Gets a list of points for the guides.

HairGuides.SetPoint()

Set the point p at index id.

Root Placement

HairGuides.DisplaceRoots()

Used when HNs have affected the guide roots.

HairGuides.GetRootAxis()

Gets the root axis of guide index.

HairGuides.GetRootUV()

Gets the root UV at index.

HairGuides.GetTransformMatrix()

Gets the transformation matrix list.

HairGuides.UndisplaceRoots()

Inverse of HairGuides.DisplaceRoots().

Selection

HairGuides.ConvertSelection()

Converts the selection state.

HairGuides.GetSelected()

Gets the selection state.

HairGuides.SetSelected()

Sets the selection state.

Structure

HairGuides.GetCount()

Gets the number of guides.

HairGuides.GetGuidePointCount()

Gets the number of points per segment.

HairGuides.GetPointCount()

Gets the number of points per guide.

HairGuides.GetSegmentCount()

Gets the number of segments per guide (number of points is one more than this).

Members

Coordinate Conversion

HairGuides.GetMg(self)

Gets the global matrix.

Return type

c4d.Matrix

Returns

Global matrix.

HairGuides.SetMg(self, mg)

Sets the global matrix.

Parameters

mg (c4d.Matrix) – New global matrix.

HairGuides.ToLocal(self)

Changes all the points for the guides into a local coordinate system.

HairGuides.ToWorld(self)

Changes all the points for the guides into the world coordinate system.

Flags

HairGuides.GetFlags(self)

Gets the flags.

Return type

int

Returns

Flags:

HAIR_GUIDE_FLAGS_LOCAL

Chains are in local object space.

HAIR_GUIDE_FLAGS_AS_GUIDES

Special case guides.

HAIR_GUIDE_FLAGS_INITIAL

Chains are in their original initial space (like a stick texture tag).

HAIR_GUIDE_FLAGS_HAIRS

Created for hairs.

HAIR_GUIDE_FLAGS_INITIALAXIS

Initial space and root axis aligned.

HairGuides.SetFlags(self, flags)

Sets the flags.

Parameters

flags (int) –

New flags:

HAIR_GUIDE_FLAGS_LOCAL

Chains are in local object space.

HAIR_GUIDE_FLAGS_AS_GUIDES

Special case guides.

HAIR_GUIDE_FLAGS_INITIAL

Chains are in their original initial space (like a stick texture tag).

HAIR_GUIDE_FLAGS_HAIRS

Created for hairs.

HAIR_GUIDE_FLAGS_INITIALAXIS

Initial space and root axis aligned.

Return type

int

Returns

Old flags.

Geometry Conversion

HairGuides.CreateSpline(self)

Create splines from the guides.

Return type

c4d.SplineObject

Returns

Created splines.

HairGuides.GetTangent(self, guide, segment, t)

Gets the tangent of guide at segment and t.

Parameters
  • guide (int:) – Guide index.

  • segment (int) – Segment index.

  • t (float) – T coordinate.

Object And Copy Operations

HairGuides.CopyFrom(self, src)

Copies the guide data from src to this instance.

Parameters

src (c4d.BaseSelect) – Source.

Return type

bool

Returns

True if successful, otherwise False.

HairGuides.GetObject(self)

Gets the corresponding hair object.

Return type

c4d.modules.hair.HairObject

Returns

Hair object.

Point Editing

HairGuides.GetPoints(self)

Gets a list of points for the guides.

Return type

List[c4d.Vector]

Returns

Point list.

HairGuides.SetPoint(self, id, p)

Set the point p at index id.

Parameters
  • id (int) – The point index.

  • p (c4d.Vector) – The point.

Raises

IndexError – If the point index id is out of range : 0<=id<GetPointCount().

Root Placement

HairGuides.DisplaceRoots(self)
Used when HNs have affected the guide roots.
Call HairGuides.DisplaceRoots() and it will ensure they are in the correct displaced state for HNs, HairGuides.UndisplaceRoots() will make sure they are not.
Generally not needed if using ToInitial(), as the initial state is undisplaced.
HairGuides.GetRootAxis(self, index, bAlign=False, bLocal=True, bInitial=False, bZAxis=False)

Gets the root axis of guide index.

Parameters
  • index (int) – Guide index.

  • bAlign (bool) – Aligned.

  • bLocal (bool) – Local.

  • bInitial (bool) – Initial

  • bLocal – If True then the alignment is done along the Z axis, otherwise it is Y.

Return type

c4d.Matrix

Returns

The root axis.

HairGuides.GetRootUV(self, index)

Gets the root UV at index.

Parameters

index (int) – Guide index.

Return type

c4d.Vector

HairGuides.GetTransformMatrix(self, index)

Gets the transformation matrix list.

Parameters

index (int) – Guide index.

Return type

List[c4d.Matrix]

Returns

The transformation matrix list.

HairGuides.UndisplaceRoots(self)

Inverse of HairGuides.DisplaceRoots().

Selection

HairGuides.ConvertSelection(self, from_mode, to_mode, from_select, to_select)

Converts the selection state.

Parameters
  • from_mode (int) –

    Selection mode:

    HAIR_MODE_LOCKED

    Locked mode

    HAIR_MODE_HIDDEN

    Hidden mode.

    HAIR_MODE_TIPS

    Tips mode.

    HAIR_MODE_POINTS

    Points mode.

    HAIR_MODE_GUIDES

    Guides mode.

    HAIR_MODE_ROOTS

    Roots mode.

    HAIR_MODE_VERTEX

    Vertex mode.

  • to_mode (int) –

    To mode.

    HAIR_MODE_LOCKED

    Locked mode

    HAIR_MODE_HIDDEN

    Hidden mode.

    HAIR_MODE_TIPS

    Tips mode.

    HAIR_MODE_POINTS

    Points mode.

    HAIR_MODE_GUIDES

    Guides mode.

    HAIR_MODE_ROOTS

    Roots mode.

    HAIR_MODE_VERTEX

    Vertex mode.

  • from_select (c4d.BaseSelect) – From selection.

  • to_select (c4d.BaseSelect) – To selection.

HairGuides.GetSelected(self, mode)

Gets the selection state.

Parameters

mode (int) –

Selection mode:

HAIR_MODE_LOCKED

Locked mode

HAIR_MODE_HIDDEN

Hidden mode.

HAIR_MODE_TIPS

Tips mode.

HAIR_MODE_POINTS

Points mode.

HAIR_MODE_GUIDES

Guides mode.

HAIR_MODE_ROOTS

Roots mode.

HAIR_MODE_VERTEX

Vertex mode.

Return type

Optional[c4d.BaseSelect]

Returns

The selection or None.

HairGuides.SetSelected(self, mode, select)

Sets the selection state.

Parameters
  • mode (int) –

    Selection mode:

    HAIR_MODE_LOCKED

    Locked mode

    HAIR_MODE_HIDDEN

    Hidden mode.

    HAIR_MODE_TIPS

    Tips mode.

    HAIR_MODE_POINTS

    Points mode.

    HAIR_MODE_GUIDES

    Guides mode.

    HAIR_MODE_ROOTS

    Roots mode.

    HAIR_MODE_VERTEX

    Vertex mode.

  • select (c4d.BaseSelect) – The selection.

Return type

bool

Returns

True if successful, otherwise False.

Structure

HairGuides.GetCount(self)

Gets the number of guides.

Return type

int

Returns

Guide count.

HairGuides.GetGuidePointCount(self)

Gets the number of points per segment.

Return type

int

Returns

Number of points per segment.

HairGuides.GetPointCount(self)

Gets the number of points per guide. (One more than segments.)

Return type

int

Returns

Number of points per guide.

HairGuides.GetSegmentCount(self)

Gets the number of segments per guide (number of points is one more than this).

Return type

int

Returns

Number of segments per guide.