# aspirata/miblend architecture

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

- Interactive diagram: https://gitdiagram.com/aspirata/miblend
- Repository: https://github.com/aspirata/miblend

## Overview

##### Project type and purpose
- MiBlend is a Blender addon (Python–based plugin) for creating and exporting Minecraft assets (nodes, rigs, materials, resource packs) directly from Blender.
- It bundles Blender UI panels, operators, asset-loading modules, export logic, resource-pack management, build scripts, continuous integration, and documentation.

##### File structure
- Top‐level:
- `.github/workflows`: CI build & packaging
- `bpy-build.yaml`, `build_for_release.bat`, `scripts/`: packaging and release scripts
- `MiBlend_Source/`: core addon code subdivided into modules—Assets, Materials, Scripts, Rigs, Optimization, UI, Operators, API, Data, Preferences, Properties, Utils
- `MiBlend_Source/Resource Packs`: directories of JSON/model/texture assets
- `docs/`: documentation source (MDX) for site generation
- `Debug/`, `.blend` files: test assets
- Patterns: clear modular breakdown (UI vs business logic vs assets vs export), Python package structure, Blender API integration via `__init__.py`, build pipeline declarations.

##### README insights
- Describes MiBlend as beta, links to Wiki, contributors, and video demo.
- Emphasizes community contributions in rigging, coding, resource packs.

##### Main components & interactions
a. Components
1. Blender Host (bpy)
2. MiBlend Addon Code
- UI Layer (UI.py, panels in docs)
- Operators Layer (Operators.py)
- API Layer (MIB_API.py, Data.py, Properties.py, Preferences.py)
- Asset Modules (Assets.py + subfolders for Nodes, Rigs, Scripts)
- Materials Module (Materials.py + .blend presets)
- Optimization Module
- Utils (translation, solvers)
3. Resource Pack Generator
4. Build & Release Pipeline (CI workflows, build scripts)
5. Documentation Site Generator (docs/ + docs.json)
6. External Services
- GitHub (source, CI/CD)
- Docs host (docs.page)
- Discord/YouTube (community links)
b. Relationships & Data Flow
1. User → Blender UI Panel → triggers Operators
2. Operators call API Layer (MIB_API, Data, Properties)
3. API Layer interacts with Asset Modules and Materials Module to assemble .blend nodes, rigs, scripts
4. API Layer invokes Resource Pack Generator → writes JSON, textures, models into `Resource Packs` structure
5. On demand, build scripts package the addon into `.zip` and resource packs for release
6. CI (GitHub Actions) orchestrates build & publish
7. Documentation source → site generator → published to docs.page
c. Architectural patterns
- Modular separation (UI, Business Logic, Data, Assets)
- Plugin architecture conforming to Blender’s addon API (registration of panels, operators, preferences)
- Asset-centric pipeline (scan directories, load JSON/.blend, register in UI)
- CI/CD for automated builds and doc deployment
d. Key technologies
- Python 3.x, Blender’s `bpy` API
- JSON asset definitions
- GitHub Actions for CI/CD
- MDX-based documentation site (docs.page)

##### Elements
- Clear component labels (e.g., “UI Panel”, “Operators”, “MIB_API”)
- Blue for Blender addon runtime modules
- Green for asset/data directories
- Orange for build/CI processes
- Grey for external services

