2.4 KiB
2.4 KiB
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:
-
Modify
blenderscripts/create_nodegroups.py:- Locate the main loop in
blenderscripts/create_nodegroups.pythat iterates through the processed assets. - Inside this loop, for each asset directory, construct the path to the
metadata.jsonfile. - Read the
metadata.jsonfile using Python'sjsonmodule. - Extract the
categoryvalue from the parsed JSON data. - Implement a conditional check: If the extracted
categoryis not "Surface" and not "Decal", skip the existing nodegroup creation logic for this asset and proceed to the tagging step. - If the
categoryis "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
categorystring as a tag to the found Blender asset.
- Locate the main loop in
-
Testing:
- Prepare a test set of processed assets that includes examples of "Surface", "Decal", and "Asset" categories, each with a corresponding
metadata.jsonfile. - Run the modified
create_nodegroups.pyscript 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.
- Prepare a test set of processed assets that includes examples of "Surface", "Decal", and "Asset" categories, each with a corresponding
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];