# gimelstudio/gimel-studio architecture

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

- Interactive diagram: https://gitdiagram.com/gimelstudio/gimel-studio
- Repository: https://github.com/gimelstudio/gimel-studio

## Overview

##### Project Type and Purpose
- Gimel Studio is a cross-platform, node-based, non-destructive image editor. Its purpose is to let users compose, manipulate, and generate images using a node workflow. The application emphasizes a modular design, allowing for custom scripting of nodes with Python.

##### Analyzing the File Structure
- The project is organized primarily within the "src" directory. Within "src," the GimelStudio package is the central component. It is broken down into multiple subdirectories representing different aspects of the system:
- api – Exposes the Python API for interaction with the core functionality.
- interface – Manages the user-interface components, such as node graph, image viewport, menus, log panels, and utilities (like zoom and file I/O).
- node – Contains fundamental classes defining node behavior, including node models, parameters, sockets, and wires connecting nodes.
- renderer – Handles the evaluation/rendering of the node compositions, including threading and output node integration.
- project, registry, utils – Provide supporting functions such as project file handling, node registration, misc utilities, and exception handling.
- customnodes – Provides a template/example for users to add their own nodes.
- Other aspects of the project include:
- docs – Contains Sphinx documentation for building and developer guides.
- Configuration/Build Files – Files such as Pipfile, requirements.txt, and various scripts for building (Make.bat, setup.cfg) are present to manage dependencies and deployments.

##### Main Components
a. Application Core (Central Engine)
- The main entry point (src/main.py) initializes the application.
- The GimelStudio package is the hub tying together API, node system, interface, and backend processing.

b. Node System and Processing Pipeline
- CustomNodes: Show extensibility points for users to script custom operations.

c. User Interface Layer
- Interface Modules: Visual components like the Node Graph (node_graph.py), property panels, file I/O, image viewport (image_viewport.py), and menu components.
- Developer utilities: For debugging and logging (developer_log.py, dark_menu_renderer.py).

d. Rendering and Data Management
- Renderer: Illustrate how the node graph is evaluated rendering the image (renderer folder).
- File Support and Project I/O: Show modules that handle saving/loading (file_support.py and project/io.py).

e. External Components and Integration
- External APIs and Add-ons: Indicate how the system integrates with external tools like Blender (via a separate addon repository).
- Configuration and Build Tools: How the project uses Pipfile, requirements.txt, and Make scripts for environment and build management.

##### Relationships and Interactions
- How the User Interface sends commands to the Application Core.
- Trace the data flow: UI actions trigger node manipulations; the Node Registry manages node lifecycle; the Renderer processes the node graph and produces image output; File Support enables saving/loading projects and assets.

