## LinkDeform

### Description

Sets up pose-based deformation so that shape animation can be driven by one or more specified parameters (the position and orientation of an element in a scene, for example). Once the pose-base deformation is set up using LinkDeform and deform keys are created (using ApplyDeformKey or SaveDeformKey), the selected parameters drive the deformation of the geometry. The resulting deformation is interpolated smoothly between the shapes in the N-space defined by the N parameters selected.
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 = LinkDeform( [Cluster], [Parameter list], [LinkWithOri] );

### Return Value

Returns an ISIVTCollection containing an XSICollection which contains the objects whose numerical parameters are 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 numerical parameters to link with the shape. Default Value: Picked in explorer.
LinkWithOri | Boolean | True to link deformation with rotation. Default Value: False

### Examples

#### 1. VBScript Example

    ' This example illustrates how to control the shape of an object (a sphere) based on two parameters
    ' its position in x and in z.
    NewScene
    ' Here we create the geometry that will be deformed
    CreatePrim "Sphere", "MeshSurface"
    ' We create the specific cluster that will be deformed
    SelectGeometryComponents "sphere.pnt[4-6,11-13,18-20,25-27,32-34,39-41,46-48,53-55]"
    CreateCluster
    ' We link the deformation of the new cluster to the position of the sphere in x and z
    LinkDeform "sphere.polymsh.cls.Point", "sphere.kine.global.posz,sphere.kine.global.posx"
    ' Finally we model and save deform keys defining the relationship between the different
    ' sphere positions and the shape
    Translate "Sphere", -10, 0, 0, siAbsolute, siParent, siObj, siX
    ActivateVertexSelTool
    Scale "sphere.polymsh.cls.Point", 0.267441860465116, 1, 1, siRelative, siLocal, siObj, siXYZ
    SaveDeformKey "sphere.polymsh.cls.Point"
    Translate "Sphere", 10, 0, 0, siAbsolute, siParent, siObj, siX
    Scale "sphere.polymsh.cls.Point", 0.313953488372093, 1, 1, siRelative, siLocal, siObj, siXYZ
    SaveDeformKey "sphere.polymsh.cls.Point"
    Translate "Sphere", 0, 0, 10, siAbsolute, siParent, siObj, siZ
    Scale "sphere.polymsh.cls.Point", 1, 1, 0.302325581395349, siRelative, siLocal, siObj, siXYZ
    SaveDeformKey "sphere.polymsh.cls.Point"
    Translate "Sphere", 0, 0, -10, siAbsolute, siParent, siObj, siZ
    Scale "sphere.polymsh.cls.Point", 1, 1, 0.27906976744186, siRelative, siLocal, siObj, siXYZ
    SaveDeformKey "sphere.polymsh.cls.Point"
    ' To see the result translate the sphere in the XZ plane. The multi-link interpolator will
    ' calculate a smooth blending between the deform keys over the space defined by the two parameters

#### 2. VBScript Example

    '
    ' In this example, an animation is created (on Y axis) on
    ' a sphere. A cluster is created with some points of the
    ' sphere, and the cluster is "linked" for deform with the
    ' local YPos parameter of the sphere. In this way, changes
    ' on YPos of the sphere will deform its shape.
    ' Two deformations (i.e. moves) of the points of the cluster are
    ' performed in different frames, and each of the deformation acts
    ' as DeformKey.
    '
    NewScene
    CreatePrim "Sphere", "NurbsSurface", "MySphere"
    ' Create anim key of YPos of the sphere, at different frames
    SetValue "PlayControl.Out", 40
    SaveKey "MySphere.kine.local.posy", 1, -3.0
    SaveKey "MySphere.kine.local.posy", 30, 3.0
    SaveKey "MySphere.kine.local.posy", 40, 1.5
    ' Create a cluster in the sphere, and create a LinkDeform
    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
    LinkDeform "MySphere.surfmsh.cls.Point", "MySphere.kine.local.posy"
    ' Create the first Deform key at frame 1, with translation of
    ' points of the cluster
    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"
    ' Playback the animation
    SetDisplayMode "Camera", "textured"
    PlayForwardsFromStart

### See Also

SaveDeformKey ApplyDeformKey LinkDeformWithOri