Refactor depth node groups and simplify options
- Removed `Smooth Weight` input from `O Image Depth Plane`, `O Image Depth Cutout`, and `O Image Depth Panorama` to streamline the interface and maintain consistent boundary smoothing behavior. - Adjusted the `Reference Depth` input to appear last in the options panel for better organization, reflecting its role as a calibration value. - Consolidated the `expand_smooth()` function to only accept necessary parameters, eliminating unused branches related to `Smooth Weight` and `pin_sharp`. - Updated related tests and node assets to ensure functionality remains intact and consistent with the new structure. - Introduced new specifications to document the changes and ensure compliance with the updated requirements.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
schema: spec-driven
|
||||
created: 2026-09-16
|
||||
42
openspec/changes/simplify-depth-group-options/design.md
Normal file
42
openspec/changes/simplify-depth-group-options/design.md
Normal file
@@ -0,0 +1,42 @@
|
||||
## Context
|
||||
|
||||
`O Image Depth Plane`、`O Image Depth Cutout`、`O Image Depth Panorama` 共用 `common/boundary_smoothing.py` 的 `smooth_cut_boundary()`,最终调用 `common/smoothing.py` 的 `expand_smooth()`。`expand_smooth()` 目前支持 `weight_name`、`pin_sharp` 与无影响场三种形态,但边界平滑只使用「影响场 + 固定权重」这一种。三个节点组把该权重公开为 `Smooth Weight`,默认值始终为 1。
|
||||
|
||||
Options 面板当前的 `Reference Depth` 排在首位,而该值是服务端标定结果,只有更换深度尺度时才需要手工调整。
|
||||
|
||||
## Goals / Non-Goals
|
||||
|
||||
**Goals:**
|
||||
|
||||
- 三个深度节点组不再公开 `Smooth Weight`,边界平滑保持默认强度下的现有结果。
|
||||
- `expand_smooth()` 只保留实际使用的调用形态。
|
||||
- 深度与浮雕节点组的 Options 中 `Reference Depth` 位于最后一项。
|
||||
|
||||
**Non-Goals:**
|
||||
|
||||
- 不改变边界平滑的影响带宽度、迭代次数、保护规则和轮廓权重。
|
||||
- 不改变 `Reference Depth` 的几何含义、初始化来源与取值范围。
|
||||
- 不为已保存的 `Smooth Weight` 值提供兼容入口。
|
||||
|
||||
## Decisions
|
||||
|
||||
### 边界平滑权重固定为 1
|
||||
|
||||
权重只作为位置混合系数与影响场相乘,默认值 1 意味着混合完全由影响场决定。直接删除该输入并把混合系数接到影响场,节点图少一层乘法,结果与默认参数一致。
|
||||
|
||||
### `expand_smooth()` 收敛为单一形态
|
||||
|
||||
唯一调用方传入影响场且不平滑法线,因此删除 `weight_name`、`pin_sharp` 分支与 `influence=None` 分支,签名收敛为 `expand_smooth(group, geometry, iterations_name, influence)`。相比保留未用参数,直接删除可避免后续再出现同类权重输入。
|
||||
|
||||
### `Reference Depth` 放到 Options 末尾
|
||||
|
||||
三个组的 Options 依次为:Depth Plane `Boundary Smooth`、`Mask Threshold`、`Reference Depth`;Depth Cutout `Boundary Smooth`、`Normal Smooth`、`Front Inflation`、`Reference Depth`;Relief Plane `Mask Threshold`、`Reference Depth`。标定输入不再挤占艺术调整参数的位置。
|
||||
|
||||
### 测试用 `Boundary Smooth` 与影响带判断替代权重隔离
|
||||
|
||||
原先用 `Smooth Weight = 0` 关闭位置平滑的用例,改为 `Boundary Smooth = 0` 的直通路径,或把断言限制在影响带之外的点。
|
||||
|
||||
## Risks / Trade-offs
|
||||
|
||||
- [移除权重后无法再单独关闭位置平滑] → 位置平滑与迭代次数同属一次边界平滑,`Boundary Smooth = 0` 已是完整的关闭路径。
|
||||
- [已保存场景的 Modifier 仍带 `Smooth Weight`] → 已保存数值按原样保留,该输入不再影响求值,重新生成几何时按默认强度构建。
|
||||
26
openspec/changes/simplify-depth-group-options/proposal.md
Normal file
26
openspec/changes/simplify-depth-group-options/proposal.md
Normal file
@@ -0,0 +1,26 @@
|
||||
## Why
|
||||
|
||||
`Smooth Weight` 在三个深度节点组中始终以 `1` 参与边界平滑,单独暴露只会增加接口与实现复杂度;`Reference Depth` 是标定值,用户极少调整,却占据 Options 的首位。
|
||||
|
||||
## What Changes
|
||||
|
||||
- **BREAKING**:从 `O Image Depth Plane`、`O Image Depth Cutout`、`O Image Depth Panorama` 的公开接口移除 `Smooth Weight`,边界平滑固定使用完整强度。
|
||||
- 删除共享 smoothing 中只为 `Smooth Weight` 与 `pin_sharp` 服务的分支和节点。
|
||||
- 将 `O Image Depth Plane`、`O Image Depth Cutout`、`O Image Relief Plane` 的 Options 中 `Reference Depth` 移到面板最后一项。
|
||||
- 重建并验证 `O_AnyImage.blend`,同步节点接口清单与相关测试。
|
||||
|
||||
## Capabilities
|
||||
|
||||
### New Capabilities
|
||||
|
||||
- `depth-node-options`: 规定深度与浮雕几何节点组 Options 面板的公开控制项集合与排列顺序。
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
无。
|
||||
|
||||
## Impact
|
||||
|
||||
- 影响 `O Image Depth Plane`、`O Image Depth Cutout`、`O Image Depth Panorama`、`O Image Relief Plane` 的公开 modifier 接口。
|
||||
- 影响 `tools/nodes/groups`、`tools/nodes/common` 的边界平滑构建代码、节点资产与节点相关测试。
|
||||
- 现有依赖 `Smooth Weight` socket identifier 的 modifier 配置或调用方需要停止写入该输入;默认值下的几何结果保持不变。
|
||||
@@ -0,0 +1,47 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 深度节点组不公开 Smooth Weight
|
||||
|
||||
`O Image Depth Plane`、`O Image Depth Cutout`、`O Image Depth Panorama` SHALL 不在公开接口中提供 `Smooth Weight`,边界平滑 MUST 按完整影响场混合顶点位置。
|
||||
|
||||
#### Scenario: 检查节点组接口
|
||||
|
||||
- **WHEN** 读取三个节点组的输入接口
|
||||
- **THEN** 接口不存在 `Smooth Weight`,且 `Boundary Smooth` 仍控制边界平滑迭代次数
|
||||
|
||||
#### Scenario: 默认边界平滑结果
|
||||
|
||||
- **WHEN** 用户保持默认参数并提高 `Boundary Smooth`
|
||||
- **THEN** 边界带内的顶点按影响场强度移动到平滑位置,影响带外的顶点保持不变
|
||||
|
||||
### Requirement: 共享平滑构建只保留影响场形态
|
||||
|
||||
`expand_smooth()` SHALL 只接受迭代次数输入、影响场与几何,并 MUST 在迭代次数为零时原样返回输入几何。
|
||||
|
||||
#### Scenario: 迭代次数为零
|
||||
|
||||
- **WHEN** `Boundary Smooth` 为 0
|
||||
- **THEN** 输出几何与输入几何完全一致
|
||||
|
||||
### Requirement: Options 中的 Reference Depth 位于最后
|
||||
|
||||
包含 `Reference Depth` 的节点组 SHALL 在 Options 面板最后一项提供该输入,其余 Options 控制项 MUST 保持各自职责与默认值。
|
||||
|
||||
#### Scenario: 检查 Depth Plane 与 Depth Cutout 排列
|
||||
|
||||
- **WHEN** 读取 `O Image Depth Plane` 与 `O Image Depth Cutout` 的 Options 项顺序
|
||||
- **THEN** 最后一项为 `Reference Depth`,之前的项依次为各自的艺术调整参数
|
||||
|
||||
#### Scenario: 检查 Relief Plane 排列
|
||||
|
||||
- **WHEN** 读取 `O Image Relief Plane` 的 Options 项顺序
|
||||
- **THEN** 项顺序为 `Mask Threshold`、`Reference Depth`
|
||||
|
||||
### Requirement: Reference Depth 保持既有几何含义
|
||||
|
||||
移动面板位置 SHALL 不改变 `Reference Depth` 的类型、子类型、默认值、范围与几何运算方式。
|
||||
|
||||
#### Scenario: 校验输入属性
|
||||
|
||||
- **WHEN** 读取 `Reference Depth` 输入
|
||||
- **THEN** 该输入使用 `DISTANCE` 子类型,并继续作为采样深度的运算基准
|
||||
15
openspec/changes/simplify-depth-group-options/tasks.md
Normal file
15
openspec/changes/simplify-depth-group-options/tasks.md
Normal file
@@ -0,0 +1,15 @@
|
||||
## 1. 共享平滑收敛
|
||||
|
||||
- [x] 1.1 将 `expand_smooth()` 收敛为影响场形态,删除 `weight_name`、`pin_sharp` 与无影响场分支
|
||||
- [x] 1.2 更新 `smooth_cut_boundary()` 调用并确认影响带、保护规则与轮廓权重不变
|
||||
|
||||
## 2. 节点组接口
|
||||
|
||||
- [x] 2.1 从 Depth Plane、Depth Cutout、Depth Panorama 删除 `Smooth Weight` 输入
|
||||
- [x] 2.2 将 Depth Plane、Depth Cutout、Relief Plane 的 `Reference Depth` 移到 Options 最后一项
|
||||
|
||||
## 3. 测试与资产
|
||||
|
||||
- [x] 3.1 更新节点库存、Options 排列与边界平滑行为测试,移除 `Smooth Weight` 依赖
|
||||
- [x] 3.2 运行 `uv run node-group build` 重建并验证节点资产
|
||||
- [x] 3.3 运行节点与 Operator 相关测试,检查残留引用与最终差异
|
||||
Reference in New Issue
Block a user