Skip to content

Commit 0dec7da

Browse files
committed
fix: restage hygiene and origin heroes into the framing band
Both renders sat outside the Layer 1 band in opposite directions, the failure mode the new helper exists to catch. mesh-hygiene-audit was at 0.391 fill (two small valves in a large empty stage); the camera moves from 38mm at (0,-7.8,1.9) to 50mm at (0,-5.0,1.5), landing fill at 0.803x0.733 with all margins >= 0.05. The backlit through-hole and loose-vert bead staging is untouched and no light shape re-enters the frame. prop-origin-transform was at 0.906 fill with the shipped asset cropped at both side edges and the tops; the camera pulls back from (1.15,-5.35,1.45) to (1.15,-5.9,1.55) only until margins clear, landing fill at 0.816x0.678 with margins >= 0.072. Both render paths now call gallery_framing.check_framing before the beauty render (exit 10, no artifact on violation); check code and closed forms are unchanged, and check-only output is byte-identical to main on 5.1.2 and 4.5.11. Contact sheets recomposited against the pinned calibration set. Signed-off-by: fOuttaMyPaint <TMhospitalitystrategies@gmail.com>
1 parent bf63066 commit 0dec7da

13 files changed

Lines changed: 136 additions & 50 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ with the Smooth-by-Angle modifier on 5.1.
668668
</tr>
669669
<tr>
670670
<td width="46%" valign="middle">
671-
<a href="examples/mesh-hygiene-audit/"><img src="examples/mesh-hygiene-audit/preview.webp" alt="Mesh hygiene audit: dual-panel dirty vs clean street electrical pedestal — left orange emissive wireframe with loose-vert bead and DIRTY placard, right teal CLEAN manifold — proving the engine-ingest topology checklist" /></a>
671+
<a href="examples/mesh-hygiene-audit/"><img src="examples/mesh-hygiene-audit/preview.webp" alt="Mesh hygiene audit: dual-panel dirty vs clean brass street valves filling the frame — left with backlit through-hole, emissive boundary tubes and loose-vert bead over a DIRTY placard, right intact CLEAN manifold — proving the engine-ingest topology checklist" /></a>
672672
</td>
673673
<td valign="middle">
674674

@@ -686,7 +686,7 @@ still: DIRTY through-hole + loose-vert bead vs CLEAN manifold (same brass).
686686
</tr>
687687
<tr>
688688
<td width="46%" valign="middle">
689-
<a href="examples/prop-origin-transform/"><img src="examples/prop-origin-transform/preview.webp" alt="Prop origin transform: dual-panel TRAP vs MPI KEEP street pedestals — left bare-parent accessory teleports with expected-seat ghost, right accessory stays put, emissive origin markers at base — proving scale apply, base origin, and matrix_parent_inverse" /></a>
689+
<a href="examples/prop-origin-transform/"><img src="examples/prop-origin-transform/preview.webp" alt="Prop origin transform: dual-panel TRAP vs MPI KEEP street pedestals with margins all around — left bare-parent conduit accessory teleports off its dark mount well, right accessory stays seated — proving scale apply, base origin, and matrix_parent_inverse" /></a>
690690
</td>
691691
<td valign="middle">
692692

382 Bytes
Loading
-7.55 KB
Loading
20.3 KB
Loading
17.4 KB
Loading

‎docs/gallery/mesh-hygiene-audit/index.html‎

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ <h2>Run</h2>
196196
<pre><code>blender --background --python mesh_hygiene_audit.py --
197197
blender --background --python mesh_hygiene_audit.py -- --output hygiene.png
198198
blender --background --python mesh_hygiene_audit.py -- --output hygiene.png --engine cycles</code></pre>
199-
<p>Exits non-zero on failure. The <code>blender-smoke</code> workflow runs the check on Blender 4.5 LTS and 5.1.</p>
199+
<p>Exits non-zero on failure. The <code>blender-smoke</code> workflow runs the check on Blender 4.5 LTS and 5.1. 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>
200200
</section>
201201
<section class="detail-section src">
202202
<h2>Source</h2>
@@ -226,6 +226,11 @@ <h2>Source</h2>
226226
<span class="k">import</span> bpy, bmesh, sys, os, math, argparse
227227
<span class="k">from</span> mathutils <span class="k">import</span> Matrix, Vector
228228