##### Architectural Patterns
- The design follows a modular pattern:
- Separation of Concerns: Dividing the application into distinct subsystems (UI, node processing, rendering, I/O).
- Extensibility: Emphasize the architecture’s openness to custom node scripting via API exposure.
- Event-Driven and Non-Destructive Workflows: The application appears to use an event-driven model for real-time node graph updates simulating a pipeline approach (similar to what is used in Blender).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Entities
    User["User"]:::external

    %% User Interface Layer
    subgraph "User Interface Layer"
        UI_NG["Node Graph"]:::ui
        UI_FIO["File I/O"]:::ui
        UI_IV["Image Viewport"]:::ui
        UI_DL["Developer Log"]:::ui
        UI_DMR["Dark Menu Renderer"]:::ui
    end

    %% Application Core
    subgraph "Application Core"
        AC_ME["Main Entry Point"]:::core
        AC_App["Core Application Package"]:::core
    end

    %% Node System and Processing Pipeline
    subgraph "Node System and Processing Pipeline"
        NS_BC["Built-in (Core) Nodes"]:::nodes
        NS_CN["Custom Nodes Extensibility"]:::nodes
        NS_NDM["Node Definitions & Models"]:::nodes
        NS_NR["Node Registration"]:::nodes
    end

    %% Rendering and Data Management
    subgraph "Rendering and Data Management"
        RAD_RE["Rendering Engine"]:::render
        RAD_DF["Data Files (Icons/Splash)"]:::render
        RAD_FS["File Support"]:::render
        RAD_PIO["Project I/O"]:::render
    end

    %% External Components and Integration
    subgraph "External Components and Integration"
        EX_BI["Blender Integration"]:::external
        EX_CONF["Configuration & Build Tools"]:::external
    end

    %% Connections - User interactions to UI
    User -->|"interacts"| UI_NG
    User -->|"interacts"| UI_FIO
    User -->|"interacts"| UI_IV

    %% UI to Application Core
    UI_NG -->|"commands"| AC_ME
    UI_FIO -->|"commands"| AC_ME
    UI_IV -->|"updates"| AC_ME

    %% Application Core to Node System and File Management
    AC_ME -->|"initializes"| NS_BC
    AC_App -->|"configures"| NS_NDM
    AC_ME -->|"handles"| RAD_FS
    AC_ME -->|"handles"| RAD_PIO

    %% Node System interactions
    NS_NDM -->|"registers"| NS_NR
    NS_BC -->|"processes"| RAD_RE
    NS_CN -->|"processes"| RAD_RE

    %% Rendering feedback loop
    RAD_RE -->|"renders"| UI_IV
    UI_FIO -->|"saves/loads"| RAD_FS
    UI_FIO -->|"saves/loads"| RAD_PIO

    %% External Integration
    EX_BI -->|"feeds into"| NS_BC
    EX_CONF -->|"configures"| AC_App

    %% Styles
    classDef ui fill:#8BC34A,stroke:#333,stroke-width:2px;
    classDef core fill:#2196F3,stroke:#333,stroke-width:2px;
    classDef nodes fill:#FF9800,stroke:#333,stroke-width:2px;
    classDef render fill:#9C27B0,stroke:#333,stroke-width:2px;
    classDef external fill:#607D8B,stroke:#333,stroke-width:2px;

    %% Click Events
    click AC_ME "https://github.com/gimelstudio/gimel-studio/blob/master/src/main.py"
    click AC_App "https://github.com/gimelstudio/gimel-studio/tree/master/src/GimelStudio"
    click NS_BC "https://github.com/gimelstudio/gimel-studio/tree/master/src/GimelStudio/corenodes"
    click NS_CN "https://github.com/gimelstudio/gimel-studio/tree/master/src/customnodes"
    click NS_NDM "https://github.com/gimelstudio/gimel-studio/tree/master/src/GimelStudio/node"
    click NS_NR "https://github.com/gimelstudio/gimel-studio/blob/master/src/GimelStudio/registry/node_registry.py"
    click UI_NG "https://github.com/gimelstudio/gimel-studio/blob/master/src/GimelStudio/interface/node_graph.py"
    click UI_FIO "https://github.com/gimelstudio/gimel-studio/blob/master/src/GimelStudio/interface/file_io.py"
    click UI_IV "https://github.com/gimelstudio/gimel-studio/blob/master/src/GimelStudio/interface/image_viewport.py"
    click UI_DL "https://github.com/gimelstudio/gimel-studio/blob/master/src/GimelStudio/interface/developer_log.py"
    click UI_DMR "https://github.com/gimelstudio/gimel-studio/blob/master/src/GimelStudio/interface/dark_menu_renderer.py"
    click RAD_RE "https://github.com/gimelstudio/gimel-studio/tree/master/src/GimelStudio/renderer"
    click RAD_DF "https://github.com/gimelstudio/gimel-studio/tree/master/src/GimelStudio/datafiles"
    click RAD_FS "https://github.com/gimelstudio/gimel-studio/blob/master/src/GimelStudio/file_support.py"
    click RAD_PIO "https://github.com/gimelstudio/gimel-studio/blob/master/src/GimelStudio/project/io.py"
    click EX_BI "https://github.com/gimelstudio/gimel-studio/blob/master/src/GimelStudio/corenodes/input/from_blender_node.py"
```
