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
, and others, 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 must 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 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
b=box()
struct mapper
(
scale,
offset,
fn map t = return t * scale * offset
)
mapKeys b (mapper scale:0.5 offset:10)
will execute a combination time scale and offset in one pass.