229+
<span class="c"># Shared Layer 1 framing measurement (render path only) — see gallery_framing.py</span>
230+
sys.path.insert(<span class="n">0</span>, os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir))
231+
sys.dont_write_bytecode = <span class="k">True</span> <span class="c"># keep examples/__pycache__ out of the repo tree</span>
232+
<span class="k">import</span> gallery_framing
233+
229234
AREA_EPS = <span class="n">1e-10</span>
230235
VOL_EPS = <span class="n">1e-8</span>
231236

@@ -531,6 +536,7 @@ <h2>Source</h2>
531536
light(<span class="s">&quot;Rim&quot;</span>, (<span class="n">1.5</span>, <span class="n">4.5</span>, <span class="n">3.5</span>), <span class="n">280.0</span>, <span class="n">3.0</span>, (<span class="n">0.6</span>, <span class="n">0.78</span>, <span class="n">1.0</span>), (-<span class="n">55</span>, <span class="n">0</span>, <span class="n">170</span>))
532537
light(<span class="s">&quot;Wedge&quot;</span>, (<span class="n">2.5</span>, <span class="n">5.5</span>, <span class="n">4.0</span>), <span class="n">420.0</span>, <span class="n">6.0</span>, (<span class="n">1.0</span>, <span class="n">0.72</span>, <span class="n">0.42</span>), (-<span class="n">68</span>, <span class="n">0</span>, <span class="n">190</span>))
533538
light(<span class="s">&quot;Glint&quot;</span>, (-<span class="n">2.0</span>, -<span class="n">4.0</span>, <span class="n">3.2</span>), <span class="n">220.0</span>, <span class="n">2.0</span>, (<span class="n">1.0</span>, <span class="n">0.9</span>, <span class="n">0.75</span>), (<span class="n">55</span>, <span class="n">0</span>, -<span class="n">20</span>))
539+
<span class="k">return</span> floor, wall
534540

535541

536542
<span class="k">def</span> _duplicate_mesh_obj(sc, src, name, loc):
@@ -694,10 +700,10 @@ <h2>Source</h2>
694700
<span class="k">for</span> p <span class="k">in</span> right.data.polygons:
695701
p.use_smooth = abs(p.normal.z) &lt; <span class="n">0.85</span>
696702

697-
placard(sc, <span class="s">&quot;DIRTY&quot;</span>, (-<span class="n">0.88</span>, -<span class="n">1.15</span>, <span class="n">0.02</span>), size=<span class="n">0.11</span>)
698-
placard(sc, <span class="s">&quot;CLEAN&quot;</span>, (<span class="n">0.88</span>, -<span class="n">1.15</span>, <span class="n">0.02</span>), size=<span class="n">0.11</span>)
703+
p_dirty = placard(sc, <span class="s">&quot;DIRTY&quot;</span>, (-<span class="n">0.88</span>, -<span class="n">1.15</span>, <span class="n">0.02</span>), size=<span class="n">0.11</span>)
704+
p_clean = placard(sc, <span class="s">&quot;CLEAN&quot;</span>, (<span class="n">0.88</span>, -<span class="n">1.15</span>, <span class="n">0.02</span>), size=<span class="n">0.11</span>)
699705

700-
build_studio(sc)
706+
floor, wall = build_studio(sc)
701707
<span class="c"># Out-of-frame POINT behind DIRTY — aperture glow without a rectangular AREA</span>
702708
<span class="c"># footprint on the floor (Layer 1: no visible light shapes).</span>
703709
hole_ld = bpy.data.lights.new(<span class="s">&quot;HoleBack&quot;</span>, <span class="s">&quot;POINT&quot;</span>)
@@ -718,12 +724,12 @@ <h2>Source</h2>
718724
ob.data.energy = <span class="n">140.0</span>
719725

