' The following code illustrates how to find the first envelope operator
' in the ConstructionHistory,
Set oRoot = Application.ActiveProject.ActiveScene.Root
' Create an object to act as the skin
Set oSkin = oRoot.AddGeometry("Cylinder","MeshSurface")
' Create a chain to act as the skeleton
Set oPos1 = XSIMath.CreateVector3
oPos1.Set 0, -3, 0
' Effector for second bone
Set oPos2 = XSIMath.CreateVector3
oPos2.Set 0, 3, 0
' Construct skeleton
Set oChain = oRoot.Add3dChain(oPos1, Array(0,0,0))
Set oBone1 = oChain.AddBone(oPos2)
' Apply an envelope to the sphere using the chain as the deformer
oSkin.ApplyEnvelope oChain, siBranch
Set oEnvelope = oSkin.ActivePrimitive.ConstructionHistory.Find( "envelopop" )
Set oDeformers = oEnvelope.Deformers
LogMessage "There are " & oDeformers.Count & " deformers for the '" & oEnvelope.Name & "'."
For Each oItem In oDeformers
If sMembers <> "" Then
sMembers = sMembers & ", "
End If
sMembers = sMembers & oItem.Name
Next
Application.LogMessage oSkin.Name & " has an envelope applied called '" & _
oEnvelope.Name & "'" & vbLf & " " & _
"which has the following deformers: " & sMembers
' Output of the above script:
'INFO : "There are 4 deformers for the 'Envelope Operator'."
'INFO : "cylinder has an envelope applied called 'Envelope Operator'
' which has the following deformers: root, bone, bone1, eff" |