- Implemented `build_mesh_plane.py` to create a geometry node group for mesh planes with customizable parameters. - Created `build_shadeless.py` for a shader node group that displays color without scene lighting while preserving shadows and reflections. - Added `validate.py` to validate the integrity of the newly created node groups and their inputs. - Introduced `validate_cutout.py` to ensure the functionality of cutout node groups and their dependencies. - Developed `validate_mesh_plane.py` to test the mesh plane creation and its modifier settings.
59 lines
2.6 KiB
Markdown
59 lines
2.6 KiB
Markdown
# 节点资产
|
||
|
||
AnyImage 将稳定、可复用的 Geometry Nodes 和 Shader 节点组构建到 `O_AnyImage.blend`,运行时按名称加载。Depth Plane 节点图是例外:它由 Python 在当前 `.blend` 中按需创建。
|
||
|
||
## 对应文件
|
||
|
||
```text
|
||
src/anyimage/
|
||
├── assets/O_AnyImage.blend
|
||
└── operators/common/
|
||
├── node_asset.py # 资产路径、加载与 Modifier 输入
|
||
└── node_graph.py # 共享节点图构造函数
|
||
|
||
tools/node_assets/
|
||
├── build.py # 统一构建入口
|
||
├── build_mesh_plane.py
|
||
├── build_shadeless.py
|
||
├── build_cutout.py
|
||
├── validate.py # 资产清单与基础接口
|
||
├── validate_mesh_plane.py
|
||
└── validate_cutout.py
|
||
```
|
||
|
||
## 构建与加载
|
||
|
||
```mermaid
|
||
flowchart TD
|
||
Scripts["tools/node_assets/build_*.py"] --> Build["Blender 后台构建"]
|
||
Build --> Blend["assets/O_AnyImage.blend"]
|
||
Blend --> Loader["operators/common/node_asset.py"]
|
||
Loader --> Modifier["运行时 Node Group / Modifier"]
|
||
```
|
||
|
||
使用 Blender 而不是普通 Python 执行:
|
||
|
||
```bash
|
||
BLENDER_BIN="/c/Program Files/Blender Foundation/Blender 4.5/blender.exe"
|
||
|
||
"$BLENDER_BIN" --background --python tools/node_assets/build.py
|
||
"$BLENDER_BIN" --background --python tools/node_assets/validate.py
|
||
"$BLENDER_BIN" --background --python tools/node_assets/validate_mesh_plane.py
|
||
"$BLENDER_BIN" --background --python tools/node_assets/validate_cutout.py
|
||
```
|
||
|
||
`build.py` 从空 Factory 文件开始,依次构建 `O Mesh Plane`、`O Shadeless`、四个 Cutout 内部节点组与公开修改器节点组 `O Image Cutout`,再保存唯一资产文件。`O Image Cutout` 用 Menu Switch 包装四个内部组;运行时 Loader 只加载这个稳定入口,Blender 4.5 根据 Shape 菜单依赖只显示当前分支实际使用的输入。
|
||
|
||
## 验证范围
|
||
|
||
基础验证检查发布资产清单、节点树类型、Modifier 标记、接口顺序和 Fake User。专项验证继续检查:
|
||
|
||
- Mesh Plane 的接口、细分、Thickness 和几何求值;
|
||
- `O Image Cutout` 的公开接口、Shape 菜单和四个内部组的依赖关系;
|
||
- 节点不重叠、主要连线保持从左向右;
|
||
- 局部 Group Input 未使用输出隐藏;
|
||
- Cleanup 只在四条分支之前执行,Smooth 只在菜单选择之后执行;
|
||
- Repeat Zone 数量和四种 Shape 的关键几何求值稳定。
|
||
|
||
节点资产接口变化时,应运行全部四个 Blender 入口和完整 Python 测试。只修改 Python、Markdown 或打包逻辑时无需重建 `.blend`。Blender 自动生成的 `.blend1` 等备份不属于发布资产。
|