720726
cam_data = bpy.data.cameras.new(<span class="s">&quot;Cam&quot;</span>)
721-
cam_data.lens = <span class="n">38.0</span>
727+
cam_data.lens = <span class="n">50.0</span>
722728
cam = bpy.data.objects.new(<span class="s">&quot;Cam&quot;</span>, cam_data)
723-
cam.location = (<span class="n">0.0</span>, -<span class="n">7.8</span>, <span class="n">1.9</span>)
729+
cam.location = (<span class="n">0.0</span>, -<span class="n">5.0</span>, <span class="n">1.5</span>)
724730
sc.collection.objects.link(cam)
725731
aim = bpy.data.objects.new(<span class="s">&quot;Aim&quot;</span>, <span class="k">None</span>)
726-
aim.location = (<span class="n">0.0</span>, <span class="n">0.0</span>, <span class="n">0.48</span>)
732+
aim.location = (<span class="n">0.0</span>, <span class="n">0.0</span>, <span class="n">0.55</span>)
727733
sc.collection.objects.link(aim)
728734
tr = cam.constraints.new(<span class="s">&quot;TRACK_TO&quot;</span>)
729735
tr.target = aim
@@ -746,8 +752,22 @@ <h2>Source</h2>
746752
sc.render.image_settings.file_format = <span class="s">&quot;PNG&quot;</span>
747753
sc.render.filepath = path
748754
sc.view_settings.view_transform = <span class="s">&quot;Standard&quot;</span>
755+
<span class="c"># Layer 1 framing gate (silhouette matte) — exit 10 on violation, before</span>
756+
<span class="c"># the beauty render so a defective composition ships no artifact.</span>
757+
overlays = [o <span class="k">for</span> o <span class="k">in</span> sc.objects <span class="k">if</span> o.name.startswith((<span class="s">&quot;LooseBead&quot;</span>, <span class="s">&quot;Bnd&quot;</span>))]
758+
fcode = gallery_framing.check_framing(
759+
sc, cam,
760+
hero=[left, right],
761+
elements=[left, right, p_dirty, p_clean] + overlays,
762+
stage=[floor, wall],
763+
)
764+
<span class="k">if</span> fcode:
765+
<span class="k">return</span> fcode
749766
bpy.ops.render.render(write_still=<span class="k">True</span>)
750-
<span class="k">return</span> os.path.exists(path) <span class="k">and</span> os.path.getsize(path) &gt; <span class="n">0</span>
767+
<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>):
768+
print(<span class="s">&quot;ERROR: render produced no file&quot;</span>, file=sys.stderr)
769+
<span class="k">return</span> <span class="n">9</span>
770+
<span class="k">return</span> <span class="n">0</span>
751771

752772

753773
<span class="k">def</span> build_scene():
@@ -772,9 +792,9 @@ <h2>Source</h2>
772792
<span class="k">return</span> code
773793

774794
<span class="k">if</span> args.output:
775-
<span class="k">if</span> <span class="k">not</span> render_still(ob, os.path.abspath(args.output), args.engine):
776-
print(<span class="s">&quot;ERROR: render produced no file&quot;</span>, file=sys.stderr)
777-
<span class="k">return</span> <span class="n">9</span>
795+
rcode = render_still(ob, os.path.abspath(args.output), args.engine)
796+
<span class="k">if</span> rcode:
797+
<span class="k">return</span> rcode
778798
print(<span class="s">f&quot;</span><span class="s">rendered still </span>{args.output}<span class="s">&quot;</span>)
779799

780800
print(<span class="s">&quot;mesh-hygiene-audit OK&quot;</span>)

‎docs/gallery/prop-origin-transform/index.html‎

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ <h2>Run</h2>
195195
<pre><code>blender --background --python prop_origin_transform.py --
196196
blender --background --python prop_origin_transform.py -- --output origin.png
197197
blender --background --python prop_origin_transform.py -- --output origin.png --engine cycles</code></pre>
198-
<p>Exits non-zero on failure. The <code>blender-smoke</code> workflow runs the check on Blender 4.5 LTS and 5.1.</p>
198+
<p>Exits non-zero on failure. The <code>blender-smoke</code> workflow runs the check on Blender 4.5 LTS and 5.1. 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>
199199
</section>
200200
<section class="detail-section src">
201201
<h2>Source</h2>
@@ -221,6 +221,11 @@ <h2>Source</h2>
221221
<span class="k">import</span> bpy, bmesh, sys, os, math, argparse
222222
<span class="k">from</span> mathutils <span class="k">import</span> Matrix, Vector
223223

