Skip to content

Commit 2f4bcf4

Browse files
committed
fix: recompose vertex-weight-limit so the arm base clears the frame
The mech arm's round base was cropped by the bottom edge and the subject drifted right-of-center with dead space (touch B, fill 0.247x/0.861y). Reframed more frontal at (4.6,-8.2,2.3) with the aim dropped 1.5 -> 1.25, landing fill 0.206x/0.867y with margins L0.378 R0.416 B0.050 T0.083 — base fully in frame, lean balanced, teal pruned-weight zones and claw still legible. The x-fill stays narrow by subject geometry; the band's single-axis rule is met on y. Render path gated with check_framing (exit 10); check values unchanged (influence counts, unit sums, pose preservation, LBS error all print as before). Gate falsified at lens 66 (fill 1.000 FAIL, exit 10) and restored. Pass-2 variant (no prune) is pixel-identical by design — pruning preserves the pose, so the influence-cap contract is numeric and the still witnesses the rig and zones; reported as such. Identical framing numbers on 4.5.11. Signed-off-by: fOuttaMyPaint <TMhospitalitystrategies@gmail.com>
1 parent b1f2651 commit 2f4bcf4

6 files changed

Lines changed: 57 additions & 12 deletions

File tree

-168 Bytes
Loading
-122 Bytes
Loading

‎docs/gallery/vertex-weight-limit/index.html‎

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ <h2>Run</h2>
197197
blender --background --python vertex_weight_limit.py -- --output arm.png
198198
blender --background --python vertex_weight_limit.py -- --output arm.png --engine cycles</code></pre>
199199
<p>It exits non-zero on failure (vacuous authoring, a vertex over the cap, broken weight sums, pose damaged by pruning, LBS drift, or a moved Root mount). The <code>blender-smoke</code> workflow runs the check on Blender 4.5 LTS and 5.1.</p>
200+
<p>The <code>--output</code> render path additionally measures framing against the Layer 1 band via <code>examples/gallery_framing.py</code> (exit 10 on violation) before writing the still.</p>
200201
</section>
201202
<section class="detail-section src">
202203
<h2>Source</h2>
@@ -238,6 +239,11 @@ <h2>Source</h2>
238239
<span class="k">import</span> bpy, bmesh, sys, os, math, argparse
239240
<span class="k">import</span> mathutils
240241

