Add an item to the menu in L3DT.
bool CExtAPI::menu_InsertItem(const char* lpFnName, const char* lpOptionName);
Name | Type | Comment |
---|---|---|
lpFnName | const char* | A pointer to a C-style string containing the name of the ZeoFunc to be activated by this menu option. |
lpOptionName | const char* | A pointer to a C-style string containing the display name of the menu option. |
False if an error occurred, and true otherwise.
The lpFnName argument must be the name of a function loaded from your plugin via the zeofunc_LoadFunc method. See the example provided below.
All menu items are created in the 'Extensions→[your plugin name]' menu in L3DT.
The '.' (dot) character is used to delimit nested menus. Thus, if you provide an lpOptionName of “mysubmenu.myoption”, your option will appear at 'Extensions→[your plugin name]→mysubmenu→myoption'. Unfortunately, this means you cannot use dots for abbreviations or ellipsis (e.g. 'about…')
This is from the InitPlugin funtion of atSphericalDistort:
// create the info function theAPI.zeofunc_LoadFunc("ExtAbout", VarID_void, NULL); // create the worker function (SphericalDistort) ZLIST hArgs = theAPI.var_CreateTemp(VarID_varlist); theAPI.list_CreateItem(hArgs, VarID_map, "hMap"); theAPI.list_CreateItem(hArgs, VarID_double, "radius"); theAPI.zeofunc_LoadFunc("ExtSphericalDistort", VarID_bool, hArgs); theAPI.var_Delete(hArgs); // delete temp arg list // create the user-interface function (SphericalDistortUI) theAPI.zeofunc_LoadFunc("ExtSphericalDistortUI", VarID_bool, NULL); // add menu options (HERE IS THE MENU EXAMPLE) theAPI.menu_InsertItem("ExtSphericalDistortUI", "Distort heightfield"); theAPI.menu_InsertItem("ExtAbout", "About");