Skip to content

Commit b1f2651

Browse files
committed
fix: recompose depsgraph-export so the base cube is no longer amputated
The rotated base cube plus the evaluated dome spanned ~5.9 units against a 5.3-unit frame: the cube was cut by the left and bottom edges (fill 0.984x, touch L+B). Reframed to an aim-based camera at (0,-9.6,2.6) tracking (0,0,0.9) — the full pair now sits at fill 0.812x/0.622y with margins L0.069 R0.119 B0.178 T0.200, and the faceted-base vs subsurf-dome comparison that is the contract reads undiminished. Render path gated with check_framing (exit 10); check values unchanged (base=8, eval=98, exported=98). Gate falsified at lens 64 (fill 0.988 FAIL, exit 10) and restored. Pass-2 variant (subsurf cleared) renders two cubes — the broken contract is visible in the reframe. Identical framing numbers on 4.5.11. Signed-off-by: fOuttaMyPaint <TMhospitalitystrategies@gmail.com>
1 parent 40e9600 commit b1f2651

6 files changed

Lines changed: 69 additions & 12 deletions

File tree

-412 Bytes
Loading
-457 KB
Loading

‎docs/gallery/depsgraph-export/index.html‎

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ <h2>Run</h2>
196196
# Write the exported OBJ to a specific path:
197197
blender --background --python depsgraph_export.py -- --obj exported.obj</code></pre>
198198
<p>It exits non-zero on failure (modifier not applied, or exported count ≠ evaluated count). The <code>blender-smoke</code> workflow runs this check on Blender 4.5 LTS and 5.1: base 8 → evaluated/exported 98 vertices with a 2-level SUBSURF.</p>
199+
<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>
199200
</section>
200201
<section class="detail-section src">
201202
<h2>Source</h2>
@@ -219,6 +220,11 @@ <h2>Source</h2>
219220
&quot;&quot;&quot;</span>
220221
<span class="k">import</span> bpy, bmesh, sys, os, math, argparse, tempfile
221222

223+
<span class="c"># Shared Layer 1 framing measurement (render path only) — see gallery_framing.py</span>
224+
sys.path.insert(<span class="n">0</span>, os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir))
225+
sys.dont_write_bytecode = <span class="k">True</span> <span class="c"># keep examples/__pycache__ out of the repo tree</span>
226+
<span class="k">import</span> gallery_framing
227+
222228

223229
<span class="k">def</span> build():
224230
bpy.ops.wm.read_factory_settings(use_empty=<span class="k">True</span>)
@@ -353,9 +359,18 @@ <h2>Source</h2>
353359
cam_data = bpy.data.cameras.new(<span class="s">&quot;Cam&quot;</span>)
354360
cam_data.lens = <span class="n">50.0</span>
355361
cam = bpy.data.objects.new(<span class="s">&quot;Cam&quot;</span>, cam_data)
356-
cam.location = (<span class="n">0.0</span>, -<span class="n">7.4</span>, <span class="n">3.0</span>)
357-
cam.rotation_euler = (math.radians(<span class="n">76</span>), <span class="n">0.0</span>, <span class="n">0.0</span>)
362+
<span class="c"># Reframed: the rotated base cube spans ~5.9 units with the evaluated</span>
363+
<span class="c"># sphere, wider than the old (0,-7.4,3.0) frame — the cube was amputated</span>
364+
<span class="c"># at the left edge. Aim-based framing on the pair&#x27;s center.</span>
365+
cam.location = (<span class="n">0.0</span>, -<span class="n">9.6</span>, <span class="n">2.6</span>)
358366
scene.collection.objects.link(cam)
367+
aim = bpy.data.objects.new(<span class="s">&quot;Aim&quot;</span>, <span class="k">None</span>)
368+
aim.location = (<span class="n">0.0</span>, <span class="n">0.0</span>, <span class="n">0.9</span>)
369+
scene.collection.objects.link(aim)
370+
con = cam.constraints.new(<span class="s">&#x27;TRACK_TO&#x27;</span>)
371+
con.target = aim
372+
con.track_axis = <span class="s">&#x27;TRACK_NEGATIVE_Z&#x27;</span>
373+
con.up_axis = <span class="s">&#x27;UP_Y&#x27;</span>
359374
scene.camera = cam
360375

361376
scene.render.engine = <span class="s">&#x27;CYCLES&#x27;</span> <span class="k">if</span> engine == <span class="s">&#x27;cycles&#x27;</span> <span class="k">else</span> eevee_engine_id()
@@ -373,8 +388,21 @@ <h2>Source</h2>
373388
<span class="c"># AgX would flatten the graphite-vs-green contrast this still hinges on</span>
374389
<span class="c"># (docs/VISUAL-STYLE.md)</span>
375390
scene.view_settings.view_transform = <span class="s">&#x27;Standard&#x27;</span>
391+
<span class="c"># Layer 1 framing gate (silhouette matte) — exit 10 on violation, before</span>
392+
<span class="c"># the beauty render so a defective composition ships no artifact.</span>
393+
fcode = gallery_framing.check_framing(
394+
scene, cam,
395+
hero=[base_obj, obj],
396+
elements=[base_obj, obj],
397+
stage=[floor, wall],
398+
)
399+
<span class="k">if</span> fcode:
400+
<span class="k">return</span> fcode
376401
bpy.ops.render.render(write_still=<span class="k">True</span>)
377-
<span class="k">return</span> os.path.exists(path) <span class="k">and</span> os.path.getsize(path) &gt; <span class="n">0</span>
402+
<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>):
403+
print(<span class="s">&quot;ERROR: render produced no file&quot;</span>, file=sys.stderr)
404+
<span class="k">return</span> <span class="n">6</span>
405+
<span class="k">return</span> <span class="n">0</span>
378406