242+
<span class="c"># Shared Layer 1 framing measurement (render path only) — see gallery_framing.py</span>
243+
sys.path.insert(<span class="n">0</span>, os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir))
244+
sys.dont_write_bytecode = <span class="k">True</span> <span class="c"># keep examples/__pycache__ out of the repo tree</span>
245+
<span class="k">import</span> gallery_framing
246+
241247
SIDES = <span class="n">32</span>
242248
MAX_INFLUENCES = <span class="n">4</span> <span class="c"># the engine constraint being witnessed</span>
243249
BUMP_R = <span class="n">1.8</span> <span class="c"># flex-cuff blend support; guarantees 5 pre-limit</span>
@@ -625,10 +631,13 @@ <h2>Source</h2>
625631
cam_data = bpy.data.cameras.new(<span class="s">&quot;Cam&quot;</span>)
626632
cam_data.lens = <span class="n">52.0</span>
627633
cam = bpy.data.objects.new(<span class="s">&quot;Cam&quot;</span>, cam_data)
628-
cam.location = (<span class="n">5.8</span>, -<span class="n">6.9</span>, <span class="n">2.2</span>)
634+
<span class="c"># Reframed: the old (5.8,-6.9,2.2) aim 1.5 cropped the base at the bottom</span>
635+
<span class="c"># edge and left the subject adrift right-of-center; slightly more frontal</span>
636+
<span class="c"># and lower-aimed so the full base and the lean both sit in frame.</span>
637+
cam.location = (<span class="n">4.6</span>, -<span class="n">8.2</span>, <span class="n">2.3</span>)
629638
scene.collection.objects.link(cam)
630639
target = bpy.data.objects.new(<span class="s">&quot;Aim&quot;</span>, <span class="k">None</span>)
631-
target.location = (<span class="n">0.45</span>, <span class="n">0.0</span>, <span class="n">1.5</span>)
640+
target.location = (<span class="n">0.35</span>, <span class="n">0.0</span>, <span class="n">1.25</span>)
632641
scene.collection.objects.link(target)
633642
con = cam.constraints.new(<span class="s">&#x27;TRACK_TO&#x27;</span>)
634643
con.target = target
@@ -649,8 +658,21 @@ <h2>Source</h2>
649658
<span class="c"># AgX would wash the hazard orange and teal accent toward pastel</span>
650659
<span class="c"># (docs/VISUAL-STYLE.md)</span>
651660
scene.view_settings.view_transform = <span class="s">&#x27;Standard&#x27;</span>
661+
<span class="c"># Layer 1 framing gate (silhouette matte) — exit 10 on violation, before</span>
662+
<span class="c"># the beauty render so a defective composition ships no artifact.</span>
663+
fcode = gallery_framing.check_framing(
664+
scene, cam,
665+
hero=[obj],
666+
elements=[obj],
667+
stage=[floor, wall],
668+
)
669+
<span class="k">if</span> fcode:
670+
<span class="k">return</span> fcode
652671
bpy.ops.render.render(write_still=<span class="k">True</span>)
653-
<span class="k">return</span> os.path.exists(path) <span class="k">and</span> os.path.getsize(path) &gt; <span class="n">0</span>
672+
<span class="k">if</span> <span class="k">not</span> (os.path.exists(path) <span class="k">and</span> os.path.getsize(path) &gt; <span class="n">0</span>):
673+
print(<span class="s">&quot;ERROR: render produced no file&quot;</span>, file=sys.stderr)
674+
<span class="k">return</span> <span class="n">10</span>
675+
<span class="k">return</span> <span class="n">0</span>
654676

655677

656678
<span class="k">def</span> main():
@@ -674,9 +696,9 @@ <h2>Source</h2>
674696
<span class="k">return</span> code
675697

676698
<span class="k">if</span> args.output:
677-
<span class="k">if</span> <span class="k">not</span> render_still(obj, os.path.abspath(args.output), args.engine):
678-
print(<span class="s">&quot;ERROR: render produced no file&quot;</span>, file=sys.stderr)
679-
<span class="k">return</span> <span class="n">10</span>
699+
rcode = render_still(obj, os.path.abspath(args.output), args.engine)
700+
<span class="k">if</span> rcode:
701+
<span class="k">return</span> rcode
680702
print(<span class="s">f&quot;</span><span class="s">rendered still </span>{args.output}<span class="s">&quot;</span>)
681703

682704
print(<span class="s">&quot;vertex-weight-limit OK&quot;</span>)

‎examples/vertex-weight-limit/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,5 @@ blender --background --python vertex_weight_limit.py -- --output arm.png --engin
5757
It exits non-zero on failure (vacuous authoring, a vertex over the cap, broken
5858
weight sums, pose damaged by pruning, LBS drift, or a moved Root mount). The
5959
`blender-smoke` workflow runs the check on Blender 4.5 LTS and 5.1.
60+
61+
The `--output` render path additionally measures framing against the Layer 1 band via `examples/gallery_framing.py` (exit 10 on violation) before writing the still.
-506 Bytes
Loading

‎examples/vertex-weight-limit/vertex_weight_limit.py‎

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
import bpy, bmesh, sys, os, math, argparse
3333
import mathutils
3434

35+
# Shared Layer 1 framing measurement (render path only) — see gallery_framing.py
36+
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir))
37+
sys.dont_write_bytecode = True # keep examples/__pycache__ out of the repo tree
38+
import gallery_framing
39+
3540
SIDES = 32
3641
MAX_INFLUENCES = 4 # the engine constraint being witnessed
3742
BUMP_R = 1.8 # flex-cuff blend support; guarantees 5 pre-limit
@@ -419,10 +424,13 @@ def light(name, loc, energy, size, col, rot):
419424
cam_data = bpy.data.cameras.new("Cam")
420425
cam_data.lens = 52.0
421426
cam = bpy.data.objects.new("Cam", cam_data)
422-
cam.location = (5.8, -6.9, 2.2)
427+
# Reframed: the old (5.8,-6.9,2.2) aim 1.5 cropped the base at the bottom
428+
# edge and left the subject adrift right-of-center; slightly more frontal
429+
# and lower-aimed so the full base and the lean both sit in frame.
430+
cam.location = (4.6, -8.2, 2.3)
423431
scene.collection.objects.link(cam)
424432
target = bpy.data.objects.new("Aim", None)
425-
target.location = (0.45, 0.0, 1.5)
433+
target.location = (0.35, 0.0, 1.25)
426434
scene.collection.objects.link(target)
427435
con = cam.constraints.new('TRACK_TO')
428436
con.target = target
@@ -443,8 +451,21 @@ def light(name, loc, energy, size, col, rot):
443451
# AgX would wash the hazard orange and teal accent toward pastel
444452
# (docs/VISUAL-STYLE.md)
445453
scene.view_settings.view_transform = 'Standard'
454+
# Layer 1 framing gate (silhouette matte) — exit 10 on violation, before
455+
# the beauty render so a defective composition ships no artifact.
456+
fcode = gallery_framing.check_framing(
457+
scene, cam,
458+
hero=[obj],
459+
elements=[obj],
460+
stage=[floor, wall],
461+
)
462+
if fcode:
463+
return fcode
446464
bpy.ops.render.render(write_still=True)
447-
return os.path.exists(path) and os.path.getsize(path) > 0
465+
if not (os.path.exists(path) and os.path.getsize(path) > 0):
466+
print("ERROR: render produced no file", file=sys.stderr)
467+
return 10
468+
return 0
448469

449470

450471
def main():
@@ -468,9 +489,9 @@ def main():
468489
return code
469490

470491
if args.output:
471-
if not render_still(obj, os.path.abspath(args.output), args.engine):
472-
print("ERROR: render produced no file", file=sys.stderr)
473-
return 10
492+
rcode = render_still(obj, os.path.abspath(args.output), args.engine)
493+
if rcode:
494+
return rcode
474495
print(f"rendered still {args.output}")
475496

476497
print("vertex-weight-limit OK")

0 commit comments

Comments
 (0)