L3DT documentation
Large 3D terrain generator

menu_InsertItem

This function has been deprecated. Please use menu_InsertItem2 instead.

Description

Add an item to the menu in L3DT.

Function prototype

bool CExtAPI::menu_InsertItem(const char* lpFnName, const char* lpOptionName);

Arguments

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.

Return value

False if an error occurred, and true otherwise.

Comments

Use with zeofunc_LoadFunc

The lpFnName argument must be the name of a function loaded from your plugin via the zeofunc_LoadFunc method. See the example provided below.

Where the menu items go

All menu items are created in the 'Extensions→[your plugin name]' menu in L3DT.

Sub-menus

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…')

Example

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");
 
zeolite/functions/menu_insertitem.txt · Last modified: 2017/08/31 04:37 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki