ModelTranslator: 减面 UV 改锐边 seam 展开(质量门回退 smart,--unwrap 可选)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
71416aa12a
commit
4e27b9ae9b
@@ -1,4 +1,4 @@
|
||||
"""FBX 减面 CLI:减到指定三角面数并 Smart UV 重展,输出 <名>_low.fbx。
|
||||
"""FBX 减面 CLI:减到指定三角面数并重展 UV(默认锐边 seam 整岛展开),输出 <名>_low.fbx。
|
||||
用法:python model_decimate.py src/well1500.fbx --tris 5000 [-o dir] [--blender exe]"""
|
||||
import argparse
|
||||
import os
|
||||
@@ -11,6 +11,8 @@ def main():
|
||||
ap.add_argument("input", help="FBX 文件")
|
||||
ap.add_argument("--tris", type=int, required=True, help="目标三角面数")
|
||||
ap.add_argument("-o", "--out", default=None, help="输出目录(默认源文件同目录)")
|
||||
ap.add_argument("--unwrap", choices=("seam", "smart"), default="seam",
|
||||
help="UV 展开方式:seam=锐边接缝整岛展开(默认),smart=Smart UV Project")
|
||||
ap.add_argument("--blender", default=None)
|
||||
args = ap.parse_args()
|
||||
if args.tris <= 0:
|
||||
@@ -21,9 +23,13 @@ def main():
|
||||
outdir = args.out or os.path.dirname(os.path.abspath(args.input))
|
||||
out_fbx = os.path.join(outdir, name + "_low.fbx")
|
||||
s = run_blender_script(blender, "bl_decimate.py",
|
||||
[args.input, out_fbx, str(args.tris)])
|
||||
[args.input, out_fbx, str(args.tris), args.unwrap])
|
||||
print("== %s: %d -> %d 面(目标 %d)-> %s" %
|
||||
(s["src"], s["tris_before"], s["tris_after"], s["target"], out_fbx))
|
||||
u = s["uv"]
|
||||
overlap = "%.1f%%" % (u["overlap"] * 100) if u["overlap"] is not None else "n/a"
|
||||
print(" UV: 模式=%s 岛数=%d 利用率=%.1f%% 翻转=%.1f%% 重叠=%s" %
|
||||
(u["mode"], u["islands"], u["fill"] * 100, u["flipped"] * 100, overlap))
|
||||
for w in s["warnings"]:
|
||||
print(" [警告] %s" % w)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user