What would a Plug-in Publish?
The various kinds of functions published by a plug-in usually fall into the following categories. You can, however, publish anything you want.
- Important algorithms in the plug-in, for example, the Edit Mesh modifier might publish its face extrude and mesh attach functions, or the flex modifier its soft-body dynamics algorithms. In these cases, the functions would be parameterized in the most general way, independent of any current scene state or UI mode in 3ds Max, for example, the face extrude might take a Mesh, a set of faces and a distance.
- Functions that enquire about or affect the state of one of the plug-in's objects in the scene. Usually, these are unnecessary if the plug-in stores its state as parameters in ParamBlock2s, which are already accessible externally, but in cases were this is not done or certain kinds of state are not cleanly accessible via the ParamBlock2 system, extra functions may be published by the plug-in. These usually take an instance of one of the plug-in's objects as one of their parameters, and should be independent of any UI mode, for example, they should not require that the object being manipulated be the current focus in the Command Panel. Prior to R4, plug-ins that wished to provide scripter access to internal functions would use the MAXScript SDK to provide scripter wrapper functions. In R4, the recommended and much simpler technique, is to use the Function Publishing system, as this not only provides automatic scriptability, but is a general mechanism for any external system to control and use the plug-in.
- UI action functions. These basically provide a programmatic way of "pressing" buttons and keys in the UI for a plug-in and are specifically meant to be UI modal. They take no parameters, since these are defined by the current state in the UI. For example, the vertex delete action function for an Editable Mesh object would operate on the current vertex selection for the current object in the Modify panel. These are not unlike the keyboard ShortcutTables that plug-ins could publish in R3, but by publishing them as action functions, any external system can effectively control the UI of a plug-in. As well as being automatically exposed in the scripter like other published functions, Action functions are automatically entered into the new ActionTable system. This is a generalization of the R3 ShortcutTable system and basically holds all the commands and actions that may be bound to hotkeys or added to menus or put in buttons on a toolbar using the R4 CUI system, so that by publishing your action functions using the FnPub system, you are making them automatically available for binding to hotkeys and placing in menus and toolbar buttons. Action functions are treated specially in the FnPub system, and have extra descriptor data for things like menu item text, tooltip text, enable predicates, etc.