Interface: OffsetManager

The OffsetManager Core Interface exposes methods for creating and managing Offset controllers and Animation Presets. Available in 3ds Max 2017 and higher.

Properties:

None

Methods:

Animation > Offset Controllers menu

<void>OffsetManager.addSel()

Opens the “Select Controllers” dialog and displays the controllers of the selected objects.

Equivalent to invoking the Main Menu > Animation > Offset Controllers > Add Offset Controllers menu item.

<void>OffsetManager.RemoveOffsetControlDlg()

Opens the “Remove Offset Controllers” dialog.

Equivalent to selecting the Main Menu > Animation > Offset Controllers > Delete Offset Controllers menu item.

Animation > Presets menu

<void>OffsetManager.LoadEffectDlg()

Opens the Load Preset dialog and lets the user assign a Preset to the current selection.

<void>OffsetManager.PublishLocal <maxObject>modifier <node>template <&node array>nodes

nodes is In and Out parameter

Applies the Preset controlled by the Preset_Maker Modifier supplied as first argument from the template node specified by the second argument to the by-reference array of nodes supplied by the third argument.

<void>OffsetManager.RemoveEffectFromNodes <string>name <&node array>nodes

nodes is In and Out parameter

<void>OffsetManager.createTemplate()

Opens the “Select Preset Controllers” dialog for the currently selected object.

A single object must be selected for the dialog to open.

Equivalent to invoking the Main Menu > Animation > Presets > Create Preset menu item.

<void>OffsetManager.RemoveEffectFromDisk <string>name

Removes the specified named Preset from disk.

Roughly equivalent to opening the Main Menu > Animation > Presets > Remove Preset From Disk menu item, but instead on opening a dialog, it deletes the specified named preset directly.

Modifier > “Offset Motion Controls” rollout > “Offset Order By Distance” group of controls

<void>OffsetManager.OffsetByPos <node>center <node array>nodes <boolean>x <boolean>y <boolean>z

Applies a new position-based offset to the nodes array passed as second argument starting from the center node given as first argument.

The three Boolean arguments enable distance measurements along the X, Y and Z axes of the center node.

Equivalent to the “Set Offset By Distance” controls exposed in the Offset modifier’s UI.

Modifier > “Preset Maker” rollout

<void>OffsetManager.PublishToFile <maxObject>modifier <node>template

Saves to disk a named Preset using the Preset_Maker modifier specified as first argument, and the template node specified as the second argument.

The name of the preset will be taken from the Preset_Maker modifier’s .publishFile property.

Equivalent to pressing the “Save Preset” button in the “Preset Maker” rollout of the modifier.

MAXScript-Only Functions

<void>OffsetManager.LoadEffect <string>name

Loads from disk a previously saved named Preset and applies it to the current selection.

This is similar to OffsetManager.LoadEffectDlg() but operates on the named Preset directly without opening an interactive dialog.

To get the name of a preset, use the OffsetManager.GetEffectList() method (see below).

<void>OffsetManager.GetEffectList <&string array>names

names is Out parameter

Returns into the by-reference argument an array of the names of previously saved to disk Preset.

This is similar to OffsetManager.LoadEffectDlg() but returns the names of the Presets as a MAXScript array of strings value instead of opening an interactive dialog.

<void>OffsetManager.ReorderEffect <string>name

Goes through the offset controllers and resets their Order IDs to their original values.

When offset controllers are first applied, the Order ID is incremented for each controller to determine the order in which the controllers are played back.

The user can modify the Order ID to change the playback order.

This method resets the Order IDs back to the default state.

<void>OffsetManager.AddNodeToEffect <string>name <&node array>nodes

nodes is In and Out parameter

Adds the nodes specified by the by-reference node array as second argument to the named Preset specified by the first string argument.

<void>OffsetManager.addMenu()

For Internal use only.

Actions:

None

Example 1
(
resetMaxFile #noprompt --reset the scene without prompting
animationRange = interval 0 140 --set the scene time range to 140 frames
c = cylinder heightsegs:32 height:100 --create a tall cylinder
copiesArray = for i = 1 to 21 collect --create a few copies
(
 	cc = copy c --copy the original cylinder
 	cc.pos = [(i-1)*40,0,0] --move the copy 40 units along X
 	cc.wirecolor = green --set the object color to green
 	cc --collect the copy in the array
)
 
b = bend direction:90 --create a Bend modifier rotated at 90 degrees
addmodifier c b --add the Bend modifier to the cylinder
with animate on  --enable animation
(
 	at time 15 b.angle = 90 --set Bend Angle to 90 degrees at frame 15
 	at time 30 b.angle = 0  --set Bend Angle back to 0 at frame 30
)
 
select c --select the original cylinder
OffsetManager.createTemplate() --prompt the user to create a template
c.modifiers[1].timingUI.perNodeOffset = 5 --set Per Node Delay to 5 frames
 
OffsetManager.PublishLocal c.modifiers[1] c &copiesArray --apply the template to the copies
 
c.modifiers[1].publishFile = "Bend90DegOver30F" --give the preset a name
OffsetManager.PublishToFile c.modifiers[1] c --and save it to disk for future use
 
delete c --delete the original cylinder
 
OffsetManager.OffsetByPos copiesArray[11] copiesArray true false false --start from the middle
 
max zoomext sel all --zoom extents all
redrawViews() --redraw the views
playAnimation() --and play back the animation...
)

Example 2
(
x = box heightsegs:32 height:250 --create a tall box
copiesArray = for i = 1 to 21 collect --create a few copies
(
 	cx = copy x --copy the original box
 	cx.pos = [(i-1)*40,60,0] --move the copy 40 units along X and 60 along Y
 	cx.wirecolor = color 200 40 100 --set the object color to pink
 	cx --collect the copy
)	
delete x --delete the original
select copiesArray --select the newly created box copies
OffsetManager.LoadEffect "Bend90DegOver30F" --load the preset saved in Example 1
max zoomext sel all --zoom extents all
)