## SIModifyFlexEnvWght

### Introduced

v1.0

### Description

Modifies the weighting of envelope points. An envelope is an object or hierarchy that is assigned as a "skin" to a set of deformers such as IK chains. Envelopes move and deform in response to the movements of their deformers. In this way, for example, a character moves as you animate its skeleton.
Every point in an envelope is assigned to one or more deformers. For each point, weights control the relative influence of its deformers.
Note: An alternative, and potentially faster, way to set envelope weights is via the Object Model, see Envelope.Weights.

### Scripting Syntax

    oReturn = SIModifyFlexEnvWght( PropObj, Name, [SubComp], [Mode], [Value], [Normalize] );

### Return Value

Returns an XSICollection that contains the new envelope operators.

### Parameters

Parameter | Type | Description
--- | --- | ---
PropObj | String | Envelope weights property to be modified.
Name | String | Name of a deformer object. Weight values relative to this object are modified.
SubComp | String | List of points. Default Value: Current selection
Mode | Integer | Weight modification mode Default Value: 0 (Absolute)
Possible Values: | Description:
0 | Absolute
1 | Additive
2 | Add Percentage
Value | Float | Weight value applied to the specified points. Note: The valid value range for weights is between 0 and 100.0. When you change the weight for one of the deformers, it also affects other deformer weights since the total weight is always 100%. Default Value: 100.0
Possible Values: | Description:
0 to 100.0 | Valid value range is between 0 and 100.0
Normalize | Boolean | Normalize weights between deformers. Default Value: True

### Examples

#### VBScript Example

    'CreateSinusoidalEnvelope: creates an envelope over 2 Nulls,

    'with a customized, special wave-like weight assignment.

    '

    'A generic subroutine was created; it can handle any mesh as input.

    Sub CreateSinusoidalEnvelopeAssign( Object, out_Null0, out_Null1 )

    'Create the two envelope "handles"

    Set out_Null0 = GetPrim("Null")

    Set out_Null1 = GetPrim("Null")

    'Envelope the object with the 2 Nulls

    Set EnvelopeWeightsAssign =_

    ApplyFlexEnv(Object & ";" & out_Null0 & "," & out_Null1, False)

    Set EnvelopeWeightsProperty = _

    GetValue( CStr( EnvelopeWeightsAssign ) ).Owners(0)

    'Reset all weights to 100% for Null0 and 0% for Null1

    '(use absolute mode), with normalize ON

    SIModifyFlexEnvWght EnvelopeWeightsProperty, out_Null0,_

    Object & ".pnt[*]", 0, 100, True

    'Get object's points collection

    Set Points = Object.ActivePrimitive.Geometry.Points

    NbPts = Points.Count

    for i = 0 to NbPts - 1

    'We will set the weight of out_Null1 as

    '"(1 + Sin(Z Coord of the point))*100/8" (or any formula).

    'We will user the additive mode in SIModifyFlexEnvWght.

    Weight = (1 + Sin(Points(i).position.z * 2.0))*50

    SIModifyFlexEnvWght EnvelopeWeightsProperty, out_Null1,_

    Object & ".pnt[" & i & "]", 1, Weight

    next

    End Sub

    'Call CreateSinusoidalEnvelopeAssign with a Grid.

    'Then move one of the 2 Null deformers in order to see the effect.

    NewScene

    Set Grid = CreatePrim("Grid", "MeshSurface")

    SetValue Grid & ".polymsh.geom.subdivu", 1

    SetValue Grid & ".polymsh.geom.subdivv", 30

    CreateSinusoidalEnvelopeAssign Grid, Null0, Null1

    'Translate Null1 to see the effect of the special weighting

    'You can move Null1 to see more...

    Translate Null1, 3, 0.0, 0.0, siRelative, siView, siObj, siXYZ

    'Let's show the weight maps so you can see what was computed:

    SetDisplayMode "Views.ViewA.TopCamera", "constant"

    SetValue "Views.ViewA.TopCamera.camvis.objctrlpropmaps", True

    SelectObj "grid", , True

### See Also

SIApplyFlexEnv Envelope