The f_ui
option for an Action Function can be used to make the ParamMap2
system connect the action function to a button in a ParamMap2-mediated rollup in your plug-in's UI. This means you have to be using the ParamBlock2 system in the interface's plug-in (ie, same ClassDesc2
) and have at least one paramblock containing a paramMap whose rollup contains the button dialog item.
In the f_ui
option, you first specify the BlockID of the paramblock containing this paramMap and then MapID of the map within that block (single map blocks use MapID 0). This is followed by a control type code, and its required parameters, as listed below:
TYPE_BUTTON, <dlg_item_ID>
a standard push button. The dialog item must be a 3ds Max CustButton
custom control.
TYPE_CHECKBUTTON, <dlg_item_ID>, <highlight_color>
a standard check button. Again, the dialog item must be a 3ds Max CustButton
custom control, the 2nd parameters is the button highlight color as a COLORREF
word, either one of the predefined colors in maxsdk
\include\custcont.h, or an RGB value using the system RGB()
macro.
This is basically all you need to do. Whenever the specified map opens its rollup, say as part of a BeginEditParams
, it will automatically look for any Action functions associated via an f_ui
and will call that action function whenever the button is clicked. If an isEnabled
predicate is supplied, the ParamMap2
will call it at various display update times to determine whether to enable or disable (gray out) the button. For CheckButtons, an isChecked
predicate must be supplied and will be called at similar times to update the pressed or not-pressed state of the button display.