224+
<span class="c"># Shared Layer 1 framing measurement (render path only) — see gallery_framing.py</span>
225+
sys.path.insert(<span class="n">0</span>, os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir))
226+
sys.dont_write_bytecode = <span class="k">True</span> <span class="c"># keep examples/__pycache__ out of the repo tree</span>
227+
<span class="k">import</span> gallery_framing
228+
224229
BBOX_EPS = <span class="n">1e-6</span>
225230
WORLD_EPS = <span class="n">1e-5</span>
226231
MPI_EPS = <span class="n">1e-6</span>
@@ -654,6 +659,7 @@ <h2>Source</h2>
654659
light(<span class="s">&quot;Fill&quot;</span>, (<span class="n">5.0</span>, -<span class="n">3.5</span>, <span class="n">2.5</span>), <span class="n">120.0</span>, <span class="n">9.0</span>, (<span class="n">0.75</span>, <span class="n">0.85</span>, <span class="n">1.0</span>), (<span class="n">65</span>, <span class="n">0</span>, <span class="n">50</span>))
655660
light(<span class="s">&quot;Rim&quot;</span>, (<span class="n">1.5</span>, <span class="n">4.5</span>, <span class="n">3.5</span>), <span class="n">280.0</span>, <span class="n">3.0</span>, (<span class="n">0.6</span>, <span class="n">0.78</span>, <span class="n">1.0</span>), (-<span class="n">55</span>, <span class="n">0</span>, <span class="n">170</span>))
656661
light(<span class="s">&quot;Wedge&quot;</span>, (<span class="n">2.5</span>, <span class="n">5.5</span>, <span class="n">4.0</span>), <span class="n">400.0</span>, <span class="n">6.0</span>, (<span class="n">1.0</span>, <span class="n">0.72</span>, <span class="n">0.42</span>), (-<span class="n">68</span>, <span class="n">0</span>, <span class="n">190</span>))
662+
<span class="k">return</span> floor, wall
657663

658664

659665
<span class="k">def</span> render_still(path, engine):
@@ -717,8 +723,8 @@ <h2>Source</h2>
717723
left_front = left.matrix_world @ Vector((<span class="n">0.0</span>, -<span class="n">0.52</span>, <span class="n">0.78</span>))
718724
right_front = right.matrix_world @ Vector((<span class="n">0.0</span>, -<span class="n">0.52</span>, <span class="n">0.78</span>))
719725

720-
make_socket(<span class="s">&quot;TrapSocket&quot;</span>, left_front, sock_empty_m, parent=left)
721-
make_socket(<span class="s">&quot;KeepSocket&quot;</span>, right_front, sock_m, parent=right)
726+
trap_sock = make_socket(<span class="s">&quot;TrapSocket&quot;</span>, left_front, sock_empty_m, parent=left)
727+
keep_sock = make_socket(<span class="s">&quot;KeepSocket&quot;</span>, right_front, sock_m, parent=right)
722728

723729
trap_acc = make_acc(<span class="s">&quot;TrapAcc&quot;</span>, left_front + Vector((<span class="n">0.0</span>, -<span class="n">0.05</span>, <span class="n">0.0</span>)), acc_m)
724730
keep_acc = make_acc(<span class="s">&quot;KeepAcc&quot;</span>, right_front + Vector((<span class="n">0.0</span>, -<span class="n">0.05</span>, <span class="n">0.0</span>)), acc_m)
@@ -748,19 +754,19 @@ <h2>Source</h2>
748754
origin_marker(sc, Vector(left.matrix_world.translation))
749755
origin_marker(sc, Vector(right.matrix_world.translation))
750756

751-
placard(sc, <span class="s">&quot;TRAP&quot;</span>, (<span class="n">0.15</span>, -<span class="n">1.25</span>, <span class="n">0.02</span>), size=<span class="n">0.11</span>)
752-
placard(sc, <span class="s">&quot;MPI KEEP&quot;</span>, (<span class="n">2.1</span>, -<span class="n">1.25</span>, <span class="n">0.02</span>), size=<span class="n">0.11</span>)
757+
p_trap = placard(sc, <span class="s">&quot;TRAP&quot;</span>, (<span class="n">0.15</span>, -<span class="n">1.25</span>, <span class="n">0.02</span>), size=<span class="n">0.11</span>)
758+
p_keep = placard(sc, <span class="s">&quot;MPI KEEP&quot;</span>, (<span class="n">2.1</span>, -<span class="n">1.25</span>, <span class="n">0.02</span>), size=<span class="n">0.11</span>)
753759

754-
build_studio(sc)
760+
floor, wall = build_studio(sc)
755761

