tripocli v2.0.0:Tripo AI 3D 生成与加工 CLI(面向 Agent 与开发者,纯 Python 标准库、零第三方依赖)

覆盖文生 3D、图生 3D、多视图、批量生成,以及重拓扑、绑定、动画、智能分割、
纹理、PBR、智能 UV、部件补全、格式导出与下载。

代码组织:一个功能一个模块(tripo/features/),入口薄壳 tripocli.py。
This commit is contained in:
Mrpzx committed 2026-10-13 19:22:54 +08:00
commit 977f97995a
60 files changed
+5622

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
"""网格编辑(局部重拓扑)— local_edit on a 智能网格 (Nexus) model.
tripocli edit -p <project_id> --bbox "-1,-1,-1,1,1,1" --face-limit 8000 --wait
The studio shows this as the 「编辑」 tab: pick a bounding box on a Nexus mesh and
re-topologise just that region. Verified body:
``{project_id, source_operator_id, bbox:[[min],[max]], face_limit}``.
⚠️ Only offered for **智能网格 (Nexus)** models that are not yet textured / rigged
/ segmented / PBR (the studio hides the tab otherwise). ``bbox`` coordinates are
normalised to the model's own space, ``-1..1`` per axis (the UI clamps them), so
the default ``-1,-1,-1,1,1,1`` covers the whole model.
"""
from . import _common
NAME = "edit"
HELP = "网格编辑:在包围盒内对智能网格(Nexus)模型做局部重拓扑"
FULL_BBOX = [-1.0, -1.0, -1.0, 1.0, 1.0, 1.0]
def add_arguments(parser):
_common.add_op_options(parser, "编辑完成后保存到该路径(可选)")
parser.add_argument(
"--bbox", default=",".join(str(v) for v in FULL_BBOX),
help="包围盒 x1,y1,z1,x2,y2,z2(归一化 -1..1,默认整个模型)",
)
parser.add_argument("--face-limit", type=int, default=8000, help="该区域面数上限(默认 8000)")
def parse_bbox(text):
values = [float(part) for part in text.replace(" ", "").split(",")]
if len(values) != 6:
raise ValueError("--bbox 需要 6 个数字:x1,y1,z1,x2,y2,z2")
lower = [min(1.0, max(-1.0, v)) for v in values[:3]]
upper = [min(1.0, max(-1.0, v)) for v in values[3:]]
return [lower, upper]
def run(ctx):
args = ctx.args
operator_id = ctx.client.project_operator(args.project).get("operator_id")
body = {
"project_id": args.project,
"source_operator_id": operator_id,
"bbox": parse_bbox(args.bbox),
"face_limit": args.face_limit,
}
data = ctx.client.get_data("POST", "/v2/studio/operation/local_edit", body=body)
return _common.run_operator(ctx, data, output=args.output, wait=args.wait, label="网格编辑")