CopyStyle
 
 
 

CopyStyle

Introduced

v3.0

Description

Copies a hair style from one hair object to another.

Note: The source and target may not be from the same emitter object and the source and target hair may not have dynamics on (the copy style must occur during style mode).

You also need to line up the source and target objects, preferably both at the origin. This avoids any backwards-compatibility problems copying a style between 3.5 and previous versions where there is a new pose constraint on the 3.5 (which causes the positions to be slightly off if they were not centered at the origin).

Scripting Syntax

CopyStyle( [TargetHairObject], [ModelHairStyleObject] );

Parameters

Parameter Type Description
TargetHairObject Object name Hair object to receive new style

Default Value: Current selection

ModelHairStyleObject Object name Hair object to copy style from

Default Value: Starts a pick session

Examples

VBScript Example

'Create two grids of different subdivision settings
Set oGridSource = CreatePrim( "Grid", "MeshSurface", "EmitterSource" )
Translate oGridSource, -5, 0, 0, siAbsolute, siParent, siObj, siX
Set oGridTarget = CreatePrim( "Grid", "MeshSurface", "EmitterTarget" )
SetValue oGridTarget & ".polymsh.geom.subdivu", 4
SetValue oGridTarget & ".polymsh.geom.subdivv", 4
Translate oGridTarget, 5, 0, 0, siAbsolute, siParent, siObj, siX
'Apply hair to each grid.  The "source" hair will have a style we'll copy to the "target".
Set oHairSource = ApplyHairOp( oGridSource )
SetValue oHairSource & ".Name", "HairSource"
ApplyHairClumpOp oHairSource
SetValue oHairSource & ".ClumpOp.clump", 0.2
ApplyHairRotateOp oHairSource
SetValue oHairSource & ".RotateOp.type", 1
SetValue oHairSource & ".RotateOp.angle", 20
Set oHairTarget = ApplyHairOp( oGridTarget )
SetValue oHairTarget & ".Name", "HairTarget"
'Now Transplant hair from Source to Target
CopyStyle oHairTarget, oHairSource

See Also

ApplyHairOp