Refactor Cutout and Image Editing Logic
- Renamed "Base Plane Depth" to "Reference Depth" across validate_cutout.py for consistency. - Introduced a new specification for Cutout mesh sampling to ensure source pixel spacing is preserved and limits are applied correctly. - Unified naming conventions for image editing results to maintain consistency across Remove Background, Upscale, and Crop operations. - Updated the handling of Refine Selection to ensure it retains the original bounds and does not apply unnecessary cropping. - Enhanced material generation logic to connect image color directly to IOR Level, improving the rendering of dark areas. - Established clear requirements for geometry depth controls and image result materials to ensure consistent behavior across different components. - Removed outdated logic and ensured all changes are documented and tested for regression.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
## Purpose
|
||||
|
||||
规定 Cutout 网格细节与源图像素之间的稳定关系,并让性能上限约束实际生成的网格采样数量而不是输入图片尺寸。
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Mesh Detail preserves source-pixel spacing
|
||||
系统 SHALL 将 Cutout 的 Low、Medium、High、Ultra 分别解释为相邻网格采样点之间 32、16、8、4 个源图像素,并在未触及网格上限时保持该间距。
|
||||
|
||||
#### Scenario: Low samples every 32 source pixels
|
||||
- **WHEN** 用户以 Low 创建一个未触及网格上限的 Cutout
|
||||
- **THEN** 系统按每 32 个源图像素一次的间距构建网格
|
||||
|
||||
#### Scenario: Upscale increases linear mesh density
|
||||
- **WHEN** 同一图片内容在线性宽高各 Upscale 4 倍后,以相同 Mesh Detail、相同相对 Selection 和相同显示尺寸创建 Cutout,且两次均未触及网格上限
|
||||
- **THEN** Upscale 结果在同一线性内容范围内获得约 4 倍网格采样密度
|
||||
|
||||
### Requirement: Cutout mesh limit caps actual sampling resolution
|
||||
系统 SHALL 仅在 Cutout 实际几何范围的预期采样长边超过 **Maximum Cutout Mesh Resolution** 时增大采样间距,并 SHALL NOT 按 Selection bounds 的原始像素长边直接缩放已经由 Mesh Detail 得到的密度。
|
||||
|
||||
#### Scenario: Large pixel bounds remain below the sampling limit
|
||||
- **WHEN** Selection bounds 的像素长边超过配置值,但按当前 Mesh Detail 计算的实际采样长边没有超过配置值
|
||||
- **THEN** 系统保持该 Mesh Detail 对应的源像素采样间距
|
||||
|
||||
#### Scenario: Actual sampling reaches the configured limit
|
||||
- **WHEN** Cutout 实际几何范围按当前 Mesh Detail 计算的采样长边超过配置值
|
||||
- **THEN** 系统等比增大网格采样间距,使实际采样长边不超过配置值
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
## Purpose
|
||||
|
||||
规定直接编辑 Image Empty 时结果 Image 数据块的统一身份与命名,使共享引用只由 Blender 的数据块唯一性规则产生差异。
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Direct image edits preserve the complete source name
|
||||
Remove Background、Upscale、Crop Box、Crop Lasso、Crop Polyline 和 Crop Perspective SHALL 使用源 Image 数据块的完整名称请求结果 Image 名称,包括名称中的 `.png` 等格式文字,并 SHALL NOT 主动添加材质贴图后缀。
|
||||
|
||||
#### Scenario: Remove Background edits a shared image
|
||||
- **WHEN** Remove Background 编辑一个仍被其他对象引用的 Image
|
||||
- **THEN** 新结果以源 Image 的完整名称请求命名,唯一性数字后缀仅由 Blender 自动追加
|
||||
|
||||
#### Scenario: Upscale edits a shared image
|
||||
- **WHEN** Upscale 编辑一个仍被其他对象引用的 Image
|
||||
- **THEN** 新结果保留源 Image 的完整名称且不添加 `_color`
|
||||
|
||||
#### Scenario: Selection Crop edits a shared image
|
||||
- **WHEN** 任一 Selection Crop 路径编辑一个仍被其他对象引用的 Image,无论是否启用 Refine Selection 或 Keep Original
|
||||
- **THEN** 新结果保留源 Image 的完整名称且不移除名称中的格式文字
|
||||
|
||||
#### Scenario: Perspective Crop edits a shared image
|
||||
- **WHEN** Crop Perspective 编辑一个仍被其他对象引用的 Image,无论是否启用 Keep Original
|
||||
- **THEN** 新结果保留源 Image 的完整名称且不移除名称中的格式文字
|
||||
|
||||
### Requirement: Image replacement follows Blender data-block identity
|
||||
系统 SHALL 在源 Image 只由被编辑对象使用时以结果替换并清理旧数据,使结果最终恢复源 Image 的准确名称;源 Image 仍被共享或被 Keep Original 保留时,系统 SHALL 保留源数据并接受 Blender 自动生成的数字唯一性后缀。
|
||||
|
||||
#### Scenario: Unshared source is replaced
|
||||
- **WHEN** 直接图片编辑替换一个没有其他用户且没有 Fake User 的源 Image
|
||||
- **THEN** 旧 Image 被清理且结果 Image 最终使用源 Image 的准确名称
|
||||
|
||||
#### Scenario: Shared source is split
|
||||
- **WHEN** 直接图片编辑替换一个仍有其他用户的源 Image
|
||||
- **THEN** 其他用户继续引用源 Image,被编辑对象引用新结果,两个数据块的重名冲突由 Blender 自动解决
|
||||
|
||||
### Requirement: Material texture naming remains separate
|
||||
系统 SHALL 仅对 Plane、Depth Plane、Cutout Shape 等生成材质贴图的工作流使用 `_color.png`、`_depth.exr`、`_normal.png` 等业务后缀,直接图片编辑 SHALL NOT 复用这些派生贴图名称。
|
||||
|
||||
#### Scenario: Plane conversion creates material textures
|
||||
- **WHEN** 图片被转换为需要材质贴图的 Plane 或 Cutout 结果
|
||||
- **THEN** 其 Color、Depth 和 Normal 数据继续按对应材质贴图规则命名
|
||||
|
||||
Reference in New Issue
Block a user