Access to the node bone properties and methods

There are several properties and methods accessible on scene nodes that correspond to the Bone parameters and functions in the node properties dialog. These properties and methods are exposed by the INode Node Interface.

Interface : INode

Properties:

<node>.boneEnable

boolean, read-only, see <node>.setBoneEnable for the set method.

<node>.boneAutoAlign

boolean

When turned off, the bone's pivot point will not align to its child object. The translation of a child bone will not be converted into rotation of the parent. Instead the child will be allowed to move away from the parent's X-axis.

Note:

Changing the state of this check box will not have an immediate visual effect on the skeleton. It only affects future behavior when bones are moved. This option is only available if Bone is off.

<node>.boneFreezeLength

boolean

When turned on, the bone maintains its length. When turned off, the bone's length is based on the translation of its child bone. This option is available only if Auto-Align is on.

<node>.boneScaleType

one of #scale, #squash, or #none

None: No stretch takes place.

Scale: Lets the bone scale. The stretch happens along one axis.

Squash: Lets the bone squash. The bone gets fatter as it gets shorter, and thinner as it gets longer.

<node>.stretchTM

matrix3, read-only.

Normally, matrix concatenation occurs in the following manner:

objectTM = objectOffsetTM * stretchTM * nodeTM

So code that uses the objectTM will transparently inherit the effects of the stretchTM. However if you want the stretchTM included but not the object offset, this property will return the stretchTM alone. If the node is not a bone or has no stretching, this property will return the identity matrix.

Methods

<node>.setBoneEnable <onOff_boolean> <initial-time_time>

Sets the Bone enable on or off.

<onOff boolean>

When turned on, the bone or object behaves as a bone. Turning this option off causes the node to stop behaving like a bone. There is no auto alignment or stretching. Note that turning this option on will not cause the object to immediately align or stretch. However future translations of children may cause rotation and stretching. Default=on for bone objects, off for other objects.

<initial-time time>

Specifies the time at which to calculate and store initial child position. This is usually used with the current time slider position. The time associated with the time slider can be queried and set using the sliderTime global variable. Time Control

Note:

A very good macroscript example to review, which uses .setBoneEnable, can be found in your 3ds Max directory at: \ui\macroscripts\Macro_Bones.mcr.

<node>.realignBoneToChild()

Rotates the node such that its X axis points at the average position of all children with the bone property turned on.

<node>.resetBoneStretch()

Resets the initial child position used to compute the stretch factor to the current child position. This will cause the stretch factor to become equal to one. If it was previously not equal to one then the object would snap to its original unstretched state.

See also

Interface : INode

Node Common Properties, Operators, and Methods

Bone Creation

Bone : Helper

Skin : Modifier

Bones : System

Interface: BoneSys