## LockEnvelopePointWeights

### Introduced

v5.0

### Description

Prevents modifying the envelope weights of the specified points.
The effect of an envelope deformation is controlled by a weight mapping. You can modify these envelope weights with painting, smoothing, or numerical edition tools. This command allows you to block weights for some deformers to be modified either directly or indirectly through normalization.

### Scripting Syntax

    oReturn = LockEnvelopePointWeights( PropObj, [SubComp], [Locked] );

### Return Value

Returns an XSICollection that contains the new operator that applies the locking.

### Parameters

Parameter | Type | Description
--- | --- | ---
PropObj | String | Envelope weights property for which we want to lock the weights.
SubComp | String | List of points or cluster to be locked. Default Value: Current selection
Locked | Boolean | Should these deformers be locked (otherwise unlocked). Default Value: True

### Examples

#### VBScript Example

    ' This simple example illustrates how locking envelope point weights

    ' can be used to protect your weighting work on parts of the

    ' an object

    ' We start with a simple cylinder enveloped to a 6 bone chain

    NewScene

    CreatePrim "Cylinder", "MeshSurface"

    SetValue "cylinder.cylinder.height", 10

    SetValue "cylinder.polymsh.geom.subdivv", 20

    SetValue "cylinder.polymsh.geom.subdivu", 16

    Create2DSkeleton 1.97818728045807E-02, 5.04656031338284, 0, 0.81105678498785, 3.66123003127775, 0, 0, 0, 0, 4

    AppendBone "eff", 0.890184276206176, 1.91967196234563, 0

    AppendBone "eff", 0.969311767424504, 0.257275623819517, 0

    AppendBone "eff", 1.00887551303367, -1.76134850153362, 0

    AppendBone "eff", 0.969311767424504, -3.18625964884171, 0

    AppendBone "eff", 1.97818728045807E-02, -4.96739858297683, 0

    SelectObj "cylinder", , True

    ApplyFlexEnv "cylinder;bone,bone1,bone2,bone3,bone4,bone5,eff", False, 0

    ' We reassign some points to the first bone

    LocalAssignFlexEnv "cylinder.pnt[1,21-24,44-47,67-70,90-93,113-116,136-139,159-162,182-185,205-208,228-231,251-254,274-277,297-300,320-323,343-346,366-LAST]", "cylinder;bone"

    ' We reassign some points to the second bone

    LocalAssignFlexEnv "cylinder.pnt[18,19,41,42,64,65,87,88,110,111,133,134,156,157,179,180,202,203,225,226,248,249,271,272,294,295,317,318,340,341,363,364]", "cylinder;bone1"

    ' We reassign some intermediate point to both bones

    LocalAssignFlexEnv "cylinder.pnt[20,43,66,89,112,135,158,181,204,227,250,273,296,319,342,365]", "cylinder;bone,bone1"

    ' Now let's assume that the weighting for those bones is what

    ' we want. To protect it from unexpectedly modifying it later on

    ' we lock the weights.

    LockEnvelopePointWeights , "cylinder.pnt[1,18-24,41-47,64-70,87-93,110-116,133-139,156-162,179-185,202-208,225-231,248-254,271-277,294-300,317-323,340-346,363-LAST]", True

    ' We continue the assignment of some points to the third bone

    LocalAssignFlexEnv "cylinder.pnt[15,16,38,39,61,62,84,85,107,108,130,131,153,154,176,177,199,200,222,223,245,246,268,269,291,292,314,315,337,338,360,361]", "cylinder;bone2"

    ' Similarily we reassign some points to the second and third bone

    LocalAssignFlexEnv "cylinder.pnt[17,40,63,86,109,132,155,178,201,224,247,270,293,316,339,362]", "cylinder;bone1,bone2"

    ' We smooth the weights for some points selected

    SISmoothEnvWght , "cylinder.pnt[16-18,39-41,62-64,85-87,108-110,131-133,154-156,177-179,200-202,223-225,246-248,269-271,292-294,315-317,338-340,361-363]"

    SetValue "cylinder.polymsh.cls.EnvelopWeightCls.Envelope_Weights.smoothenvelopeweight.neighborhooddepth", 3

    SetValue "cylinder.polymsh.cls.EnvelopWeightCls.Envelope_Weights.smoothenvelopeweight.profilescaling", 14.681

    ' Inadvertently, we selected some points that which weights we didn't want

    ' to modify. However, since we had locked their weights remain

    ' intact.

    ' Now I can modify some locked weights by unlocking them first.

    LockEnvelopePointWeights , "cylinder.pnt[1,22-24,45-47,68-70,91-93,114-116,137-139,160-162,183-185,206-208,229-231,252-254,275-277,298-300,321-323,344-346,367-LAST]", False

    SIModifyFlexEnvWght "cylinder.polymsh.cls.EnvelopWeightCls.Envelope_Weights", "bone1", "cylinder.pnt[1,22-24,45-47,68-70,91-93,114-116,137-139,160-162,183-185,206-208,229-231,252-254,275-277,298-300,321-323,344-346,367-LAST]", 1, 10

    ' I can also unlock all weights in order to weight freely.

    ClearEnvelopeWeightLocks "cylinder"

### See Also

SIApplyFlexEnv LockEnvelopeDeformerWeights LockEnvelopeWeights ClearEnvelopeWeightLocks SIModifyFlexEnvWght Envelope