added ruff for code review

This commit is contained in:
ykcheungab
2026-09-27 19:21:03 +08:00
parent f91ac9d3db
commit e7dfd4f90b
28 changed files with 434 additions and 69 deletions
+9 -5
View File
@@ -33,7 +33,11 @@ def build_patch_geometry(obj, cam, scene, depsgraph, uv_names, nx, ny, edge_samp
output[name]['mesh'].append(uvs[name])
cache = {}
def visible(weights):
# ``cache`` and ``world`` are bound as defaults: ``cache`` is rebound
# for every loop triangle, and a late-bound closure would read the
# next triangle's cache (or the final triangle's, if a probe were
# deferred), yielding a wrong visibility answer per triangle.
def visible(weights, cache=cache, world=world):
nonlocal ray_count
key = tuple(round(w, 12) for w in weights)
if key in cache:
@@ -64,10 +68,10 @@ def build_patch_geometry(obj, cam, scene, depsgraph, uv_names, nx, ny, edge_samp
output[name]['patches'].append((i, j, polygon))
print(f'Evaluated {len(mesh.loop_triangles)} loop triangles; {ray_count} visibility rays; '
f'{len(output[uv_names[0]]["patches"])} local fragments per UV target')
print(f'Visibility sampling: seven probes per fragment; uniformly probed '
f'fragments are accepted or dropped whole, mixed boundary fragments '
f'refine to 1/4 cell or depth 6 and unresolved leaves are rejected. '
f'Sub-sample occluders may be missed; hit tolerance max(1e-7, distance*2e-5).')
print('Visibility sampling: seven probes per fragment; uniformly probed '
'fragments are accepted or dropped whole, mixed boundary fragments '
'refine to 1/4 cell or depth 6 and unresolved leaves are rejected. '
'Sub-sample occluders may be missed; hit tolerance max(1e-7, distance*2e-5).')
return output
finally:
evaluated.to_mesh_clear()