operators.py - Technical Documentation¶
PLACE IMAGE OF operators.py SOURCE CODE IN THE EDITOR HERE
The operators.py
file defines the main operators of DAMTools. Operators are executable actions (such as import, export, align, duplicate, etc.) that can be invoked from the sidebar panel, pie menu, or keyboard shortcuts.
Index¶
- General Purpose
- File Structure
- Key Blocks and Explanation
- Definition of Main Operators
- Integration with Panels and Menus
- Registration of Classes
- Key Code Snippets
- Suggested Images
General Purpose¶
- Defines the main operators (actions) of the DAMTools addon.
- Allows executing actions from the panel, pie menu, or shortcuts.
- Integrates the logic of each tool (import, export, QuickSnap, etc).
File Structure¶
- Definition of main operators: Classes for each action (import, export, align, organize, etc).
- Integration with panels and menus: Methods to invoke operators from the UI.
- Registration of classes: List of operators to register in Blender.
Key Blocks and Explanation¶
Definition of Main Operators¶
class DAMTools_OT_BatchImport(Operator):
bl_idname = "DAMTools.batch_import"
bl_label = "Batch Import"
def execute(self, context):
# Batch import logic
class DAMTools_OT_BatchExport(Operator):
bl_idname = "DAMTools.batch_export"
bl_label = "Batch Export"
def execute(self, context):
# Batch export logic
Integration with Panels and Menus¶
- Allows invoking the operator from the UI.Registration of Classes¶
- List of operators to register in Blender.Key Code Snippets¶
Example of Modal Operator¶
class DAMTools_OT_AlignFloor(Operator):
bl_idname = "DAMTools.align_floor"
bl_label = "Align Floor"
def modal(self, context, event):
# Modal logic for interactive alignment
Example of Simple Operator¶
class DAMTools_OT_JoinNearby(Operator):
bl_idname = "DAMTools.join_nearby"
bl_label = "Join Nearby"
def execute(self, context):
# Logic for joining nearby objects
Suggested Images¶
- PLACE IMAGE OF operators.py SOURCE CODE IN THE EDITOR HERE
- PLACE IMAGE OF AN OPERATOR IN ACTION IN BLENDER
- PLACE DIAGRAM OF A MODAL OPERATOR FLOW
To see the integration with each tool, consult the documentation for the corresponding modules in the [DOCUMENTATION] folder.