"""纹理生成 — (re)texture a model. tripocli texture -p --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="纹理生成")