覆盖文生 3D、图生 3D、多视图、批量生成,以及重拓扑、绑定、动画、智能分割、 纹理、PBR、智能 UV、部件补全、格式导出与下载。 代码组织:一个功能一个模块(tripo/features/),入口薄壳 tripocli.py。
30 lines
970 B
Python
30 lines
970 B
Python
"""单图生 3D — image to model.
|
|
|
|
tripocli image -i ./chair.png --wait -o chair.glb
|
|
|
|
The local file is uploaded straight to S3 with SigV4 and then audited; both steps
|
|
are required before the generation endpoint accepts the image.
|
|
"""
|
|
|
|
from . import _common
|
|
|
|
NAME = "image"
|
|
HELP = "单张图片生成 3D 模型(图生 3D)"
|
|
|
|
|
|
def add_arguments(parser):
|
|
parser.add_argument("-i", "--image", required=True, help="本地图片路径 (png/jpg/webp)")
|
|
_common.add_generation_options(parser)
|
|
_common.add_wait_options(parser, "生成完成后保存的 .glb 路径")
|
|
|
|
|
|
def run(ctx):
|
|
args = ctx.args
|
|
ctx.out.line(f"📤 上传并审核图片: {args.image}")
|
|
image = ctx.client.upload_image(args.image)
|
|
body = _common.generation_body(args)
|
|
data = ctx.client.get_data(
|
|
"POST", "/v2/studio/operation/image_to_model", body={"image": image, **body}
|
|
)
|
|
return _common.finish_single(ctx, data, output=args.output, wait=args.wait)
|