ui.py - Technical Documentation¶
PLACE IMAGE OF ui.py SOURCE CODE IN THE EDITOR HERE
The ui.py
file defines the sidebar panel (N-Panel) of DAMTools in Blender's 3D Viewport. This panel groups and organizes all the addon's tools, allowing intuitive and visual access to each function, including QuickSnap options and configurable shortcuts.
Index¶
- General Purpose
- File Structure
- Key Blocks and Explanation
- Definition of the Main Panel
- Tool Integration
- QuickSnap Section
- Shortcuts and Preferences
- Registration of Classes
- Key Code Snippets
- Suggested Images
General Purpose¶
- Defines the DAMTools sidebar panel in the 3D Viewport.
- Organizes and groups all addon tools for quick access.
- Allows accessing QuickSnap and configuring shortcuts from the panel.
File Structure¶
- Main panel definition:
DAMTools_PT_MainPanel
class that creates the tab and the general layout. - Tool integration: Adds buttons and sections for each tool (import, export, align, organize, etc.).
- QuickSnap section: Button and options to activate QuickSnap from the panel.
- Shortcuts and preferences: Displays and allows configuring shortcuts from the panel.
- Registration of classes: List of classes to register in Blender.
Key Blocks and Explanation¶
Definition of the Main Panel¶
class DAMTools_PT_MainPanel(Panel):
bl_label = "DAMTools"
bl_idname = "DAMTools_PT_main_panel"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = "DAMTools"
def draw(self, context):
layout = self.layout
# ...
Tool Integration¶
layout.operator("DAMTools.batch_import", text="Batch Import", icon='IMPORT')
layout.operator("DAMTools.batch_export", text="Batch Export", icon='EXPORT')
# ...
QuickSnap Section¶
box_quicksnap = layout.box()
box_quicksnap.label(text="QuickSnap", icon='SNAP_ON')
box_quicksnap.operator("object.quicksnap", text="Activate QuickSnap (Ctrl+Shift+V)")
Shortcuts and Preferences¶
layout.prop(preferences, "hotkey_key_str", text="Pie Menu Shortcut")
layout.operator("DAMTools.capture_hotkey", text="Configure Pie Menu Shortcut")
Registration of Classes¶
- List of classes to register in Blender.Key Code Snippets¶
Sidebar Panel Structure¶
QuickSnap Button on the Panel¶
Suggested Images¶
- PLACE IMAGE OF ui.py SOURCE CODE IN THE EDITOR HERE
- PLACE IMAGE OF THE DAMTools PANEL IN BLENDER'S N-PANEL
- PLACE DIAGRAM OF THE SECTION ORGANIZATION IN THE PANEL
To see the integration with each tool, consult the documentation for the corresponding modules in the [DOCUMENTATION] folder.