ModelTranslator: _do_unwrap 文档诚实化 + smart 回退警告带指标(评审 Minor)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
428a915b29
commit
8fe0a3f7ae
@@ -289,9 +289,10 @@ def _uvpm_repack(obj, warnings):
|
||||
|
||||
|
||||
def _do_unwrap(obj, mode, warnings):
|
||||
"""按模式展开:seam 首选 66° 过门即用;否则扫 SEAM_ANGLE_SWEEP,
|
||||
取过门且岛数最少者(重跑恢复其 UV);全失败退 smart。排布 UVPM4 增强,
|
||||
只在最终 UV 上跑一次,失败保底内置 pack。返回 uv 指标 dict(含 mode)。"""
|
||||
"""按模式展开:seam 从 SEAM_ANGLE_DEG 起降序扫 SEAM_ANGLE_SWEEP,首个过门者即选并停扫
|
||||
——岛数随角度降单调增,故首个过门者已是过门候选里岛数最少的(pick_best_candidate 据此在
|
||||
候选集取岛数最少者,与早停一致;重跑分支为防御:早停下 best 恒为最后一档,通常不触发);
|
||||
全失败退 smart。排布 UVPM4 增强,只在最终 UV 上跑一次,失败保底内置 pack。返回 uv 指标 dict(含 mode)。"""
|
||||
if mode == "seam":
|
||||
angles = [SEAM_ANGLE_DEG] + list(SEAM_ANGLE_SWEEP)
|
||||
candidates = []
|
||||
@@ -311,8 +312,12 @@ def _do_unwrap(obj, mode, warnings):
|
||||
m = _collect_uv_metrics(obj)
|
||||
m["mode"] = uvpm_mode_label("seam@%d" % int(best["angle"]), uvpm)
|
||||
return m
|
||||
warnings.append("所有 seam 角度(%s)均未过质量门,回退 smart_project"
|
||||
% "、".join("%d°" % int(a) for a in angles))
|
||||
detail = "、".join(
|
||||
"%d°(翻转%.1f%% 重叠%s)" % (
|
||||
int(c["angle"]), c["flipped"] * 100,
|
||||
"%.1f%%" % (c["overlap"] * 100) if c["overlap"] is not None else "未知")
|
||||
for c in candidates)
|
||||
warnings.append("所有 seam 角度均未过质量门(%s),回退 smart_project" % detail)
|
||||
mode = "smart_fallback"
|
||||
_unwrap_smart(obj)
|
||||
uvpm = _uvpm_repack(obj, warnings)
|
||||
|
||||
Reference in New Issue
Block a user