menu.py - Technical Documentation¶
PLACE IMAGE OF menu.py SOURCE CODE IN THE EDITOR HERE
The menu.py
file defines the main Pie Menu of DAMTools, allowing quick access to all the addon's tools from a radial menu (pie menu) invokable with Shift+W (or the configured shortcut). It also includes submenus and auxiliary operators for import and organization options.
Index¶
- General Purpose
- File Structure
- Key Blocks and Explanation
- Colors and Utilities
- Import Options Operator
- Definition of the Main Pie Menu
- Arrange X (Alt) Submenu
- Registration of Classes
- Key Code Snippets
- Suggested Images
General Purpose¶
- Defines the main pie menu of DAMTools and its submenus.
- Allows quick access to all tools from the 3D Viewport.
- Integrates auxiliary operators for advanced options.
File Structure¶
- Colors: Dictionary of colors for visual customization (optional).
- Import options operator: Allows displaying an options dialog before importing.
- Main Pie Menu:
BATCHTOOLS_MT_MainMenu
class with the radial structure and buttons. - Arrange X (Alt) Submenu: Allows choosing between normal Arrange X and Arrange X with rotation reset.
- Registration of classes: List of classes to register in Blender.
Key Blocks and Explanation¶
Colors and Utilities¶
- Dictionary of colors for visual customization (not essential for the menu).Import Options Operator¶
class DAMTools_MT_ImportOptions(Operator):
bl_idname = "DAMTools.import_options"
...
def draw(self, context):
# Draws import options in a dialog
Definition of the Main Pie Menu¶
class BATCHTOOLS_MT_MainMenu(Menu):
bl_idname = "BATCHTOOLS_MT_main_menu"
bl_label = "DAMTools"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
# Quadrant structure and buttons
Arrange X (Alt) Submenu¶
class BATCHTOOLS_MT_arrange_x_alt_menu(Menu):
bl_idname = "BATCHTOOLS_MT_arrange_x_alt_menu"
...
def draw(self, context):
# Allows choosing between normal arrange and arrange+rotation reset
Registration of Classes¶
- List of classes to register in Blender.Key Code Snippets¶
Pie Menu Structure¶
class BATCHTOOLS_MT_MainMenu(Menu):
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
# ...
QuickSnap Button in the Pie Menu¶
col_quicksnap_pie.operator("object.quicksnap", text="Activate QuickSnap (Ctrl+Shift+V)", icon='SNAP_ON')
Suggested Images¶
- PLACE IMAGE OF menu.py SOURCE CODE IN THE EDITOR HERE
- PLACE IMAGE OF THE OPEN PIE MENU IN BLENDER
- PLACE DIAGRAM OF THE RADIAL MENU STRUCTURE
To see the integration with each tool, consult the documentation for the corresponding modules in the [DOCUMENTATION] folder.