756762
cam_data = bpy.data.cameras.new(<span class="s">&quot;Cam&quot;</span>)
757763
cam_data.lens = <span class="n">48.0</span>
758764
cam = bpy.data.objects.new(<span class="s">&quot;Cam&quot;</span>, cam_data)
759-
<span class="c"># Closer for fill; placards still clear the bottom</span>
760-
cam.location = (<span class="n">1.15</span>, -<span class="n">5.35</span>, <span class="n">1.45</span>)
765+
<span class="c"># Pulled back until the framing gate&#x27;s margins clear — not further.</span>
766+
cam.location = (<span class="n">1.15</span>, -<span class="n">5.9</span>, <span class="n">1.55</span>)
761767
sc.collection.objects.link(cam)
762768
aim = bpy.data.objects.new(<span class="s">&quot;Aim&quot;</span>, <span class="k">None</span>)
763-
aim.location = (<span class="n">1.1</span>, <span class="n">0.0</span>, <span class="n">0.70</span>)
769+
aim.location = (<span class="n">1.1</span>, <span class="n">0.0</span>, <span class="n">0.72</span>)
764770
sc.collection.objects.link(aim)
765771
tr = cam.constraints.new(<span class="s">&quot;TRACK_TO&quot;</span>)
766772
tr.target = aim
@@ -783,8 +789,23 @@ <h2>Source</h2>
783789
sc.render.image_settings.file_format = <span class="s">&quot;PNG&quot;</span>
784790
sc.render.filepath = path
785791
sc.view_settings.view_transform = <span class="s">&quot;Standard&quot;</span>
792+
<span class="c"># Layer 1 framing gate (silhouette matte) — exit 10 on violation, before</span>
793+
<span class="c"># the beauty render so a defective composition ships no artifact.</span>
794+
hero = [left, right, trap_acc, keep_acc, trap_sock, keep_sock]
795+
markers = [o <span class="k">for</span> o <span class="k">in</span> sc.objects <span class="k">if</span> o.name.startswith((<span class="s">&quot;OriginBead&quot;</span>, <span class="s">&quot;Axis&quot;</span>))]
796+
fcode = gallery_framing.check_framing(
797+
sc, cam,
798+
hero=hero,
799+
elements=hero + [p_trap, p_keep] + markers,
800+
stage=[floor, wall],
801+
)
802+
<span class="k">if</span> fcode:
803+
<span class="k">return</span> fcode
786804
bpy.ops.render.render(write_still=<span class="k">True</span>)
787-
<span class="k">return</span> os.path.exists(path) <span class="k">and</span> os.path.getsize(path) &gt; <span class="n">0</span>
805+
<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>):
806+
print(<span class="s">&quot;ERROR: render produced no file&quot;</span>, file=sys.stderr)
807+
<span class="k">return</span> <span class="n">9</span>
808+
<span class="k">return</span> <span class="n">0</span>
788809

789810

790811
<span class="k">def</span> main():
@@ -801,9 +822,9 @@ <h2>Source</h2>
801822
<span class="k">return</span> code
802823

803824
<span class="k">if</span> args.output:
804-
<span class="k">if</span> <span class="k">not</span> render_still(os.path.abspath(args.output), args.engine):
805-
print(<span class="s">&quot;ERROR: render produced no file&quot;</span>, file=sys.stderr)
806-
<span class="k">return</span> <span class="n">9</span>
825+
rcode = render_still(os.path.abspath(args.output), args.engine)
826+
<span class="k">if</span> rcode:
827+
<span class="k">return</span> rcode
807828
print(<span class="s">f&quot;</span><span class="s">rendered still </span>{args.output}<span class="s">&quot;</span>)
808829

809830
print(<span class="s">&quot;prop-origin-transform OK&quot;</span>)

‎examples/mesh-hygiene-audit/README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,6 @@ blender --background --python mesh_hygiene_audit.py -- --output hygiene.png --en
5454
```
5555

5656
Exits non-zero on failure. The `blender-smoke` workflow runs the check on
57-
Blender 4.5 LTS and 5.1.
57+
Blender 4.5 LTS and 5.1. The `--output` render path additionally measures
58+
framing against the Layer 1 band via `examples/gallery_framing.py` (exit 10
59+
on violation) before writing the still.

0 commit comments

Comments
 (0)