##### Detailed breakdown recommendation
- Related Python modules together and label their responsibilities
- How the Asset Modules folder maps to “Asset Loader” component
- Two outputs:
- `.blend` files rendered or configured in Blender
- Resource Pack directory structure for Minecraft
- CI/CD flow: commit → GitHub Actions → build addon & docs → GitHub Releases & docs.page

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User interaction
    User["User"]:::ext
    Blender["Blender Host (bpy)"]:::runtime
    User -->|"interacts with"| Blender

    %% Addon code
    subgraph "MiBlend Addon Code" 
        direction TB
        Init["Addon Registration\n(__init__.py)"]:::runtime
        UI["UI Layer"]:::runtime
        Ops["Operators Layer"]:::runtime
        API["API Layer"]:::runtime
        Assets["Asset Loader"]:::data
        Materials["Materials Module"]:::data
        Opt["Optimization Module"]:::data
        Utils["Utils"]:::data
        RPGen["Resource Pack Generator"]:::data
    end

    Blender -->|"loads addon"| Init
    Init --> UI
    UI -->|"triggers"| Ops
    Ops -->|"calls"| API
    API -->|"uses"| Assets
    API -->|"uses"| Materials
    API -->|"uses"| Opt
    API -->|"uses"| Utils
    Assets -->|"loads assets"| API
    Materials -->|"loads materials"| API
    Opt -->|"optimizes assets"| API
    Utils -->|"helper functions"| API
    API -->|"generates packs"| RPGen

    %% Outputs
    RPGen -->|"writes to"| ResourcePacks["Resource Packs\n(directory)"]:::data
    RPGen -->|"writes packs_info.json"| PacksInfo["packs_info.json"]:::data

    %% Build & CI
    subgraph "Build & Release Pipeline" 
        direction TB
        CI["GitHub Actions"]:::ci
        Scripts["Build Scripts"]:::ci
        CI -->|"runs"| Scripts
        Scripts -->|"packages addon"| AddonZip[".zip Release"]:::ci
        Scripts -->|"packages packs"| PacksZip["Resource Pack Release"]:::ci
    end
    CI -->|"on commit"| Init
    RPGen -->|"artifact"| CI

    %% Documentation
    subgraph "Docs Generation" 
        direction TB
        DocsSrc["docs/ + docs.json"]:::ci
        DocsGen["Site Generator"]:::ci
        DocsSrc --> DocsGen
        DocsGen -->|"deploy to"| DocsHost["docs.page"]:::ext
    end

    CI -->|"build docs"| DocsGen

    %% External Services
    GitHub["GitHub"]:::ext
    Discord["Discord/YouTube"]:::ext
    GitHub --> CI
    User --> Discord

    %% Click events
    click Init "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/__init__.py"
    click UI "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/UI.py"
    click Ops "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Operators.py"
    click API "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/MIB_API.py"
    click API "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Data.py"
    click API "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Properties.py"
    click API "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Preferences.py"
    click Assets "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Assets.py"
    click Assets "https://github.com/aspirata/miblend/tree/Stable-Legacy-Addon/MiBlend_Source/Assets/"
    click Materials "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Materials/Materials.py"
    click Materials "https://github.com/aspirata/miblend/tree/Stable-Legacy-Addon/MiBlend_Source/Materials/"
    click Opt "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Optimization/Optimize.py"
    click Opt "https://github.com/aspirata/miblend/tree/Stable-Legacy-Addon/MiBlend_Source/Optimization/"
    click Utils "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Utils/AS_Solutions.py"
    click Utils "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Utils/Absolute_Solver.py"
    click Utils "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Utils/Translator.py"
    click Utils "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Utils/absolute_solver_list.json"
    click Utils "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Utils/languages/en_US.json"
    click Utils "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Utils/languages/ru_RU.json"
    click Utils "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Utils_tools.py"
    click RPGen "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Resource_Packs.py"
    click ResourcePacks "https://github.com/aspirata/miblend/tree/Stable-Legacy-Addon/MiBlend_Source/Resource Packs/"
    click PacksInfo "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/MiBlend_Source/Resource Packs/packs_info.json"
    click CI "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/.github/workflows/Addon Build.yaml"
    click Scripts "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/bpy-build.yaml"
    click Scripts "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/build_for_release.bat"
    click Scripts "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/build_with_bab.bat"
    click Scripts "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/scripts/build_for_release.py"
    click Scripts "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/scripts/build_universal.py"
    click DocsSrc "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/docs.json"
    click DocsSrc "https://github.com/aspirata/miblend/tree/Stable-Legacy-Addon/docs/"
    click DocsSrc "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/docs/index.mdx"
    click GitHub "https://github.com/aspirata/miblend/blob/Stable-Legacy-Addon/.github/workflows/Addon Build.yaml"

    %% Styles
    classDef runtime fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef data fill:#d4edda,stroke:#333,stroke-width:1px
    classDef ci fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef ext fill:#e2e3e5,stroke:#333,stroke-width:1px
```
