覆盖文生 3D、图生 3D、多视图、批量生成,以及重拓扑、绑定、动画、智能分割、 纹理、PBR、智能 UV、部件补全、格式导出与下载。 代码组织:一个功能一个模块(tripo/features/),入口薄壳 tripocli.py。
43 lines
1.5 KiB
Python
43 lines
1.5 KiB
Python
"""智能分割 — split a model into editable semantic parts.
|
||
|
||
tripocli segment -p <project_id> --wait
|
||
|
||
实测(在页面上真操作抓到的请求):
|
||
|
||
POST /v2/studio/operation/ai_segmentation
|
||
{"model_version": "v2.0-20260430", "project_id": "...", "segmentation_granularity": "balanced"}
|
||
|
||
⚠️ 关键点:`model_version` 用的是**分割模型自己的版本**(`v2.0-20260430`),
|
||
不是项目自身的模型版本——传项目版本会得到 `1001 Fatal error on the server side`。
|
||
|
||
粒度 `segmentation_granularity`:`balanced`(界面「标准」)已实测可用;
|
||
界面另有「粗略 / 精细」两档,但它们的枚举值未确认,需要时用 `--granularity` 传入。
|
||
"""
|
||
|
||
from . import _common
|
||
|
||
NAME = "segment"
|
||
HELP = "智能分割:把模型拆成可编辑的语义部件"
|
||
|
||
# 分割模型自己的版本,实测确认
|
||
SEGMENTATION_MODEL_VERSION = "v2.0-20260430"
|
||
|
||
|
||
def add_arguments(parser):
|
||
_common.add_op_options(parser, "分割结果保存到该路径(可选)")
|
||
parser.add_argument(
|
||
"--granularity", default="balanced",
|
||
help="分割粒度(默认 balanced)",
|
||
)
|
||
|
||
|
||
def run(ctx):
|
||
args = ctx.args
|
||
body = {
|
||
"project_id": args.project,
|
||
"model_version": args.model or SEGMENTATION_MODEL_VERSION,
|
||
"segmentation_granularity": args.granularity,
|
||
}
|
||
data = ctx.client.get_data("POST", "/v2/studio/operation/ai_segmentation", body=body)
|
||
return _common.run_operator(ctx, data, output=args.output, wait=args.wait, label="智能分割")
|