3DCoat  3D-COAT 4.9.xx
3DCoat is the one application that has all the tools you need to take your 3D idea from a block of digital clay all the way to a production ready, fully textured organic or hard surface model.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
UI definition

Placement of the menu scripts

Menu in the 3D-Coat defined using c++ like script (angelscript). Each room may have own menu structure. If the room has own menu structure it is placed in
app_path_customrooms() + "CustomRooms/room_name_menu.cpp"
If the room has not own menu structure the menu script will ba taken from
app_path_customrooms() + "menu.cpp"
Usually menu script looks like

void main(){
start_main_menu("FILE");
menu_item("CLEARSCENE");///New
menu_hotkey("N", 0, 1, 0);///CTRL+N
menu_item("OPEN_FILE");///Open
menu_hotkey("O", 0, 1, 0);///CTRL+O
menu_submenu("Subsection");
{
//menu_item(...);
}
start_main_menu("COMANDS");
//.....
}

Registering UI elements

Registering menu items.

3D-Coat's menu consists of items referred in menu script using commands menu_item(ElementIdentifier) and other
You need to declare the elements somewhere in code within the __defineui(...){...} . This is typical example of elements declaration

__defineui(My_menu){
ui_comment("My menu");//This command required to print comments into Docs/3D-Coat-work-folder/Temp/MenuItems.txt
ui_element("MyMenuItem",[]{...insert action there...});//the definition of the element and it's action
//other elements definition...
}

Different variants of elements definition

There are several pattens to create menu items

1) Menu item that just does something when pressed

ui_element("MyMenuItem1",[]{...use lambdas...});
ui_element("MyMenuItem2",&MyFunction);
ui_element("MyMenuItem1",&MyClass::MyFunction,ClassPointer,FunctionParamaters);

Be careful! All parameters will be bound one time in the element, so if referred object will be destroyed it will lead to crash.

2) Checkbox menu item

ui_element("MyCheckbox1",[]{});//no action
ui_bool(bool_variable_reference);
ui_element("MyCheckbox2",[]{});//no action
ui_bool([]()->bool{returb myclass()->SomeBoolVar; });

3) Mark last defined element as beta or Pro feature

ui_element("Pro-feature",DoSomethingPro);
ui_element("Beta-feature",DoSomethingBeta);

4) Create nontrivial elements in menu

You may create custom ui elements using ui_create. The second parameter may be skipped.

ui_create("MyAction",[](BaseWidget* Parent){
//create element within the Parent
},[]{
//action to be called when the item activated via hotkey, this is optional
});
See Also
ui_bool, ui_pro, ui_beta,
ui_keys, ui_property, ui_export, ui_group, ui_intethalon, ui_icon

Placement of the toolset scripts

Toolset in the 3D-Coat defined using c++ like script (angelscript). Each room may have own toolset structure. Toolset structure is placed in
"Documents/3D-CoatXXXX/" + app_path_customrooms() + "CustomRooms/room_name/toolset.cpp"
If you want to put the roon into the distributive, place the folder room_name into the
3D-coat data in the repository + app_path_customrooms() + "Default/"
Usually toolset script looks like

void main(){
tools_item("PaintFacture");//Paint
tools_item("EraseFacture");//Erase
tools_item("FillFacture");//Fill
default_tool("PaintFacture");//set default tool for the room
}

Registering toolset items.

There are 3 types of toolset items

1) Tool selection button. It is reffered in script using

tools_item("ItemName");

You need to create ItemName somewhere in code. If your tool is derived from VoxelExtension, your item will be created automatically, yoy may refer it in script like

tools_item("[extension]YourToolID");

Older tool registered using

But probably you will not use it, this style is deprecated. Gradually all tools will be replaced with VoxelExtensions.

See Also
reg_tool_activation, reg_surface_tool, reg_voxel_tool, ui_tool_context

2) Tools section.

Just write in script to define tools section:

tools_section("SectionName");

3) Action button.

It just calls some function. In script:

tools_item("[extension]YourToolID");

To define the action, use reg_tool_button within __defineui(..) routine.

__defineui(mybutton){
reg_tool_button("Button1",[]{...some action...});
reg_tool_button("Button2",&MyClass::Function, class_pointer, function arguments);
}