MAXScript Language Reference > 3ds Max Objects > Modifier : MAXWrapper and SpacewarpModifier : MAXWrapper > Modifier and SpacewarpModifier Types > Modifiers > Animation Modifiers >

# Flex : Modifier

    Flex - superclass: modifier; super-superclass:MAXWrapper - classID: #(-568876209, -1975393616)

Value > MAXWrapper > Modifier > Flex

| Modifier Classes - Quick Navigation

Constructor

    flex ...

Properties

    <Flex>.flex Float default: 1.0 -- animatable

Sets the amount of flex and bend. Larger values increase the effect. Range=0 to 1000.

    <Flex>.strength Float default: 3.0 -- animatable

Sets the spring strength. A value of 100 is rigid. Range=0 to 100.

    <Flex>.sway Float default: 7.0 -- animatable

Sets the time for the object to come to rest. Lower values increase the time for the object to come to rest. Range=0 to 100.

    <Flex>.chase Booleandefault: true

Turns chase springs on/off.

    <Flex>.center Boolean default: true

Turns the use of weights on/off.

    <Flex>.solver Integer default: 0

The type of solver that will be used:

0- Euler Solver

1- Mid-point solver

2- Runnge Kutta

The higher the solver number, the more accurate/stable it is, and the slower it will run.

    <Flex>.samples Integer default: 5 -- animatable

The number of samples per frame that the solver will use. The higher the number, the more accurate and stable; at the cost of a slower system.

    <Flex>.stretch Float default: 5.0 -- animatable

This parameter slaves to the stretch strength/sway fields. It is normalized then copied to the strength/sway fields to prevent the system from becoming unstable.

    <Flex>.stiffness Float default: 0.1 -- animatable

This parameter slaves to the torque strength/sway fields. It is normalized then copied to the strength/sway fields to prevent the system from becoming unstable.

    <Flex>.paintStrength Float default: 0.1

Sets the amount of weight that the brush leaves on the mesh. Higher values leave more weight. Range=-1 to 1.

    <Flex>.paintRadius Float default: 36.0

Set the size of the brush in world units. Range=.001 to 99999.

    <Flex>.paintFeather Float default: 0.7

Set the hardness of the brush. A value of 1 is soft. Range=-1 to 1.

    <Flex>.absolute Boolean default: false

Turn on to change the value of the Vertex Weight parameter to assign absolute weights to the selected vertices. Turn off to add or remove weight based on the vertices current weight.

    <Flex>.forceNode ArrayParameter default: #() --array containing Force Nodes; alias: Force_Nodes

Assigns force effect to particle space warps identified in an array.

    <Flex>.colliderNode ArrayParameter default: #() -- node array

Array contains a list of collider objects that flex will use.

    <Flex>.referenceFrame Integer default: 0 -- alias: Reference_Frame

Flex will start computing at this frame.

    <Flex>.endFrame Integer default: 100

Flex will stop computing after this time.

    <Flex>.enableEndFrame Boolean default: false

Turns the end frame on/off.

    <Flex>.affectAll Boolean default: false

Forces flex to ignore any selection in the stack, causing it to flex the entire object.

    <Flex>.enableAdvanceSprings Boolean default: false

Enables the advance spring fields. When this is off, the Stretch and Torque parameters are slaved to the Stretch and Stiffness parameters.

    <Flex>.stretchStrength Float default: 0.2 -- animatable

Controls the strength of stretch springs.

    <Flex>.stretchSway Float default: 0.2 -- animatable

Controls the sway of stretch springs.

    <Flex>.torqueStrength Float default: 0.2 -- animatable

Controls the strength of torque springs.

    <Flex>.torqueSwayFloat default: 0.2 -- animatable

Controls the sway of torque springs.

    <Flex>.holdLength Boolean default: false

Turns on/off the hold length parameter.

    <Flex>.holdLengthPercent Float default: 25.0

The maximum percentage the spring can stretch/squash.

    <Flex>.addMode Integer default: 0

Flag to determine how springs will be added:

0- Single spring across selected vertices

1- Edge Springs

2- Edge Springs across only selected vertices

3- Hold Springs

4- Hold Springs across only selected vertices

    <Flex>.displaySprings Booleandefault: false

Turns on/off the display of spring when in sub-object mode.

    <Flex>.holdRadius Float default: 50.0

The maximum distance that will be looked around when the hold springs are added.

    <Flex>.extraStrength ArrayParameter default: #(0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2) -- float array

Control the strength of extra springs (those that belong to a group other than 0 [stretch] or 1 [torque]).

    <Flex>.extraSway ArrayParameter default: #(0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2) -- float array

Control the sway of extra springs (those that belong to a group other than 0 [stretch] or 1 [torque]).

    <Flex>.lazyEval Boolean default: false

Turns on/off lazy evaluation, which causes the system to be reevaluated less at the expense of a less accurate display.

    <Flex>.springColors ArrayParameter default: #([0,0,1], [0.909091,0,0], [0.818182,0,0], [0.727273,0,0], [0.636364,0,0], [0.545455,0,0], [0.454545,0,0], [0.363636,0,0], [0.272727,0,0], [0.181818,0,0], [0.0909091,0,0], [0,0,0]) -- point3 array

The colors for the springs for each group.

    <Flex>.customSpringDisplay ArrayParameter default: #(true, true, true, true, true, true, true, true, true, true, true, true) -- bool array

This boolean array lets you turn on/off the display of the spring group.

    <Flex>.createSpringDepth Integer default: 2

The number of times the system is recursed when using create soft body.

    <Flex>.createSpringMult Float default: 2.0

The amount the flex effect is multiplied after each recursion when using create soft body.

The following property is defined by Flex, but is not used:

    <Flex>.paintBackface Boolean default: true

