Macro Recorder Emission From Rollout UI Actions

When performing a UI action from a scripted rollout, MAXScript disables the MacroRecorder.

To allow the code emission from UI actions modifying existing paramBlock parameters, the following context can be specified in 3ds Max 2013 and higher:

with macroRecorderEmitterEnabled <bool_expr> <expr>

When <bool_expr> evaluates to true , the MacroRecorder will be enabled and relevant changes to paramBlock parameters, as well as scene node creation, will trigger code emission. Creation arguments will not be recorded.

When <bool_expr> evaluates to false , or if the context is not specified at all, the expression will produce no Macro Recorder output.

Note: Other scene changes like object deletion, or calls to other functionality except for paramBlock changes will not produce Macro Recorder output.

EXAMPLE

   rollout testMacroRecorderEmission "Test MRec Emission"
   (
       local theSpheres = #()
       checkbox chk_emitMacroRecorderCode "Emit MacroRecorder Code"
       button btn_modifyRandomSphere "Modify Random Sphere Radius"

       on btn_modifyRandomSphere pressed do
       (
           with macroRecorderEmitterEnabled chk_emitMacroRecorderCode.checked 
           (
               theSpheres[random 1 theSpheres.count].radius = random 10 100
           )
       )
       on testMacroRecorderEmission open do
       (
           for y = 1 to 5 do 
               for x = 1 to 5 do
                   append theSpheres (sphere radius:10 pos:[x*50,y*50,0])
       )
   )
   createDialog testMacroRecorderEmission