cTemplates.Structs module#

Expand for references to cTemplates.Structs

class cTemplate[source]#

Bases: cAction

The base class for all UI elements (Menus, Tools, Sections).
It acts as a recursive container that manages the execution order of UI commands.
Inherits from cPy.cCore.cAction to interface with the C++ engine.
UICmd()[source]#
Generates the command string used by the UI system to trigger this action.
Format: “python:ExecActionByIdx(index)#FunctionName”
RunBeforeList()[source]#
Executes the ‘Before’ hooks and recursively triggers setup for content.
Run(run_before_list=True)[source]#
Main execution logic.
1. Checks if Enabled.
2. Runs pre-requisites (Before list).
3. Validates content availability.
4. Executes the actual Implementation (creating the menu/tool item).
5. Runs post-requisites (After list).
IncludeContent()[source]#
Iterates through the Content list and executes children.
Manages recursion depth/call count to prevent infinite loops or stack overflows.
HasEnabledContent()[source]#
Recursively checks if this element or any of its children are enabled.
d_node(cls_to_decorate)[source]#
Decorator to register a class as a Node in the Node System.
Increments the reference count to keep the class definition alive.

Example

@d_node
class MyCustomNode(cPy.cNodeSystem.BaseNode):
def __init__(self): …
d_class(cls_to_decorate)[source]#
Decorator to register base class types in the core registry.
Similar to d_node but for general classes.
d_slot(func)[source]#
Decorator to register a function as a slot.

Expand for references to cTemplates.Structs.d_slot

d_template(func)[source]#
Decorator to create a template action.
d_child(parent: cTemplate = None)[source]#
Decorator to add a child action to a parent template.
new_tools_section(section_name, n_action: cTemplate)[source]#
Executes the C++ binding to create a new tool section in the UI (Left Panel).
class ToolsSection(section_name=None, parent: cTemplate = None)[source]#

Bases: cTemplate

Class representing a Tool Section (group of tools in the left panel).
d_tools_section(section_name: str, parent: cTemplate = None)[source]#
Decorator to define a Tool Section.

Example (from sculptTools.py):

Tools = cTemplate()

@d_tools_section("Layers", Tools)
def Layers():
    coat.tools_item("[extension]MagnifyLayers") # Magnify SL
    coat.tools_item("[extension]EraseLayers") # Erase SL
new_main_menu(submenu_name, n_action: cTemplate)[source]#
Executes the C++ binding to start a main top-level menu (File, Edit, View…).
class MainMenu(menu_name=None, parent: cTemplate = None)[source]#

Bases: cTemplate

Class representing a top-level Main Menu.
d_main_menu(menu_name: str, parent: cTemplate = None)[source]#
Decorator to define a Main Menu item.

Example (from Addons.py):

@d_main_menu("Addons")
def AddonsMenu():
    coat.menu_item("InstallExtension")
    coat.menu_item("ListAddons")
new_submenu(menu_name, n_action: cTemplate)[source]#
Executes C++ bindings to create a nested submenu.
class Submenu(submenu_name=None, parent: cTemplate = None)[source]#

Bases: cTemplate

Class representing a nested Submenu.
d_submenu(submenu_name: str, parent: cTemplate = None)[source]#
Decorator to define a Submenu.

Example (from File.py):

CreateFileMenu = MainMenu("FILE")

@d_submenu("Export", CreateFileMenu)
def Export():
    coat.menu_item("ExportScene")
    coat.menu_item("ExportSelObject")
new_rmb_menu(n_action: cTemplate)[source]#
Executes C++ bindings to create a Right-Click Context Menu.
class RMBMenu(parent: cTemplate = None)[source]#

Bases: cTemplate

Class representing a Right-Click Context Menu.
d_rmb_menu(func)[source]#
Decorator to define a Right-Click Menu logic.

Example (from voxTreeRmb.py):

@d_rmb_menu
def VoxTreeRmb():
    coat.menu_item("$AutoPick")
    coat.menu_item("EditProcedural")
new_menu_section(n_action: cTemplate)[source]#
Executes C++ bindings to create a menu separator (section).
class MenuSection(parent: cTemplate = None)[source]#

Bases: cTemplate

Class representing a section within a menu (usually separated by a line).
d_menu_section(Menu: cTemplate = None)[source]#
Decorator to define a Menu Section.
Adds a separator before the content defined in the decorated function.

Example (from File.py):

@d_menu_section(CreateFileMenu)
def S_New():
    coat.menu_item("CLEARSCENE") # New
    coat.menu_hotkey("N", 0, 1, 0) # CTRL+N
    coat.menu_item("OPEN_FILE") # Open

Expand for references to cTemplates.Structs.d_menu_section