# Developer Guide: Codebase Structure This document outlines the key files and directories within the Asset Processor Tool project. ``` Asset_processor_tool/ ├── asset_processor.py # Older core class, kept for reference (not used in main flow) ├── config.py # Core settings, constants, and allowed types ├── configuration.py # Class for loading and accessing configuration (merges config.py and presets) ├── detailed_documentation_plan.md # (Existing file, potentially outdated) ├── Dockerfile # Instructions for building the Docker container image ├── documentation_plan.md # Plan for the new documentation structure (this plan) ├── documentation.txt # Original developer documentation (to be migrated) ├── main.py # CLI Entry Point & processing orchestrator (calls processing_engine) ├── monitor.py # Directory monitoring script for automated processing ├── processing_engine.py # New core class handling single asset processing based on SourceRule ├── readme.md # Original main documentation file (to be migrated) ├── readme.md.bak # Backup of readme.md ├── requirements-docker.txt # Dependencies specifically for the Docker environment ├── requirements.txt # Python package dependencies for standard execution ├── rule_structure.py # Dataclasses for hierarchical rules (SourceRule, AssetRule, FileRule) ├── blenderscripts/ # Scripts for integration with Blender │ ├── create_materials.py # Script to create materials linking to node groups │ └── create_nodegroups.py # Script to create node groups from processed assets ├── Deprecated-POC/ # Directory containing original proof of concept scripts │ ├── Blender-MaterialsFromNodegroups.py │ ├── Blender-NodegroupsFromPBRSETS.py │ └── Standalonebatcher-Main.py ├── Documentation/ # New directory for organized documentation (this structure) │ ├── 00_Overview.md │ ├── 01_User_Guide/ │ └── 02_Developer_Guide/ ├── gui/ # Contains files related to the Graphical User Interface │ ├── delegates.py # Custom delegates for inline editing in Unified View │ ├── main_window.py # Main GUI application window and layout │ ├── processing_handler.py # Handles background processing logic for the GUI │ ├── prediction_handler.py # Generates initial SourceRule hierarchy with predictions │ ├── unified_view_model.py # Model for the Unified Hierarchical View │ └── ... # Other GUI components ├── Presets/ # Preset definition files │ ├── _template.json # Template for creating new presets │ ├── Poliigon.json # Example preset for Poliigon assets │ └── ... # Other presets ├── Project Notes/ # Directory for issue and feature tracking (Markdown files) │ ├── ... # Various planning and note files └── Testfiles/ # Directory containing example input assets for testing └── ... # Example asset ZIPs ``` **Key Files and Directories:** * `asset_processor.py`: Contains the older `AssetProcessor` class. It is kept for reference but is no longer used in the main processing flow orchestrated by `main.py` or the GUI. * `config.py`: Stores global default settings, constants, core rules, and centralized lists of `ALLOWED_ASSET_TYPES` and `ALLOWED_FILE_TYPES` used for validation and GUI dropdowns. * `configuration.py`: Defines the `Configuration` class. Responsible for loading core settings from `config.py` and merging them with a specified preset JSON file (`Presets/*.json`). Pre-compiles regex patterns from presets for efficiency. An instance of this class is passed to the `ProcessingEngine`. * `rule_structure.py`: Defines the `SourceRule`, `AssetRule`, and `FileRule` dataclasses. These structures represent the hierarchical processing rules and are the primary data contract passed from the GUI/prediction layer to the processing engine. * `processing_engine.py`: Defines the new `ProcessingEngine` class. This is the core component that executes the processing pipeline for a single asset based *solely* on a provided `SourceRule` object and the static `Configuration`. It contains no internal prediction or fallback logic. * `main.py`: Entry point for the Command-Line Interface (CLI). It handles argument parsing, logging setup, parallel processing orchestration (using `concurrent.futures.ProcessPoolExecutor`), and triggering Blender scripts. It now orchestrates processing by generating or receiving `SourceRule` objects and passing them to the `ProcessingEngine`. * `monitor.py`: Implements the automated directory monitoring feature using the `watchdog` library. Contains the `ZipHandler` class to detect new ZIP files and trigger processing via `main.run_processing`. * `gui/`: Directory containing all code related to the Graphical User Interface (GUI), built with PySide6. The GUI is responsible for managing user input, generating and editing the `SourceRule` hierarchy, and interacting with background handlers. * `main_window.py`: Defines the `MainWindow` class, the main application window structure, UI layout, event handling, and menu setup. Integrates the Unified Hierarchical View. Manages GUI-specific logging (`QtLogHandler`). * `unified_view_model.py`: Implements the `QAbstractItemModel` for the Unified Hierarchical View (`QTreeView`). It holds the `SourceRule` hierarchy and provides data and flags for display and inline editing. * `delegates.py`: Contains custom `QStyledItemDelegate` implementations (e.g., for `QComboBox`, `QLineEdit`) used by the Unified View to provide inline editors for rule attributes. * `processing_handler.py`: Defines the `ProcessingHandler` class (runs on a `QThread`). Manages the execution of the `ProcessingEngine` in background processes and communicates status/results back to the GUI. * `prediction_handler.py`: Defines the `PredictionHandler` class (runs on a `QThread`). Generates the initial `SourceRule` hierarchy with predicted values based on input files and the selected preset. Emits a signal with the generated `SourceRule` list for the GUI. * `blenderscripts/`: Contains Python scripts (`create_nodegroups.py`, `create_materials.py`) designed to be executed *within* Blender for post-processing. * `Presets/`: Contains supplier-specific configuration files in JSON format, used by the `PredictionHandler` for initial rule generation. * `Testfiles/`: Contains example input assets for testing purposes. * `Tickets/`: Directory for issue and feature tracking using Markdown files.