ApplyDeformKey

Categories

animation deformation

Description

Saves a pose-based deformation key. In addition to saving and selecting shape keys, you can also use pose-based deformation to create shape animations. To do this, you link one or more parameters to drive the deformation on a selected cluster, and then set deform keys for the different poses you want.

For example, you can control the blending of a shape-animated object according to the position of a sphere (its position drives the shape animation). As the sphere gets closer to a deform key associated to a certain pose (as indicated by a small sphere), the target object takes on that shape: when the sphere is between deform keys, the target object takes on a combination (interpolation) of these deform keys.

Tip: You can use an already defined shape to apply a deform key. Simply select the deform key and choose Deform > Shape > Apply Deform Key to apply it to the object for which you saved it at its current pose.

Scripting Syntax

oReturn = ApplyDeformKey( [InputObj] );

Return Value

Returns the key.

Parameters

Parameter Type Description
InputObj String Cluster shape key to use for setting the deform

Default Value: Current selection

Examples

VBScript Example

'
' This example demonstrates how to use the ApplyDeformKey command to
' apply a shape deformation previously created
'
NewScene , false
' First get the old construction mode
iOldMode = GetValue( "Context.ConstructionMode" )
SetValue "Context.ConstructionMode", siConstructionModePrimaryShape
' Create the object to deform
CreatePrim "Sphere", "NurbsSurface"
' Select the points used for deformation and cluster them
CreateCluster "sphere.pnt[(5,4),(6,4),(7,4),(0,5),(1,5),(2,5),(3,5),(4,5),(5,5),(6,5),(7,5),(0,6),(1,6),(2,6),(3,6)]"
' Link the deformation of the cluster with the parameter sphere.kine.local.posx
LinkDeform "sphere.surfmsh.cls.Point", "sphere.kine.local.posx"
' Translate the sphere at X = -10
Translate "sphere", -10, 0, 0, siAbsolute
SaveDeformKey "sphere.surfmsh.cls.Point"
SetValue "sphere.surfmsh.cls.Point.PoseDeform1.Name", "SphereNormal"
' Deform the sphere at X = 0 and save the deformation
Translate "sphere", 0, 0, 0, siAbsolute
Scale "sphere.surfmsh.cls.Point", 1, 1, 2, siAbsolute, siParent, siObj, siZ
Scale "sphere.surfmsh.cls.Point", 2, 1, 1, siAbsolute, siParent, siObj, siX
SaveDeformKey "sphere.surfmsh.cls.Point"
SetValue "sphere.surfmsh.cls.Point.PoseDeform1.Name", "SphereFat"
' Translate the sphere at X = 10 and apply the deformation called SphereNormal
Translate "sphere", 10, 0, 0, siAbsolute
Refresh
ApplyDeformKey "sphere.surfmsh.cls.Point.SphereNormal"
' Pop up a Deform Control window. If you left click on the slider, 
' you will see the deformation of the sphere linked with the translation on the X axis
InspectObj "sphere.surfmsh.cls.Point.DeformControls"
' Restore the original construction mode
SetValue "Context.ConstructionMode", iOldMode

See Also

LinkDeform SaveDeformKey