7.5 KiB
7.5 KiB
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 definitions for allowed asset/file types
├── config/ # Directory for configuration files
│ └── suppliers.json # Persistent list of known supplier names for GUI auto-completion
├── 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 olderAssetProcessorclass. It is kept for reference but is no longer used in the main processing flow orchestrated bymain.pyor the GUI.config.py: Stores global default settings, constants, core rules, and centralized definitions for allowed asset and file types (ASSET_TYPE_DEFINITIONS,FILE_TYPE_DEFINITIONS) used for validation, GUI dropdowns, and coloring.config/: Directory containing configuration files, such assuppliers.json.config/suppliers.json: A JSON file storing a persistent list of known supplier names, used by the GUI'sSupplierSearchDelegatefor auto-completion.configuration.py: Defines theConfigurationclass. Responsible for loading core settings fromconfig.pyand 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 theProcessingEngine.rule_structure.py: Defines theSourceRule,AssetRule, andFileRuledataclasses. 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 newProcessingEngineclass. This is the core component that executes the processing pipeline for a single asset based solely on a providedSourceRuleobject and the staticConfiguration. 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 (usingconcurrent.futures.ProcessPoolExecutor), and triggering Blender scripts. It now orchestrates processing by generating or receivingSourceRuleobjects and passing them to theProcessingEngine.monitor.py: Implements the automated directory monitoring feature using thewatchdoglibrary. Contains theZipHandlerclass to detect new ZIP files and trigger processing viamain.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 theSourceRulehierarchy, and interacting with background handlers.main_window.py: Defines theMainWindowclass, 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 theQAbstractItemModelfor the Unified Hierarchical View (QTreeView). It holds theSourceRulehierarchy and provides data and flags for display and inline editing.delegates.py: Contains customQStyledItemDelegateimplementations (e.g., forQComboBox,QLineEdit) used by the Unified View to provide inline editors for rule attributes.processing_handler.py: Defines theProcessingHandlerclass (runs on aQThread). Manages the execution of theProcessingEnginein background processes and communicates status/results back to the GUI.prediction_handler.py: Defines thePredictionHandlerclass (runs on aQThread). Generates the initialSourceRulehierarchy with predicted values based on input files and the selected preset. Emits a signal with the generatedSourceRulelist 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 thePredictionHandlerfor initial rule generation.Testfiles/: Contains example input assets for testing purposes.Tickets/: Directory for issue and feature tracking using Markdown files.