Flex interfaces:

    Interface: flexOps

Methods

    flexOps.Paint <flex>

Presses the paint button in the flex interface.

    flexOps.SetReference <flex>

Presses the Set Reference button in the flex interface.

    flexOps.Reset <flex>

Presses the Reset button in the flex interface.

    flexOps.AddForce <flex> <force>

Adds a force to the force list.

force (node) - The force to be added to the force list.

    flexOps.RemoveForce <flex> <force>

Removes a force to the force list.

force (integer) - The index of the force to be removed. If this index = -1 then the selected force will be removed.

    flexOps.NumberVertices <flex>

Returns and integer containing the number of points in the system.

    flexOps.SelectVertices <flex> <sel> <update>

Selects the vertices passed in sel .

Sel (bitarray) - The bitarray that holds the selection.

Update (boolean) - Determines whether the viewports get updated.

    flexOps.GetSelectedVertices <flex>

Returns bitarray containing the current selected vertices.

    flexOps.GetVertexWeight <flex> <index>

Returns the weight of a specific vertex.

index (integer) - The index of the vertex you want to get the weight of.

    flexOps.SetVertexWeight <flex> <Index_tab> <values_tab>

Sets the weight of vertices. These tables should be the same size.

index_tab (integer table) - A table of indices of the vertex you want to set the weight of.

values_tab (float table) - A table of values containing the weights.

    flexOps.SetEdgeList <flex> <sel> <update>

Sets the edges to sel .

Sel (bitarray) - The bitarray that holds the edge selection.

Update (boolean) - Determines whether the viewports get updated.

    flexOps.GetEdgeList <flex>

Returns bitarray containing the current edge selection list.

    flexOps.AddSpringFromSelection <flex> <flag> <addDupes>

This creates one spring between 2 selected vertices that belong to a group.

flag (integer) - The group that this spring will belong to.

addDupes (boolean) - Will add duplicates if true.

    flexOps.addSpring <flex> <a> <b> <flag> <addDupes>

This creates a spring between the 2 specified vertices.

a (integer) - Index of vertex of the start of the spring.

b (integer) - Index of the vertex of the end of the spring.

flag (integer) - Group springs belongs to (0 to12).

addDupes (boolean) - When true, if there is a duplicate spring it will be added.

    flexOps.removeAllSprings <flex>

Removes all the springs the in the system.

    flexOps.addSpringButton <flex>

Equivalent of hitting the Add Spring button in theuserinterface.

    flexOps.RemoveSpringButton <flex>

Equivalent of hitting the Remove Spring button in theuserinterface.

    flexOps.optionsButton <flex>

Equivalent of hitting the Options button in theuserinterface.

    flexOps.createSimpleSoftButton <flex>

Equivalent of hitting the Create Simple Soft Bodies button in theuserinterface.

    flexOps.RemoveSpringByEnd <flex> <a>

This removes all springs that are connected to a vertex.

a (integer) - The vertex index to be checked.

    flexOps.removeSpringByEnds <flex> <a> <b>

This removes all springs that are connected to both vertex a and b.

a (integer) - First vertex index.

b (integer) - Second vertex index.

    flexOps.removeSpringByIndex <flex> <index>

Remove a spring from the list which is at index in the spring list.

index (integer) - Index of the spring.

    flexOps.numberSprings <flex>

Returns the number of springs in the system

    flexOps.getSpringGroup <flex> <index>

Returns the group that the spring belongs to.

index (integer) - Index of the spring you want to examine.

    flexOps.setSpringGroup <flex> <index> <group>

Sets the spring’s groups.

index (integer) - Index of the spring.

group (integer) - The group number (0-12).

    flexOps.getSpringLength <flex> <index>

Gets the rest length of a particular spring.

index (integer) - Index of the spring that you want to examine.

    flexOps.setSpringLength <flex> <index> <length>

Sets the rest length of a particular spring.

index (integer) - Index of the spring that you want to examine.

length (float) - The rest length of the spring.

    flexOps.getIndex <flex> <a> <b>

Returns the index of a spring that uses vertex a and b.

a (integer) - Index of the start vertex of the spring.

b (integer) - Index of the start end of the spring.

    FlexOps Methods

    flexOps.GetNumberVertices <Flex>

Returns the number of vertices in the object the Flex modifier is applied to.

    flexOps.GetVertexWeight <Flex> <vertex_index_integer>

Returns the weight of the specified vertex.

    flexOps.SelectVertices <Flex> (<vertex_index_integer> | <index_integer_array> | <bitarray>)

Selects the specified vertices. Clears any previously selected vertices.

    flexOps.isEdgeVertex <Flex> <vertex_index_integer>

Returns 0 if the specified vertex is not an edge vertex, 1 if it is an edge vertex.

    flexOps.ClearEdgeVertices <Flex> (<vertex_index_integer> | <index_integer_array>)

Sets the specified vertices to not be edge vertices.

    flexOps.SetEdgeVertices <Flex> (<vertex_index_integer> | <index_integer_array>)

Sets the specified vertices to be edge vertices.

    flexOps.SetVertexWeights <Flex> (<vertex_index_integer> | <index_integer_array>) (<weight_integer> | <weight_integer_array>)

Assigns the specified weights to the specified vertices. If the vertices and weights are specified as arrays, the arrays must be of equal size.

Note

If deferred plug-in loading is enabled, an instance of the Flex modifier must be created before these methods will be visible. This is because these methods are defined in the Flex modifier plug-in.

You can't add deflectors to Flex through MAXScript.

#### See Also

- Modifier Common Properties, Operators, and Methods

- MAXWrapper Common Properties, Operators, and Methods

- Value Common Properties, Operators, and Methods