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:
@@ -0,0 +1,41 @@
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: Build and check node groups
|
||||
|
||||
`node-group build` SHALL 使用当前 Python 环境中的 `bpy`,通过独立 Python 子进程依次构建资产、校验保存的资产、运行 `tests/nodes` 与 `tests/tools/nodes`;`node-group check` SHALL 仅执行后两步。两者 SHALL 支持 `--skip-tests` 仅跳过节点相关 pytest,且 SHALL 不查找或启动外部 Blender 可执行程序。
|
||||
|
||||
#### Scenario: Build assets
|
||||
- **WHEN** 用户运行 `uv run --group blender node-group build`
|
||||
- **THEN** 使用固定 bpy 环境更新 O_AnyImage.blend,并在独立进程的资产校验和节点相关测试成功后成功退出
|
||||
|
||||
#### Scenario: Check existing assets
|
||||
- **WHEN** 用户运行 `uv run --group blender node-group check`
|
||||
- **THEN** 使用固定 bpy 环境检查已有资产并运行节点相关测试,资产文件内容保持原样
|
||||
|
||||
#### Scenario: Skip Python tests
|
||||
- **WHEN** build 或 check 指定 `--skip-tests`
|
||||
- **THEN** 仍执行独立进程的资产校验,跳过 pytest
|
||||
|
||||
#### Scenario: Stop after failure
|
||||
- **WHEN** 构建、校验或测试任一步失败
|
||||
- **THEN** 命令非零退出且不执行后续步骤
|
||||
|
||||
#### Scenario: Missing bpy environment
|
||||
- **WHEN** 当前 Python 环境无法导入 bpy
|
||||
- **THEN** 命令非零退出并提示使用 `--group blender`,不尝试查找外部 Blender
|
||||
|
||||
### Requirement: Preview node groups
|
||||
|
||||
`node-group preview` SHALL 使用当前 Python 环境中的 `bpy`,从当前源码在独立 Python 子进程中构建并排列几何节点组,生成 HTML,输出绝对路径并默认打开浏览器,保持资产文件内容原样。默认文件 SHALL 保存于系统临时目录并在命令退出后可供查看。命令 SHALL 支持 `--output PATH`、`--no-open` 和 `--fragment`,不支持选择外部 Blender 可执行程序。
|
||||
|
||||
#### Scenario: Preview current source
|
||||
- **WHEN** 用户运行 `uv run --group blender node-group preview`
|
||||
- **THEN** 生成当前源码的可查看 HTML 并尝试打开浏览器
|
||||
|
||||
#### Scenario: Save without opening
|
||||
- **WHEN** 用户指定 `--output PATH --no-open`
|
||||
- **THEN** HTML 写入指定路径且不启动浏览器
|
||||
|
||||
#### Scenario: Export fragment
|
||||
- **WHEN** 用户指定 `--fragment`
|
||||
- **THEN** 输出 HTML 片段及其路径,不自动打开浏览器
|
||||
@@ -0,0 +1,37 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Node asset is generated from source
|
||||
|
||||
系统 SHALL 能够仅根据版本控制中的 `nodes/` 定义和 `tools/nodes` 构建工具生成 `src/anyimage/assets/O_AnyImage.blend`。生成文件 SHALL 不纳入 Git 版本控制。
|
||||
|
||||
#### Scenario: Build from a clean checkout
|
||||
- **WHEN** 干净源码检出中不存在 `O_AnyImage.blend` 并执行节点资产构建
|
||||
- **THEN** 构建成功生成包含全部既定节点组的资产文件
|
||||
|
||||
#### Scenario: Rebuild an existing asset
|
||||
- **WHEN** 输出路径已有本地生成的节点资产并再次执行构建
|
||||
- **THEN** 文件被当前源码生成的完整资产替换,不产生 `.blend1` 备份
|
||||
|
||||
### Requirement: CI validates generated node assets
|
||||
|
||||
测试 CI SHALL 通过统一的 `node-group` 入口和固定版本的 `bpy` wheel,在运行节点资产相关测试前生成并独立校验节点资产,不得要求额外的 Blender 应用程序安装。
|
||||
|
||||
#### Scenario: Validate a pull request
|
||||
- **WHEN** 测试工作流检出不含节点资产的源码
|
||||
- **THEN** 工作流生成资产、校验保存结果并运行读取该资产的测试
|
||||
|
||||
#### Scenario: Reject an invalid generated asset
|
||||
- **WHEN** 节点源码生成的资产未通过接口、结构或基本求值检查
|
||||
- **THEN** CI 在运行后续发布步骤前失败
|
||||
|
||||
### Requirement: Release packages contain the generated asset
|
||||
|
||||
发布 CI SHALL 在测试和打包前生成并验证节点资产。每个平台扩展归档 MUST 包含 `assets/O_AnyImage.blend`,打包器 MUST 在资产缺失时明确失败。
|
||||
|
||||
#### Scenario: Package a release
|
||||
- **WHEN** 发布工作流从干净源码构建扩展
|
||||
- **THEN** 每个平台归档包含本次工作流生成并验证的节点资产
|
||||
|
||||
#### Scenario: Package without building assets
|
||||
- **WHEN** 打包器运行时 `O_AnyImage.blend` 不存在
|
||||
- **THEN** 打包立即失败并提示先构建节点资产
|
||||
@@ -0,0 +1,21 @@
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: Node asset modules reflect responsibilities
|
||||
|
||||
根目录 `nodes/` 的模块 MUST 只包含节点组及其共用构建定义,`tools/nodes/` MUST 只包含构建入口、布局、资产校验和预览工具。所有移动 MUST 同步导入、wheel 包清单、构建与验证入口及测试路径,并删除旧路径和转发层。
|
||||
|
||||
#### Scenario: Load reorganized node definitions
|
||||
- **WHEN** 构建工具和节点行为测试导入节点组定义
|
||||
- **THEN** 导入指向 `nodes.groups` 或 `nodes.common`,不存在 `tools.nodes.groups` 或 `tools.nodes.common` 兼容路径
|
||||
|
||||
#### Scenario: Load node asset tools
|
||||
- **WHEN** 启动器加载节点构建、布局、验证或预览模块
|
||||
- **THEN** 工具从 `tools.nodes` 加载,并从顶层 `nodes` 包使用节点定义
|
||||
|
||||
#### Scenario: Preserve node behavior
|
||||
- **WHEN** 对重组后的节点构建函数运行针对性测试
|
||||
- **THEN** 节点组名称、接口、默认值、运算、连接、布局和求值与重组前一致
|
||||
|
||||
#### Scenario: Locate node tests
|
||||
- **WHEN** 维护者按测试路径查找节点相关覆盖
|
||||
- **THEN** 节点定义行为测试位于 `tests/nodes`,构建与资产工具测试位于 `tests/tools/nodes`
|
||||
Reference in New Issue
Block a user