Files
tripocli/tripo/features/texture.py
T
Mrpzx 977f97995a tripocli v2.0.0:Tripo AI 3D 生成与加工 CLI(面向 Agent 与开发者,纯 Python 标准库、零第三方依赖)
覆盖文生 3D、图生 3D、多视图、批量生成,以及重拓扑、绑定、动画、智能分割、
纹理、PBR、智能 UV、部件补全、格式导出与下载。

代码组织:一个功能一个模块(tripo/features/),入口薄壳 tripocli.py。
2026-10-13 19:22:54 +08:00

43 lines
1.7 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""纹理生成 — (re)texture a model.
tripocli texture -p <project_id> --resolution 2K --wait -o textured.glb
Endpoint ``/operation/texture_model``. Verified live on an *untextured* model:
it needs ``texture_quality``, ``texture_alignment`` and ``part_name_list``.
Note the studio refuses to re-texture a model that already has a texture — for
those, use the retexture flow instead.
"""
from . import _common
NAME = "texture"
HELP = "纹理生成:为模型生成/重绘贴图(2K/4K/8K)"
def add_arguments(parser):
_common.add_op_options(parser, "贴图后的模型保存到该路径(可选)")
parser.add_argument("--resolution", default="2K", choices=["2K", "4K", "8K"], help="贴图分辨率")
parser.add_argument("--quality", default="detailed", choices=["standard", "detailed"], help="贴图质量")
parser.add_argument("--prompt", help="贴图风格提示词(可选)")
parser.add_argument("--keep-light", action="store_true", help="保留原图光影(关闭去光处理)")
def run(ctx):
args = ctx.args
body = {
"project_id": args.project,
"texture_quality": args.quality,
"texture_alignment": "original_image",
"texture_resolution": args.resolution,
"delight": not args.keep_light,
"part_name_list": _common.node_part_name(ctx.client, args.project),
}
model_version = _common.project_version(ctx.client, args.project, args.model)
if model_version:
body["model_version"] = model_version
if args.prompt:
body["prompt"] = args.prompt
data = ctx.client.get_data("POST", "/v2/studio/operation/texture_model", body=body)
return _common.run_operator(ctx, data, output=args.output, wait=args.wait, label="纹理生成")