Files
AnyImage/docs/internals/development.md
nan 32bcd45d7b 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.
2026-08-30 00:17:29 +08:00

3.0 KiB
Raw Blame History

开发与发布

AnyImage 的仓库环境用于测试 Blender 侧代码、Server 纯 Python 模块、Manifest 和打包逻辑。AI Runtime 使用另一套 Python 3.12 Environment,不应与仓库开发环境混为一谈。

对应文件

.
├── pyproject.toml
├── uv.lock
├── .python-version
├── pack.py
├── sync_models.py
├── src/anyimage/blender_manifest.toml
├── tests/
├── tools/node_assets/
└── .github/workflows/
    ├── test.yml
    ├── build.yml
    └── docs.yml

开发环境

仓库固定使用 CPython 3.11,因为开发依赖 bpy==4.5.3 对应这一解释器版本。项目根目录执行:

uv sync
uv run pytest

快速检查注册、Manifest 和打包时使用:

uv run pytest tests/test_addon.py tests/test_manifest.py tests/test_pack.py -v

测试按边界组织:test_addon.py 以 Blender Stub 验证注册和 Operator 流程;test_mesh.py、test_image.py 等验证可脱离 Blender 的算法;test_server.py、test_models.py 和各 ONNX 测试覆盖计算端;test_pack.py 与 test_manifest.py 固定发布包结构。

扩展打包

uv run python pack.py

pack.py 为 windows-x64、macos-arm64 和 linux-x64 分别解析依赖 wheel,生成平台专属 Manifest,再把 src/anyimage/ 与 wheel 写入 dist/:

dist/
├── AnyImage.v<version>.windows-x64.zip
├── AnyImage.v<version>.macos-arm64.zip
└── AnyImage.v<version>.linux-x64.zip

本地 src/anyimage/wheels/ 是 wheel 解析的优先来源,用于携带尚未发布的 BlendJob 构建。依赖、wheel 或 Manifest 变化后,需要同时检查 pyproject.toml、uv.lock、blender_manifest.toml 和打包测试;本地 wheel 内容变化后运行 uv lock --refresh。

文档

uv run --only-group docs mkdocs serve
uv run --only-group docs mkdocs build --strict

站点导航由 mkdocs.yml 显式维护,因此移动页面时必须同时更新导航和相对链接。Mike 仍可用于本地版本化发布;CI 则直接构建严格模式站点并部署到 Cloudflare Worker。

CI

flowchart TD
    Main["push main / Pull Request"] --> Test["uv run --frozen pytest"]
    Tag["push v* tag"] --> Release["测试 → pack.py → Release ZIP"]
    Docs["main 上文档变更"] --> Site["mkdocs --strict → Cloudflare"]

test.yml 在 main push、Pull Request 与手动触发时运行完整测试。build.yml 只响应 v* tag,测试通过后构建并上传三个平台包。docs.yml 只在文档相关路径变化或手动触发时部署站点。

许可证

AnyImage Extension 代码采用 GPL-3.0-or-later,完整文本见仓库 LICENSE。模型权重保持各自上游许可证;模型目录声明下载来源、文件校验和许可信息,技术文档不复制可能变化的制品清单。

Geometry Nodes 资产必须由 Blender 构建和验证,见节点资产。