Add new node asset scripts for geometry and shader operations
- 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.
This commit is contained in:
46
docs/internals/operators/image-tool.md
Normal file
46
docs/internals/operators/image-tool.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# Image Tool
|
||||
|
||||
`operators/image_tool/` 对应工具栏中的 Box、Lasso、Line 与 Polyline。四个 WorkspaceTool 共用一个 `EditImageMask` Operator,把屏幕手势转换为图片 Alpha;只有 Box 与 Lasso 可以用 BEN2 细化选择。
|
||||
|
||||
## 对应文件
|
||||
|
||||
```text
|
||||
operators/image_tool/
|
||||
├── __init__.py # 类型清单与对外导出
|
||||
├── box.py # Box WorkspaceTool
|
||||
├── lasso.py # Lasso WorkspaceTool
|
||||
├── line.py # Line WorkspaceTool
|
||||
├── polyline.py # Polyline WorkspaceTool
|
||||
└── edit_mask.py # 本地编辑与 Refine Job 响应
|
||||
```
|
||||
|
||||
手势、坐标和像素能力由 `operators/common/` 提供,四点矫正则属于独立的 [`operators/perspective_tool/`](perspective-tool.md)。
|
||||
|
||||
## 编辑流程
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
Tool["Box / Lasso / Line / Polyline"] --> Gesture["ImageMaskGesture"]
|
||||
Gesture --> Polygon["图片像素 Polygon"]
|
||||
Polygon --> Refine{"Refine Selection?"}
|
||||
Refine -- "否" --> Mask["本地几何 Mask"]
|
||||
Refine -- "是" --> Job["refine-image-mask"]
|
||||
Job --> Mask
|
||||
Mask --> Invert["可选反选"]
|
||||
Invert --> Alpha["源 Alpha × 最终 Mask"]
|
||||
Alpha --> Crop["紧裁切并写回 Empty"]
|
||||
```
|
||||
|
||||
`EditImageMask` 只接受静态图片。未启用 Refine 时,Polygon 在 Blender 侧直接栅格化;启用后,Operator 准备单图输入并提交 Job,响应阶段读取局部 Alpha 与源图 `bounds`,再映射回完整画布。反选始终在最终 Mask 上执行。
|
||||
|
||||
Box 和 Lasso 分别保存自己的 Refine 状态。Line 与 Polyline 强制关闭 Refine,只使用几何 Mask;Line 将有向线扩展为半平面,Polyline 显式闭合用户确认的顶点。
|
||||
|
||||
## 手势与预览
|
||||
|
||||
四个工具使用相同的白色虚线轮廓和半透明填充。Lasso 按移动距离采点,并在线合并近似共线点;普通凹多边形使用三角剖分,自交路径使用 EVEN_ODD 扫描填充。预览缓存只在轨迹变化时更新。
|
||||
|
||||
首次点击通过公共选择逻辑决定是切换 Active Image Empty,还是开始编辑当前图片。这样工具不需要替代 Blender 的普通对象选择。
|
||||
|
||||
## 写回结果
|
||||
|
||||
最终像素保留源 RGB,只修改 Alpha,再按非零 Alpha 紧裁切。公共写回函数只替换当前 Empty 的 Image,并更新 `empty_display_size` 与 `empty_image_offset`,因此剩余像素继续对齐原图片平面,对象 `matrix_world` 不变。
|
||||
Reference in New Issue
Block a user