tripocli v2.0.0:Tripo AI 3D 生成与加工 CLI(面向 Agent 与开发者,纯 Python 标准库、零第三方依赖)
覆盖文生 3D、图生 3D、多视图、批量生成,以及重拓扑、绑定、动画、智能分割、 纹理、PBR、智能 UV、部件补全、格式导出与下载。 代码组织:一个功能一个模块(tripo/features/),入口薄壳 tripocli.py。
This commit is contained in:
commit
977f97995a
60 files changed
+5622
No files matched your search
@@ -0,0 +1,51 @@
|
||||
"""多视角图生 3D — multi-view to model.
|
||||
|
||||
tripocli multiview --front f.png --left l.png --right r.png --back b.png --wait -o mv.glb
|
||||
|
||||
Verified against the live API: the ``image`` field must be a list of exactly four
|
||||
audited image objects; fewer than four is rejected with "Invalid parameter(s)".
|
||||
"""
|
||||
|
||||
from . import _common
|
||||
from ..errors import TripoAPIError
|
||||
from ..versions import SMART_MESH_DEFAULT
|
||||
|
||||
NAME = "multiview"
|
||||
HELP = "多视角图片生成 3D 模型(前/左/右/后,必须 4 张)"
|
||||
|
||||
VIEWS = ("front", "left", "right", "back")
|
||||
|
||||
|
||||
def add_arguments(parser):
|
||||
parser.add_argument("--front", required=True, help="前视图本地图片")
|
||||
parser.add_argument("--left", required=True, help="左视图本地图片")
|
||||
parser.add_argument("--right", required=True, help="右视图本地图片")
|
||||
parser.add_argument("--back", required=True, help="后视图本地图片")
|
||||
_common.add_generation_options(parser)
|
||||
_common.add_wait_options(parser, "生成完成后保存的 .glb 路径")
|
||||
|
||||
|
||||
def run(ctx):
|
||||
args = ctx.args
|
||||
paths = [getattr(args, name) for name in VIEWS]
|
||||
|
||||
# Multi-view is a smart-mesh workflow by default; keep the low-poly topology
|
||||
# unless the caller explicitly asked for something else.
|
||||
if not args.smart_mesh and not args.model:
|
||||
args.smart_mesh = True
|
||||
if not args.model:
|
||||
args.model = SMART_MESH_DEFAULT
|
||||
|
||||
images = []
|
||||
for name, path in zip(VIEWS, paths):
|
||||
ctx.out.line(f"📤 上传 {name} 视图: {path}")
|
||||
images.append(ctx.client.upload_image(path))
|
||||
|
||||
if len(images) != 4:
|
||||
raise TripoAPIError("多视角生成需要恰好 4 张图片 (--front/--left/--right/--back)")
|
||||
|
||||
body = _common.generation_body(args)
|
||||
data = ctx.client.get_data(
|
||||
"POST", "/v2/studio/operation/multiview_to_model", body={"image": images, **body}
|
||||
)
|
||||
return _common.finish_single(ctx, data, output=args.output, wait=args.wait)
|
||||
Reference in new issue
Block a user