namespace core::tools overview

Included by: zmodeler.h


core::tools namespace provides several interfaces for dealing with tools. This includes some definitions, structs and base interface for making tools for ZModeler.

Each tool has a layout which is presented by one of interfaces from core::layout namespace. Also, ZModeler provides lots of tools and layout helper classes that you can derieve your classes from.

Types and definitions

TOOL_REQUIRES_* Tool user input requirements bits and some macros to determine whether certain tools could be active at the same time. These values are used by tool's ITool::requires method.
tToolInfo Simple structure for a tools that support multy-tool layout (or implements several tools in one class). Structure includes tool interface pointer and tool ordinal index.


ITool Tool's base interface. Classes that inherit this interface can be exported from library with ZM_CLASS_TOOL class type value set, so ZModeler will create class instance and place tool where it's layout supposes. You can derieve your classes from helper classes and overload tool's apply method which is invoked when user clicks in viewport.
IInteractiveTool An interactive tool extends tool behaviour with methods which are invoked when mouse moves, button is pressed or released. In contrast to ITool interface, interactive tools can implement more complex operations. However, users are not able to assign a hotkey to apply such a tool, this tool can only be selected with hotkey.

Tool activation and application notes

Each tool provides it's user input requirements which include bitwise-or combination of TOOL_REQUIRES_* flags. When user selects a tool, ZModeler verifies whether this tool requirements overlap with currently selected tools, and if overlaps - these tools are removed from selection. Tool's alternativity bit (tool is applied with Alt key held down) is important here too.

When user interacts in viewport, ZModeler invokes currently selected tools' method for according event. For example, when user presses left mouse button, it invokes IInteractiveTool::mouseDown method for a tool that requires left mouse button. Or it invokes ITool::apply when user release left mouse button for a non-interactive tool that requires left mouse button.

See Also:
References overview
namespace core overview