# poly-hammer/blendertools architecture

> Architecture diagram of the GitHub repository poly-hammer/blendertools, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/poly-hammer/blendertools
- Repository: https://github.com/poly-hammer/blendertools

## Overview

- “Send to Unreal” – a one‐click solution for sending assets from Blender to Unreal Engine.
- “UE to Rigify” – a node‑based retargeting system that facilitates working with Blender’s Rigify addon to adapt and animate assets from Unreal Engine.

##### Main Components
- Blender Addon Modules: There are two distinct modules (send2ue and ue2rigify) nested under the “src/addons/” directory. Each module contains several subcomponents:
– Core Functionality: Found in directories like “core” (export, ingest, nodes, scene, templates, utilities, etc.).
– Dependencies & RPC Communication: Both addons include “dependencies” directories that manage remote execution between Blender and Unreal. For example, they implement RPC clients, servers, and exception handling.
– UI Components: Modules have “ui” subdirectories for Blender integration (dialogs, panels, file browsers, header menus, etc.).
– Settings & Properties: Manage addon configuration and user preferences.
– Resources & Templates: Located in “resources” and “setting_templates” folders, which store default configurations, rig templates, and extension code.

- Documentation & Tests:
– The “docs” directory holds extensive user and technical documentation for development, testing, and integration.
– The “tests” folder contains unit tests and sample files to ensure correct behavior across Blender and Unreal integrations.

- Supporting Infrastructure:
– Scripts in the “scripts” folder for addon watching, packaging, and release automation.
– Configuration files like .env.example, mkdocs.yml, and CI/CD workflows under “.github/workflows” that emphasize automated testing and documentation building.

##### Relationships and Interactions
- Within Blender: The addons integrate directly with Blender’s API (operators, properties, UI panels) to provide one-click asset export/import and node-based retargeting of animations.
- RPC Communication: The “dependencies/rpc” modules in both addons encapsulate client–server relationships for remote execution, handling operations such as sending FBX data and communicating with Unreal Engine.

##### Architectural Patterns and Design Principles
- Modularity: Clear separation between the two addons and between components within each addon (core, UI, dependencies, settings, and resources).
- Separation of Concerns: For example, UI concerns are handled in the “ui” directories, while processing and export logic is encapsulated in “core” and “io” modules.
- Extensibility: The “extensions” and “resources/extensions” directories are designed to allow additional functionality without altering the core code.
- Testing & Continuous Integration: Presence of CI workflows and comprehensive tests indicates an architecture that values reliability and maintainability.

##### Final Advice for the Principal Software Engineer
- Be precise in indicating external communication points (e.g., RPC servers/clients) and emphasize the modular separation that allows for extensibility.
- Annotations if necessary to explain key interactions—for example, the remote execution pattern used between Blender and Unreal.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% External Components
    Blender("Blender"):::external
    Unreal("Unreal Engine"):::external

    %% Send to Unreal Addon Module
    subgraph "Send to Unreal Addon"
        STU_Entry("Send2UE Entry & Config"):::addonEntry
        STU_UI("Send2UE UI"):::addonUI
        STU_Core("Send2UE Core"):::addonCore
        STU_RPC("Send2UE Dependencies & RPC"):::addonRPC
        STU_Res("Send2UE Resources & Templates"):::addonRes
    end

    %% UE to Rigify Addon Module
    subgraph "UE to Rigify Addon"
        UR_Entry("UE2Rigify Entry & Config"):::addonEntry
        UR_UI("UE2Rigify UI"):::addonUI
        UR_Core("UE2Rigify Core"):::addonCore
        UR_Settings("UE2Rigify Settings & Properties"):::settings
        UR_Res("UE2Rigify Resources & Templates"):::addonRes
    end

    %% Supporting Components
    Docs("Documentation"):::docs
    Tests("Testing Suite"):::tests
    Infra("Automation & CI/CD"):::scripts

    %% Data Flow for Send to Unreal Addon
    Blender -->|"triggers"| STU_UI
    STU_UI -->|"invokes"| STU_Core
    STU_Entry -->|"configures"| STU_Core
    STU_Res -->|"supplies defaults to"| STU_Core
    STU_Core -->|"communicates via RPC"| STU_RPC
    STU_RPC -->|"sends asset data to"| Unreal

    %% Data Flow for UE to Rigify Addon
    Blender -->|"triggers"| UR_UI
    UR_UI -->|"invokes"| UR_Core
    UR_Entry -->|"configures"| UR_Core
    UR_Settings -->|"supplies settings to"| UR_Core
    UR_Res -->|"provides templates to"| UR_Core
    UR_Core -->|"exchanges data with"| Unreal

    %% Supporting Infrastructure Connections (dotted lines)
    Docs ---|"guides & docs support"| STU_Core
    Docs ---|"guides & docs support"| UR_Core
    Tests ---|"verifies functionality"| STU_Core
    Tests ---|"verifies functionality"| UR_Core
    Infra ---|"automation & packaging"| STU_Core
    Infra ---|"automation & packaging"| UR_Core

    %% Click Events for Send to Unreal Addon Module
    click STU_Core "https://github.com/poly-hammer/blendertools/tree/main/src/addons/send2ue/core"
    click STU_RPC "https://github.com/poly-hammer/blendertools/tree/main/src/addons/send2ue/dependencies"
    click STU_UI "https://github.com/poly-hammer/blendertools/tree/main/src/addons/send2ue/ui"
    click STU_Res "https://github.com/poly-hammer/blendertools/tree/main/src/addons/send2ue/resources"
    click STU_Entry "https://github.com/poly-hammer/blendertools/blob/main/src/addons/send2ue/__init__.py"

    %% Click Events for UE to Rigify Addon Module
    click UR_Core "https://github.com/poly-hammer/blendertools/tree/main/src/addons/ue2rigify/core"
    click UR_UI "https://github.com/poly-hammer/blendertools/tree/main/src/addons/ue2rigify/ui"
    click UR_Res "https://github.com/poly-hammer/blendertools/tree/main/src/addons/ue2rigify/resources"
    click UR_Settings "https://github.com/poly-hammer/blendertools/tree/main/src/addons/ue2rigify/settings"
    click UR_Entry "https://github.com/poly-hammer/blendertools/blob/main/src/addons/ue2rigify/__init__.py"

    %% Click Events for Supporting Files
    click Docs "https://github.com/poly-hammer/blendertools/tree/main/docs/"
    click Tests "https://github.com/poly-hammer/blendertools/tree/main/tests/"
    click Infra "https://github.com/poly-hammer/blendertools/tree/main/scripts/"

    %% Class Styles
    classDef addonCore fill:#f9c74f,stroke:#f9844a,stroke-width:2px;
    classDef addonUI fill:#90be6d,stroke:#43aa8b,stroke-width:2px;
    classDef addonRPC fill:#f3722c,stroke:#f94144,stroke-width:2px;
    classDef addonRes fill:#577590,stroke:#277da1,stroke-width:2px;
    classDef addonEntry fill:#bdb2ff,stroke:#9d4edd,stroke-width:2px;
    classDef docs fill:#ffd166,stroke:#ef476f,stroke-width:2px;
    classDef tests fill:#06d6a0,stroke:#1b9aaa,stroke-width:2px;
    classDef scripts fill:#efefef,stroke:#ccc,stroke-width:2px;
    classDef external fill:#f9f871,stroke:#f72585,stroke-width:2px;
    classDef settings fill:#f0a6ca,stroke:#ff77aa,stroke-width:2px;
```