379407

380408
<span class="k">def</span> main():
@@ -393,9 +421,9 @@ <h2>Source</h2>
393421
<span class="k">return</span> code
394422

395423
<span class="k">if</span> args.output:
396-
<span class="k">if</span> <span class="k">not</span> render_still(obj, os.path.abspath(args.output), args.engine):
397-
print(<span class="s">&quot;ERROR: render produced no file&quot;</span>, file=sys.stderr)
398-
<span class="k">return</span> <span class="n">6</span>
424+
rcode = render_still(obj, os.path.abspath(args.output), args.engine)
425+
<span class="k">if</span> rcode:
426+
<span class="k">return</span> rcode
399427
print(<span class="s">f&quot;</span><span class="s">rendered still </span>{args.output}<span class="s">&quot;</span>)
400428

401429
print(<span class="s">&quot;depsgraph-export OK&quot;</span>)

‎examples/depsgraph-export/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ blender --background --python depsgraph_export.py -- --obj exported.obj
2828
It exits non-zero on failure (modifier not applied, or exported count ≠ evaluated count). The
2929
`blender-smoke` workflow runs this check on Blender 4.5 LTS and 5.1: base 8 → evaluated/exported
3030
98 vertices with a 2-level SUBSURF.
31+
32+
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.

‎examples/depsgraph-export/depsgraph_export.py‎

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
"""
1515
import bpy, bmesh, sys, os, math, argparse, tempfile
1616

17+
# Shared Layer 1 framing measurement (render path only) — see gallery_framing.py
18+
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir))
19+
sys.dont_write_bytecode = True # keep examples/__pycache__ out of the repo tree
20+
import gallery_framing
21+
1722

1823
def build():
1924
bpy.ops.wm.read_factory_settings(use_empty=True)
@@ -148,9 +153,18 @@ def light(name, loc, energy, size, col, rot):
148153
cam_data = bpy.data.cameras.new("Cam")
149154
cam_data.lens = 50.0
150155
cam = bpy.data.objects.new("Cam", cam_data)
151-
cam.location = (0.0, -7.4, 3.0)
152-
cam.rotation_euler = (math.radians(76), 0.0, 0.0)
156+
# Reframed: the rotated base cube spans ~5.9 units with the evaluated
157+
# sphere, wider than the old (0,-7.4,3.0) frame — the cube was amputated
158+
# at the left edge. Aim-based framing on the pair's center.
159+
cam.location = (0.0, -9.6, 2.6)
153160
scene.collection.objects.link(cam)
161+
aim = bpy.data.objects.new("Aim", None)
162+
aim.location = (0.0, 0.0, 0.9)
163+
scene.collection.objects.link(aim)
164+
con = cam.constraints.new('TRACK_TO')
165+
con.target = aim
166+
con.track_axis = 'TRACK_NEGATIVE_Z'
167+
con.up_axis = 'UP_Y'
154168
scene.camera = cam
155169

156170
scene.render.engine = 'CYCLES' if engine == 'cycles' else eevee_engine_id()
@@ -168,8 +182,21 @@ def light(name, loc, energy, size, col, rot):
168182
# AgX would flatten the graphite-vs-green contrast this still hinges on
169183
# (docs/VISUAL-STYLE.md)
170184
scene.view_settings.view_transform = 'Standard'
185+
# Layer 1 framing gate (silhouette matte) — exit 10 on violation, before
186+
# the beauty render so a defective composition ships no artifact.
187+
fcode = gallery_framing.check_framing(
188+
scene, cam,
189+
hero=[base_obj, obj],
190+
elements=[base_obj, obj],
191+
stage=[floor, wall],
192+
)
193+
if fcode:
194+
return fcode
171195
bpy.ops.render.render(write_still=True)
172-
return os.path.exists(path) and os.path.getsize(path) > 0
196+
if not (os.path.exists(path) and os.path.getsize(path) > 0):
197+
print("ERROR: render produced no file", file=sys.stderr)
198+
return 6
199+
return 0
173200

174201

175202
def main():
@@ -188,9 +215,9 @@ def main():
188215
return code
189216

190217
if args.output:
191-
if not render_still(obj, os.path.abspath(args.output), args.engine):
192-
print("ERROR: render produced no file", file=sys.stderr)
193-
return 6
218+
rcode = render_still(obj, os.path.abspath(args.output), args.engine)
219+
if rcode:
220+
return rcode
194221
print(f"rendered still {args.output}")
195222

196223
print("depsgraph-export OK")
-340 Bytes
Loading

0 commit comments

Comments
 (0)