37 lines
2.4 KiB
Markdown
37 lines
2.4 KiB
Markdown
# FEAT-003: Selective Nodegroup Generation and Category Tagging - Implementation Plan
|
|
|
|
**Objective:** Modify `blenderscripts/create_nodegroups.py` to read the asset category from `metadata.json`, conditionally create nodegroups for "Surface" and "Decal" assets, and add the category as a tag to the Blender asset.
|
|
|
|
**Plan:**
|
|
|
|
1. **Modify `blenderscripts/create_nodegroups.py`:**
|
|
* Locate the main loop in `blenderscripts/create_nodegroups.py` that iterates through the processed assets.
|
|
* Inside this loop, for each asset directory, construct the path to the `metadata.json` file.
|
|
* Read the `metadata.json` file using Python's `json` module.
|
|
* Extract the `category` value from the parsed JSON data.
|
|
* Implement a conditional check: If the extracted `category` is *not* "Surface" and *not* "Decal", skip the existing nodegroup creation logic for this asset and proceed to the tagging step.
|
|
* If the `category` *is* "Surface" or "Decal", execute the existing nodegroup creation logic.
|
|
* After the conditional nodegroup creation (or skipping), use the Blender Python API (`bpy`) to find the corresponding Blender asset (likely the created node group, if applicable, or potentially the asset representation even if the nodegroup was skipped).
|
|
* Add the extracted `category` string as a tag to the found Blender asset.
|
|
|
|
2. **Testing:**
|
|
* Prepare a test set of processed assets that includes examples of "Surface", "Decal", and "Asset" categories, each with a corresponding `metadata.json` file.
|
|
* Run the modified `create_nodegroups.py` script within Blender, pointing it to the test asset library root.
|
|
* Verify in Blender that:
|
|
* Node groups were created only for the "Surface" and "Decal" assets.
|
|
* No node groups were created for "Asset" category assets.
|
|
* All processed assets (Surface, Decal, and Asset) have a tag corresponding to their category ("Surface", "Decal", or "Asset") in the Blender asset browser.
|
|
|
|
```mermaid
|
|
graph TD
|
|
A[Start Script] --> B{Iterate Assets};
|
|
B --> C[Read metadata.json];
|
|
C --> D[Get Category];
|
|
D --> E{Category in ["Surface", "Decal"]?};
|
|
E -- Yes --> F[Create Nodegroup];
|
|
E -- No --> G[Skip Nodegroup];
|
|
F --> H[Find Blender Asset];
|
|
G --> H[Find Blender Asset];
|
|
H --> I[Add Category Tag];
|
|
I --> B;
|
|
B -- No More Assets --> J[End Script]; |