
Zipzi 发布开源 Live2D 编辑器,支持 AI 辅助建模
来源标题:Show HN: Zipzi – Open-source Live2D Editor alternative with AI-assisted editing
Zipzi 是一款开源的 Live2D Cubism Editor 替代品,用 Rust 和 GPUI 构建,让用户与 AI 代理协同编辑同一模型。它通过 Python SDK 连接可视化桌面编辑器,双方可共享撤销历史并基于对方的修改继续工作。目前处于早期开发阶段,尚无稳定版本,仅支持 macOS 和 Windows。
以下正文由 AI 翻译自 Hacker News 最新(原文版权归原站所有),可能存在偏差,重要内容请以原文为准。
一个开源的 2D 建模与动画工具,用来与 AI 协同创作。你负责塑造画面,你的 AI agent 帮你完成建模工作。Zipzi 把可视化桌面编辑器与 Python API 连接起来,让你和你的 agent 可以查看并编辑同一个模型、共享撤销历史,并在彼此的改动之上继续工作。
Zipzi 2D 是 Live2D Cubism Editor 的开源替代品,使用 Rust 和 GPUI 构建。它的名字来自粤语“摺紙”(zip3 zi2),意为“折纸”。
下载 Alpha 版 · Python SDK · 报告问题 · 参与贡献
早期开发阶段:目前尚无稳定版本。API 和文件格式可能会变化。编辑器支持 macOS 和 Windows。
zipzi-2d-demo.mp4
你的编辑器。你的 AI agent。同一个模型。
向你的 AI 编程 agent 描述你想要什么。它会使用 Python SDK 查看模型、查看渲染图像,并做出你可以在编辑器中审阅和撤销的修改。你和你的 agent 在同一个文档上工作,共享撤销历史。
带上你自己的、具备 Python 能力的 agent,让它参阅 SDK 指南。
你描述任务;你的 AI agent 编写并运行代码。下面的示例由 AI 编程 agent 生成,并针对运行中的编辑器测试过。它们展示了 agent 如何通过 Python SDK 工作——你不需要自己编写这些脚本。你的职责是说明你想要什么,并在编辑器中审阅结果。
对你的 agent 说:“查看每个 mesh,给它起一个有意义的名称。”
安装 Python 客户端(CPython 3.14),启动一个支持 GPU 观察的兼容编辑器,并打开一个模型。具备图像能力的编程 agent 可以执行以下两步。
- agent 观察每个 mesh。它生成的脚本会为每个 mesh 导出一张图像,在带纹理的模型上高亮显示该 mesh 的线框,另外还会生成一个 JSON 命名工作表。observe 提供视觉证据;agent 提供语义解释。
import json from pathlib import Path from uuid import uuid4 import zipzi from zipzi import inspection, observation, spatial output = Path("mesh-review-" + uuid4().hex[:8]).resolve() output.mkdir() with zipzi.connect() as runtime: sessions = runtime.sessions.list() if len(sessions) != 1: raise RuntimeError("Open exactly one model for this example.") session = runtime.sessions.attach(sessions[0].id)
Follow every page: a single list() call may not contain all meshes.
meshes, cursor, source = [], None, None while True: page = session.meshes.list(cursor=cursor) if source is None: source = page.source if page.source != source: raise RuntimeError("Model changed; restart the inspection.") meshes.extend(page.items) cursor = page.next_cursor if cursor is None: break rows = [] for index, mesh in enumerate(meshes):
Use this mesh's bounds to frame it, including hidden geometry.
{} evaluates default parameter values, not the editor's current pose.
query = spatial.Bounds( targets=(spatial.MeshTarget(value=mesh.id),), include_hidden=True, ) bounds = session.modeling.spatial( ({},), (query,), expected=source, ).wait().value.frames[0].results[0].value.model_bounds row = dict(id=mesh.id, old_name=mesh.name, new_name=mesh.name, image=None) if bounds is not None: x0, y0, x1, y1 = bounds margin = max(x1 - x0, y1 - y0, 1.0) * 0.15 view = observation.View( width=768, height=768, roi=(x0 - margin, y0 - margin, x1 + margin, y1 + margin), topology=observation.Overlay( targets=(observation.MeshTarget(value=mesh.id),), wireframe=True, include_hidden=True, ), )
Freeze all observations to the inventory's source. If the model
changes, the SDK refuses stale reads; rerun instead of mixing them.
images = session.modeling.observe(({},), view, expected=source).wait() report = inspection.save(images, output / f"mesh-{index:04d}") row["image"] = str(report.images[0]) rows.append(row)
SessionId is a typed handle: store its fields for the second script.
worksheet = output / "names.json" worksheet.write_text(json.dumps( dict(session_id=dict(runtime=session.id.runtime, serial=session.id.serial), meshes=rows), indent=2, ensure_ascii=False, ), encoding="utf-8") print(worksheet)
让 agent 打开每一张导出的 PNG,在上下文中识别被高亮的 mesh,并且只修改 names.json 中的 new_name。保持 ID 和 old_name 不变。叠加层选中的是用于诊断的几何体,而非孤立的画面:周围的纹理仍然可见,隐藏或被遮挡的画面仍可能产生歧义。对于不确定或没有对应图像的条目,保留原名称,或者先观察更多姿势再命名。
- agent 统一应用这些语义名称。在你审阅了建议的名称之后,agent 使用 names.json 的路径编写并运行下面的脚本。你不需要复制代码或运行终端命令。在观察和应用之间,保持同一个模型打开且不做改动。
import json import sys from pathlib import Path import zipzi review = json.loads(Path(sys.argv[1]).read_text(encoding="utf-8")) rows = review["meshes"] if len({row["id"] for row in rows}) != len(rows): raise ValueError("Duplicate mesh IDs in the worksheet.") if any(not isinstance(row["new_name"], str) or not row["new_name"].strip() for row in rows): raise ValueError("Every mesh needs a nonempty name.") with zipzi.connect() as runtime:
Rebuild the typed handle; a restarted Editor requires a new inspection.
session = runtime.sessions.attach(zipzi.SessionId(**review["session_id"]))
All renames commit together as one undo step. A missing mesh or changed
original name aborts the edit instead of leaving a partly renamed model.
with session.edit("AI: semantic mesh names") as edit: for row in rows: current = edit.meshes.get(row["id"]).value if current.name != row["old_name"]: raise RuntimeError("Mesh changed; inspect the model again.") if row["new_name"] != row["old_name"]: edit.meshes.rename( row["id"], row["new_name"], expected_name=row["old_name"], ) print("Review the names in the editor. Undo to revert, or save to keep them.")
(原文较长,此处译出前 6000 字,完整内容请点「打开原文」。)
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。