mapKeys() method

The mapKeys() method gives access to the SDK function Control::MapKeys().

The form is:

mapKeys <max_object> (<map_struct> | <fn> <arg>) [#allKeys] [#selection] * [#slide] [#rightToLeft]

 

This is like other recursive controller key functions in MAXScript, such as moveKeys, deleteKeys, etc., which operate on all the keys in nested controllers in the object you supply. The thing to be mapped is either a scripted function and argument pair or a struct instance. If a function is supplied, it should take two arguments, the time value to be mapped and the <arg> from the mapKeys() call, and pass back the mapped time.

Example:

fn bumpTime t delta = t + delta

mapKeys $Box01 bumpTime 23 #selection

will add 23 to all the selected keys in controllers within $Box01.

If a struct is supplied, it should have at least a 'map' member function that takes a time to be mapped and returns the mapped time. The advantage of a struct is that it is a way to set up complex parameterized mapping by having as many data members as needed to hold the parameters.

Example:

struct mapper

(

scale,

offset,

fn map t = return t * scale * offset

)

 

mapKeys $foo (mapper scale:0.5 offset:10)

will execute a combination time scale and offset in one pass.

See also

Time and Key Functions on Object Hierarchies

Nested Object Controller Functions

Controller Time Functions

Controller Key Functions

MAXKeyArray Values