# trevisangmw/gt-tools architecture

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

- Interactive diagram: https://gitdiagram.com/trevisangmw/gt-tools
- Repository: https://github.com/trevisangmw/gt-tools
- Video tour (about a minute): https://gitdiagram.com/trevisangmw/gt-tools/video

## Overview

##### Main Components
- Core Engine (gt/core): This is the backbone of GT Tools. It contains fundamental operations for tasks like animation (anim.py), camera management, rigging, data management (including a large collection of curve and mesh data), and various utility functions. It is where the “business logic” of the tools resides.
- User Interface (gt/ui): This module contains the UI components such as file dialogs, progress bars, custom widgets, and Qt utilities. It provides the graphical front-end for interacting with the tools inside Maya.
- Utilities (gt/utils): A set of standalone helper functions (e.g. network request, system info) that are used across various tools.
- Tests (gt/tests): A comprehensive test suite that includes tests for core functionalities, UI interactions, and individual tools. This ensures that the components work as expected and can be updated safely.
- Setup/Installation: Files such as setup_drag_drop_maya.py and related configuration scripts that manage installation, uninstallation, and “run only” operations by integrating the package with Maya’s environment.

##### Relationships and Interactions
- The Setup Module interacts with Maya directly by being drag-and-dropped onto the Maya viewport. It is responsible for installing/uninstalling or temporarily loading the entire GT Tools package.
- The auto-loaded menu (triggered via the installation process) acts as a hub for the user to access the various tools. From this menu, users can launch the different tools.
- Tools within the gt/tools directory use functions from gt/core to perform tasks (e.g., rigging functions, joint manipulation, curve creation) and display results through the UI components.
- The UI (gt/ui) serves as an intermediary for user commands which then call the underlying controller logic in the individual tools.
- The utility functions in gt/utils are used both by the core and the tools to perform generic tasks like network requests, system checks, or file handling.
- The tests modules interact (in a simulated way) with nearly all components to validate their correctness. They are an important part of the architecture that ensures long-term maintainability.

##### Architectural Patterns and Design Principles
- Modular Design: Components are clearly segregated into core functionalities, tools, UI, and utilities, making each relatively independent and reusable.
- MVC/MVVM (or similar): Several tool directories include controllers, models, and views (e.g., in auto-rigger and curve_library), suggesting that many tools adhere to a Model-View-Controller structure, which separates business logic from UI logic.
- Plugin/Extension Architecture: Given the presence of many separate tool directories under gt/tools, the system is designed to be extensible; new tools can be added with little impact on existing code.
- Testing and Isolation: The presence of numerous unit tests for core, UI, and tool-specific functions indicates a strong emphasis on reliability and maintainability.

##### Relevant Technologies
- Python scripting (Python modules and packages) is the core language for the repository.
- Autodesk Maya as the host environment, with scripts designed to be loaded and executed inside Maya.
- Qt (via the gt/ui module) for building custom user interfaces within the Maya environment.
- Use of file-based “data” resources such as curves (in .crv format) and meshes (in .obj format) that the tools manipulate within Maya.

##### Elements
- Clear labels:
- Core Engine (gt/core)
- UI Layer (gt/ui)
- Utilities (gt/utils)
- Test Suite (gt/tests)
- Setup/Install Scripts (setup_drag_drop_maya.py and related files)
- From the Setup module to Maya integration.
- From each tool to the core and UI components.
- From UI to Tools (e.g., commands from the Maya menu triggering tool actions).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Maya Environment
    Maya["Maya Host"]:::external

    %% Setup Module
    Setup["Setup Module (setup_drag_drop_maya.py)"]:::setup

    %% GT Tools Package Subgraph
    subgraph "GT Tools Package"
        direction TB
        Core["Core Engine (gt/core)"]:::core
        Tools["Tools (gt/tools)"]:::tools
        UI["User Interface (gt/ui)"]:::ui
        Utils["Utilities (gt/utils)"]:::utils
    end

    %% Test Suite outside main GT Tools Package
    Tests["Test Suite (gt/tests)"]:::tests

    %% Relationships
    Maya -->|"installs"| Setup
    Setup -->|"launches_menu"| UI
    UI -->|"triggers_tool_commands"| Tools
    Tools -->|"utilizes"| Core
    Tools -->|"displays_output"| UI
    Core -->|"calls_helpers"| Utils
    Tools -->|"calls_helpers"| Utils
    UI -->|"calls_helpers"| Utils
    Tools -->|"affects_scene"| Maya
    Tests -->|"tests"| Core
    Tests -->|"tests"| Tools
    Tests -->|"tests"| UI
    Tests -->|"tests"| Utils

    %% Click Events
    click Core "https://github.com/trevisangmw/gt-tools/tree/release/gt/core"
    click Tools "https://github.com/trevisangmw/gt-tools/tree/release/gt/tools"
    click UI "https://github.com/trevisangmw/gt-tools/tree/release/gt/ui"
    click Utils "https://github.com/trevisangmw/gt-tools/tree/release/gt/utils"
    click Tests "https://github.com/trevisangmw/gt-tools/tree/release/gt/tests"
    click Setup "https://github.com/trevisangmw/gt-tools/blob/release/setup_drag_drop_maya.py"

    %% Styles
    classDef external fill:#f9d6ff,stroke:#333,stroke-width:2px;
    classDef setup fill:#ffec99,stroke:#333,stroke-width:2px;
    classDef core fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef tools fill:#d4f1c5,stroke:#333,stroke-width:2px;
    classDef ui fill:#ffdd99,stroke:#333,stroke-width:2px;
    classDef utils fill:#ffd6cc,stroke:#333,stroke-width:2px;
    classDef tests fill:#cceeff,stroke:#333,stroke-width:2px;
```
