Skip to content

properties.py - Technical Documentation

PLACE IMAGE OF properties.py SOURCE CODE IN THE EDITOR HERE

The properties.py file defines the global and specific properties used by DAMTools. These properties allow storing configurations, options, and states that are shared among the addon's operators, panels, and menus.

---\n

Index


General Purpose

  • Defines global and specific properties for DAMTools' functionality.
  • Allows storing persistent configurations and temporary states.
  • Facilitates communication between operators, panels, and menus.

File Structure

  1. Definition of global properties: Properties added to Scene, Object, or WindowManager.
  2. Tool-specific properties: Options and states for each tool (import, export, QuickSnap, etc.).
  3. Property registration: Functions to register and unregister properties when the addon is enabled/disabled.

Key Blocks and Explanation

Definition of Global Properties

bpy.types.Scene.DAMTools_batch_import_path = StringProperty(
    name="Import Path",
    description="Path for batch importing files",
    subtype='DIR_PATH',
)
- Defines a global property for the batch import path.

Tool-Specific Properties

bpy.types.Scene.DAMTools_quicksnap_enabled = BoolProperty(
    name="QuickSnap Enabled",
    description="Indicates if QuickSnap is active",
    default=False,
)
- Boolean property to control QuickSnap's state.

Property Registration

def register():
    # Adds properties to bpy.types.Scene, Object, etc.
def unregister():
    # Removes properties when the addon is disabled
- Standard functions for the property lifecycle.


Key Code Snippets

Example of String Property

bpy.types.Scene.DAMTools_batch_export_path = StringProperty(
    name="Export Path",
    description="Path for batch exporting files",
    subtype='DIR_PATH',
)

Example of Bool Property

bpy.types.Scene.DAMTools_align_floor_enabled = BoolProperty(
    name="Align Floor Enabled",
    description="Activates the floor alignment tool",
    default=False,
)

Suggested Images

  • PLACE IMAGE OF properties.py SOURCE CODE IN THE EDITOR HERE
  • PLACE IMAGE OF PROPERTIES IN BLENDER'S SCENE PANEL
  • PLACE DIAGRAM SHOWING THE RELATIONSHIP BETWEEN PROPERTIES AND OPERATORS

To see the integration with each tool, consult the documentation for the corresponding modules in the [DOCUMENTATION] folder.