ModelTranslator: 编排层兜底意外异常 + 警告消息收敛(审查修复)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
455ab48273
commit
e78bd04ba8
@@ -31,11 +31,14 @@ def main():
|
||||
s = run_blender_script(blender, "bl_decimate.py",
|
||||
[args.input, out_fbx, str(args.tris), "none"])
|
||||
warnings = list(s["warnings"])
|
||||
# 惰性导入:seam/smart 路径不依赖 rizom 模块
|
||||
from rizom_unwrap import RizomError, find_rizomuv, rizom_unwrap
|
||||
try:
|
||||
rizom_unwrap(out_fbx, find_rizomuv(args.rizom))
|
||||
except RizomError as e:
|
||||
warnings.append("RizomUV 不可用:%s" % e)
|
||||
except Exception as e: # 意外异常也不中断管线:记警告,交 bl_uvgate 回退 seam
|
||||
warnings.append("RizomUV 异常:%r" % e)
|
||||
g = run_blender_script(blender, "bl_uvgate.py", [out_fbx, "rizom"])
|
||||
s["uv"] = g["uv"]
|
||||
s["warnings"] = warnings + g["warnings"]
|
||||
|
||||
@@ -16,7 +16,7 @@ class RizomError(Exception):
|
||||
|
||||
|
||||
def candidate_paths(cli_arg=None, env_val=None, reg_val=None, default=DEFAULT_RIZOM):
|
||||
"""rizomuv.exe 候选路径,优先级:CLI 参数 > 环境变量 > 注册表 > 默认安装位置。"""
|
||||
"""rizomuv.exe 自动发现候选:环境变量 > 注册表 > 默认安装位置(显式 CLI 路径走独占分支不进此链)。"""
|
||||
return [p for p in (cli_arg, env_val, reg_val, default) if p]
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ def rizom_unwrap(fbx_path, exe, map_res=MAP_RES, padding_px=PADDING_PX):
|
||||
last = None
|
||||
for attempt in range(1 + RETRY):
|
||||
if attempt:
|
||||
print("[警告] RizomUV 第 %d 次失败(%s),换新实例重试" % (attempt, last))
|
||||
print("[警告] RizomUV 第 %d 次失败,换新实例重试" % attempt)
|
||||
try:
|
||||
return _unwrap_once(mod, exe, fbx_abs, map_res, pad_uv)
|
||||
except RizomError as e:
|
||||
@@ -124,7 +124,10 @@ def rizom_unwrap(fbx_path, exe, map_res=MAP_RES, padding_px=PADDING_PX):
|
||||
|
||||
|
||||
def _unwrap_once(mod, exe, fbx_abs, map_res, pad_uv):
|
||||
try:
|
||||
link = mod.CRizomUVLink()
|
||||
except Exception as e: # 构造失败也归一为 RizomError,维持"失败只抛 RizomError"契约
|
||||
raise RizomError("RizomUVLink 实例创建失败:%s" % e)
|
||||
try:
|
||||
_call("RunRizomUV", lambda _p: link.RunRizomUV(exePath=exe), None, timeout=60)
|
||||
except RizomError as e:
|
||||
|
||||
Reference in New Issue
Block a user