18 lines
4.1 KiB
JSON
18 lines
4.1 KiB
JSON
{
|
|
"sourceFile": "Project Notes/GUI_BLENDER_INTEGRATION_PLAN.md",
|
|
"activeCommit": 0,
|
|
"commits": [
|
|
{
|
|
"activePatchIndex": 0,
|
|
"patches": [
|
|
{
|
|
"date": 1745262237766,
|
|
"content": "Index: \n===================================================================\n--- \n+++ \n"
|
|
}
|
|
],
|
|
"date": 1745262237766,
|
|
"name": "Commit-0",
|
|
"content": "# GUI Blender Integration Plan\r\n\r\n## Goal\r\n\r\nAdd a checkbox and input fields to the GUI (`gui/main_window.py`) to enable/disable Blender script execution and specify the `.blend` file paths, defaulting to `config.py` values. Integrate this control into the processing logic (`gui/processing_handler.py`).\r\n\r\n## Proposed Plan\r\n\r\n1. **Modify `gui/main_window.py`:**\r\n * Add a `QCheckBox` (e.g., `self.blender_integration_checkbox`) to the processing panel layout.\r\n * Add two pairs of `QLineEdit` widgets and `QPushButton` browse buttons for the nodegroup `.blend` path (`self.nodegroup_blend_path_input`, `self.browse_nodegroup_blend_button`) and the materials `.blend` path (`self.materials_blend_path_input`, `self.browse_materials_blend_button`).\r\n * Initialize the text of the `QLineEdit` widgets by reading the `DEFAULT_NODEGROUP_BLEND_PATH` and `DEFAULT_MATERIALS_BLEND_PATH` values from `config.py` when the GUI starts.\r\n * Connect signals from the browse buttons to new methods that open a `QFileDialog` to select `.blend` files and update the corresponding input fields.\r\n * Modify the slot connected to the \"Start Processing\" button to:\r\n * Read the checked state of `self.blender_integration_checkbox`.\r\n * Read the text from `self.nodegroup_blend_path_input` and `self.materials_blend_path_input`.\r\n * Pass these three pieces of information (checkbox state, nodegroup path, materials path) to the `ProcessingHandler` when initiating the processing task.\r\n\r\n2. **Modify `gui/processing_handler.py`:**\r\n * Add parameters to the method that starts the processing (likely `start_processing`) to accept the Blender integration flag (boolean), the nodegroup `.blend` path (string), and the materials `.blend` path (string).\r\n * Implement the logic for finding the Blender executable (reading `BLENDER_EXECUTABLE_PATH` from `config.py` or checking PATH) within `processing_handler.py`.\r\n * Implement the logic for executing the Blender scripts using `subprocess.run` within `processing_handler.py`. This logic should be similar to the `run_blender_script` function added to `main.py` in the previous step.\r\n * Ensure this Blender script execution logic is conditional based on the received integration flag and runs *after* the main asset processing (handled by the worker pool) is complete.\r\n\r\n## Execution Flow Diagram (GUI)\r\n\r\n```mermaid\r\ngraph TD\r\n A[GUI: User Clicks Start Processing] --> B{Blender Integration Checkbox Checked?};\r\n B -- Yes --> C[Get Blend File Paths from Input Fields];\r\n C --> D[Pass Paths and Flag to ProcessingHandler];\r\n D --> E[ProcessingHandler: Start Asset Processing (Worker Pool)];\r\n E --> F[ProcessingHandler: Asset Processing Complete];\r\n F --> G{Blender Integration Flag True?};\r\n G -- Yes --> H[ProcessingHandler: Find Blender Executable];\r\n H --> I{Blender Executable Found?};\r\n I -- Yes --> J{Nodegroup Blend Path Valid?};\r\n J -- Yes --> K[ProcessingHandler: Run Nodegroup Script in Blender];\r\n K --> L{Script Successful?};\r\n L -- Yes --> M{Materials Blend Path Valid?};\r\n L -- No --> N[ProcessingHandler: Report Nodegroup Error];\r\n N --> M;\r\n M -- Yes --> O[ProcessingHandler: Run Materials Script in Blender];\r\n O --> P{Script Successful?};\r\n P -- Yes --> Q[ProcessingHandler: Report Completion];\r\n P -- No --> R[ProcessingHandler: Report Materials Error];\r\n R --> Q;\r\n M -- No --> Q;\r\n J -- No --> M[Skip Nodegroup Script];\r\n I -- No --> Q[Skip Blender Scripts];\r\n G -- No --> Q;\r\n B -- No --> E;"
|
|
}
|
|
]
|
|
} |