- 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.
35 lines
1.9 KiB
Markdown
35 lines
1.9 KiB
Markdown
# 剪贴板图片
|
||
|
||
剪贴板功能把操作系统中的图片转换为 Packed Blender Image,再根据当前编辑器创建对象、节点或画笔纹理。它完全运行在 Blender 进程中,不使用 Job Server。
|
||
|
||
## 对应文件
|
||
|
||
```text
|
||
operators/clipboard_image/
|
||
├── __init__.py # Operator、原生复制优先级与快捷键
|
||
├── clipboard.py # Windows、macOS、Linux 剪贴板读取
|
||
└── actions.py # Image 复用、Pack 与各编辑器落点
|
||
```
|
||
|
||
## 处理流程
|
||
|
||
```mermaid
|
||
flowchart TD
|
||
Paste["Ctrl/Cmd + V"] --> Priority{"刚执行过 Blender Copy?"}
|
||
Priority -- "是" --> Native["交回原生 Paste"]
|
||
Priority -- "否" --> Read["读取系统图片"]
|
||
Read --> Image["按内容哈希复用或创建 Packed Image"]
|
||
Image --> Target{"当前编辑器"}
|
||
Target --> View["Reference / Plane"]
|
||
Target --> Node["Image Node"]
|
||
Target --> Paint["Brush Texture"]
|
||
```
|
||
|
||
`TrackNativeCopy` 在相同快捷键下记录系统剪贴板变化标记。如果剪贴板没有在 Blender Copy 之后变化,Paste Operator 返回 `PASS_THROUGH`,让 Blender 原生对象或节点粘贴优先执行。
|
||
|
||
`clipboard.py` 封装平台差异:Windows 读取 DIB/DIBV5,macOS 与 Linux 调用平台提供的图片导出命令。模块最终都返回编码后的图片字节和扩展名,后续流程不再关心来源平台。
|
||
|
||
`actions.py` 以 SHA-256 标记 Packed Image,相同内容可复用已有数据块。3D View 中的 Reference 和 Plane 使用鼠标位置或视图落点;Plane 复用 `convert_to_plane/mesh_plane.py` 的基础网格与 `O Mesh Plane` 资产。Node Editor 根据树类型选择对应 Image 节点,绘制模式则为当前画笔配置 Texture。
|
||
|
||
快捷键只注册到 3D View 与 Node Editor;编辑器内部的具体支持范围由 `target_for_context()` 决定。创建成功后图片始终 Pack 到当前 `.blend`,避免依赖临时剪贴板文件。
|