LinkDeformWithOri
 
 
 

LinkDeformWithOri

Description

Sets up pose-based deformation so that shape animation can be driven by the orientation of one ore more specified objects. Once the pose-base deformation is set up using LinkDeformOri and deform keys are created (using ApplyDeformKey or SaveDeformKey), the orientation of the selected objects drive the deformation of the geometry. The resulting deformation is interpolated smoothly between the shapes in the N-space defined by the N object orientations. For better results, the interpolation between the object orientations is done using quaternions.

Pose-based deformation (which is based on multi-linked parameters) allows you to link the shape of a cluster to several parameters simultaneously. The resulting shapes are smoothly interpolated in the space defined by the parameters. Pose-based deformations are particularly useful to link the shape of muscles to bone orientations or other parameters.

Scripting Syntax

oReturn = LinkDeformWithOri( Cluster, Parameter list, [LinkWithOri] );

Return Value

Returns an ISIVTCollection containing an XSICollection which contains the objects whose orientation is linked with the shape.

Parameters

Parameter Type Description
Cluster String Cluster to consider for future deformations

Default Value: Current selection

Parameter list String List of objects whose orientation will be linked with the shape.

Default Value: Picked in scene.

LinkWithOri Boolean True to link deformation with rotation.

Default Value: False

Examples

1. VBScript Example

'
' This example demonstrates how to link the deformation of a bicep 
' to the orientation of the forearm
'
NewScene , false
SetValue "Context.constructionmode", siConstructionModeModeling
' First we create a cylinder which will serve as our arm for this example
CreatePrim "Cylinder", "MeshSurface"
SetValue "cylinder.cylinder.height", 10
SetValue "cylinder.polymsh.geom.subdivu", 16
SetValue "cylinder.polymsh.geom.subdivv", 20
' We create a skeleton for the arm bones
Create2DSkeleton -3.89906576296024E-02, 4.97990543735225, 0, -0.896785125480857, 0.897163120567376, 0, 0, 0, 0, 4
AppendBone "eff", -3.89906576296024E-02, -4.92789598108747, 0
ApplyFlexEnv "cylinder;bone,bone1,eff", False
' We create the cluster of points that will model the muscle deformation
CreateCluster "cylinder.pnt[107-114,130-137,153-160,176-183,199-206,222-229,245-252,268-275,291-298]"
SetValue "cylinder.polymsh.cls.Point.Name", "Bicep"
' Next we will link the shape of the muscle to the orientation of the forearm bone
LinkDeformWithOri "cylinder.polymsh.cls.Bicep", "bone1"
' Finally we save a couple of deform keys to define the shape of the muscle at a different arm rotation
' One can repeat this process for other bone orientations
Translate "eff", 3.53515295841729, 4.31678486997636, 0, siRelative, siView, siObj, siXYZ
SetUserPref "3D_TRANSFO_PROPORTIONAL_CHANGED", 1
SetValue "Context.constructionmode", siConstructionModePrimaryShape
Translate "cylinder.pnt[157,158,180,181,203,204,226,227,249,250]", 0.727825609085912, -0.156028368794326, 0, _
        siRelative, siView, siObj, siXYZ
SetValue "cylinder.polymsh.movecomponentproportional.distlimit", 1
SaveDeformKey "cylinder.pnt[157,158,180,181,203,204,226,227,249,250]"
SetValue "Context.constructionmode", siConstructionModeModeling
SetValue "PlayControl.Key", 50
SetValue "PlayControl.Current", 50
SaveKey "eff.kine.local.posx,eff.kine.local.posy,eff.kine.local.posz", 50
FirstFrame
Translate "eff", -4.93881663308298, -3.66666666666667, 0, siRelative, siView, siObj, siXYZ
SaveKey "eff.kine.local.posx,eff.kine.local.posy,eff.kine.local.posz", 1
PlayForwardsFromStart
' The result is a deformation that is interpolated in the quaternion orientation space of the lower bone.
' One can also link the deformation to the orientation of more than one object.

2. VBScript Example

' 
' The goal of the example is to show the script command
' "LinkDeformOri". 
' Two objects are created; the sphere will be deformed according
' to the orientation of the cone (rotation around Z axis).
' First, an animation will be created on the cone (rotation
' of 90 degrees around Z axis) for playback purpose. 
' A cluster is created with some points of the sphere. 
' The cluster is "linked" for deform with the cone, such that 
' changing the orientation of the cone will deform the sphere.
' Two deformation (i.e. moves) of the points of the cluster are 
' performed at different frames, and each of the deformation acts
' as DeformKey.
' 
NewScene
SetValue "Context.constructionmode", siConstructionModeModeling
SetValue "PlayControl.Out", 40
CreatePrim "Sphere", "NurbsSurface", "MySphere"
CreatePrim "Cone", "NurbsSurface", "MyCone"
' 
' Set key at different frames with different angle
' to create an animation of the cone.
'
SaveKey "MyCone.kine.local.rotz", 1, -90
SaveKey "MyCone.kine.local.rotz", 30, -40
SaveKey "MyCone.kine.local.rotz", 40, 0
' 
' Translate the objects to see clearly the cone and the
' effect on the sphere
'
SelectObj "MySphere", , True
Translate , -3, 0, 0, siAbsolute, siParent, siObj, siX
SelectObj "MyCone", , True
Translate , 6, 0, 0, siAbsolute, siParent, siObj, siX
'
' Create a cluster in the sphere, and create a LinkDeformOri
' with the cone.
'
SetSelFilter "Point"
AddToSelection "MySphere.pnt[(0,6),(7,6),(6,6),(5,6),(4,6),(3,6),(6,5),(1,6),(1,5),(2,6),(7,5),(0,5),(2,5),(5,4),(5,5),(4,5)]" 
CreateCluster 
LinkDeformWithOri "MySphere.surfmsh.cls.Point", "MyCone"
'
' Create the first Deform key at frame 1, with translation of
' points of the cluster
'
SetValue "Context.constructionmode", siConstructionModePrimaryShape
SetValue "PlayControl.Current", 1
Translate "MySphere.pnt[(0,6)]", -1.74522900164809, 0.27627214396616, -0.027627214396616, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(0,5)]", -1.63879153625736, 7.95443183208384E-02, -7.95443183208383E-03, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(4,6)]", 2.5, 0.5, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(4,5)]", 2.5, -0.3, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(3,5)]", 2, -1.5, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(1,5)]", -1.5, -0.4, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(7,6)]", -1.2, 1.26649251503908, -0.2, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(5,6)]", 1.5, 1.53788376826177, -0.2, siRelative, siView, siObj, siXYZ
SelectObj "MySphere.surfmsh.cls.Point"
SaveDeformKey
' Create the second Deform key at frame 30, with translation of
' points of the cluster
SetValue "PlayControl.Current", 30
Translate "MySphere.pnt[(0,6)]", 6.0, -0.5, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(0,5)]", 5.4, 0, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(1,5)]", 4.0, 1.3, -0.13, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(4,5)]", -5.5, 0.12, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(4,6)]", -6.0, -0.5, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(5,4)]", -1.7, 0.5, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(3,6)]", -2.0, 0, 0, siRelative, siView, siObj, siXYZ
SaveDeformKey "MySphere.surfmsh.cls.Point"
SetValue "Context.constructionmode", siConstructionModeModeling
'
' Playback the animation and see the effect of the rotation
' of the cone on the sphere
'
SetDisplayMode "Camera", "textured"
PlayForwardsFromStart

See Also

LinkDeform SaveDeformKey ApplyDeformKey