Add comprehensive tests for image processing nodes and refactor node imports

- Introduced new test files for image layer, image plane, normal scale, object normal rotation, shadeless, and temporary attributes.
- Implemented tests to validate the behavior of alpha curves, depth layers, and normal scales in various rendering engines.
- Refactored import paths for node groups to align with the new directory structure.
- Added checks for temporary attribute lifetimes and ensured proper cleanup without warnings.
- Enhanced CLI commands to require the Blender group and validate the presence of generated node assets before packaging.
- Updated packaging scripts to enforce the existence of necessary assets, preventing build failures.
This commit is contained in:
2026-09-19 21:23:19 +08:00
parent 2b3c0194a6
commit 9debab5c0c
73 changed files with 500 additions and 217 deletions

View File

@@ -41,25 +41,25 @@ uv sync
uv lock --refresh
# 运行全部测试
uv run pytest
uv run --group blender --group ai pytest
# 构建 Windows、macOS、Linux 扩展包到 dist/
uv run pack
# 本地构建多版本静态页面(只提交到本地 gh-pages 分支,不推送)
uv run docs build
uv run --group docs docs build
# 本地热更新预览当前文档
uv run docs dev
uv run --group docs docs dev
# 用 pyproject.toml 中的 major.minor.x 发布文档并让 latest 指向它
uv run docs deploy
uv run --group docs docs deploy
# 构建并验证 Blender 节点资产
uv run node-group build
uv run --group blender node-group build
# 准备、校验并同步 ONNX 模型到 R2
uv run models sync
uv run --group models model sync
```
## 命名规范
@@ -98,13 +98,14 @@ uv run models sync
## Blender 节点组规范
- 节点组统一保存于 `src/anyimage/assets/O_AnyImage.blend`。
- 节点组源码位于顶层 `nodes/`,`tools/nodes` 只负责构建、校验、布局和预览。
- `src/anyimage/assets/O_AnyImage.blend` 是发布构建产物,由节点源码生成且不得提交到 Git。
- 插件运行时必须使用 `load_node_group(group_name)` 从资产加载,禁止调用 `bpy.data.node_groups.new()` 创建节点组。
- `tools/nodes` 构建脚本和测试允许通过代码创建节点组。
- `nodes/` 构建代码和节点测试允许通过代码创建节点组。
- 字段默认直接连接,按消费位置的几何、域、类型及输入属性版本验证求值等价性;多个消费者可复用同一输出。
- 所有几何节点、嵌套组及测试辅助图禁止使用 Capture Attribute。域转换显式表达;跨几何变化优先调整消费顺序或在明确源几何上采样。
- Store Named Attribute 仅用于实际命名协议或经论证仍需跨几何变化保存的最少数据;明确名称、类型、域、Selection、写入阶段及消费者。多个消费者或跨区域连线不构成存值理由。
- 内部临时命名属性使用专用名称,在最后消费者之后精确清理,保留用户属性;源码和保存资产均检查 Capture 为零。
- 节点布局通过区域内输入、字段排列和必要的 Reroute 保持可读;存储须有数据生命周期依据,构建阶段通过明确的节点或 socket 引用接线。
- 修改节点组的逻辑、接口、布局或共用构建函数后,必须运行 `uv run node-group build`,无需另行确认;源码、测试与 `.blend` 资产均更新且验证通过,才算完成。
- 修改节点组的逻辑、接口、布局或共用构建函数后,必须运行 `uv run --group blender node-group build`,无需另行确认;生成资产并验证通过才算完成。
- 具体构建规范与操作步骤见[节点资产](docs/internals/node-assets.md)。