Skip to content

Commit 8a5f962

Browse files
committed
fix: recompose text-version-stamp so the stamp fills the frame
The stamp sat at 0.663x fill with a dead lower third (fixed-pitch camera at (0,-8.5,1.15)). Reframed to an aim-based camera at (0,-6.0,1.5) tracking the stamp's vertical center — hero fill 0.719x/0.478y (the bar is the widest element, so side margins bind at L/R 0.025; the stamp's constant-width scaling keeps any version-string length in frame, confirmed on 4.5.11's longer "4.5.11 LTS" body at 0.716x). Caption, stamp, and underline bar now balance the frame and the live version string reads unmistakably. Render path gated with check_framing (exit 10); check values unchanged (body, flat vs solid extents, faces=2917). Gate falsified at lens 64 (fill 0.922 FAIL, exit 10) and restored. Pass-2 variant (stale "9.9.9" body) is unmistakable at the reframed size. The pre-existing AgX default and lighter studio variant are left untouched (accepted look, flagged). Signed-off-by: fOuttaMyPaint <TMhospitalitystrategies@gmail.com>
1 parent 0bf0bb2 commit 8a5f962

6 files changed

Lines changed: 71 additions & 12 deletions

File tree

-490 Bytes
Loading
39.1 KB
Loading

‎docs/gallery/text-version-stamp/index.html‎

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ <h2>Run</h2>
194194
blender --background --python text_version_stamp.py -- --output stamp.png
195195
blender --background --python text_version_stamp.py -- --output stamp.png --engine cycles</code></pre>
196196
<p>It exits non-zero on failure (wrong subclass, missing font, body/version mismatch, non-planar flat text, extrude/bevel closed form off, geometry not regenerating, or a <code>to_mesh_clear()</code> reference surviving). The <code>blender-smoke</code> workflow runs the check on Blender 4.5 LTS and 5.1. The render scales the stamp to a constant width, so the frame holds for any version-string length.</p>
197+
<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>
197198
</section>
198199
<section class="detail-section src">
199200
<h2>Source</h2>
@@ -226,6 +227,11 @@ <h2>Source</h2>
226227
&quot;&quot;&quot;</span>
227228
<span class="k">import</span> bpy, sys, os, math, argparse
228229

230+
<span class="c"># Shared Layer 1 framing measurement (render path only) — see gallery_framing.py</span>
231+
sys.path.insert(<span class="n">0</span>, os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir))
232+
sys.dont_write_bytecode = <span class="k">True</span> <span class="c"># keep examples/__pycache__ out of the repo tree</span>
233+
<span class="k">import</span> gallery_framing
234+
229235
EXTRUDE = <span class="n">0.06</span>
230236
BEVEL = <span class="n">0.02</span>
231237
TOL = <span class="n">1e-4</span>
@@ -433,9 +439,18 @@ <h2>Source</h2>
433439
cam_data = bpy.data.cameras.new(<span class="s">&quot;Cam&quot;</span>)
434440
cam_data.lens = <span class="n">50.0</span>
435441
cam = bpy.data.objects.new(<span class="s">&quot;Cam&quot;</span>, cam_data)
436-
cam.location = (<span class="n">0.0</span>, -<span class="n">8.5</span>, <span class="n">1.15</span>)
437-
cam.rotation_euler = (math.radians(<span class="n">86.5</span>), <span class="n">0.0</span>, <span class="n">0.0</span>)
442+
<span class="c"># Reframed: the old (0,-8.5,1.15) fixed 86.5° pitch left the stamp at</span>
443+
<span class="c"># 0.663 fill with a dead lower third; moved in with an aim on the stamp&#x27;s</span>
444+
<span class="c"># vertical center so text, caption, and underline bar balance the frame.</span>
445+
cam.location = (<span class="n">0.0</span>, -<span class="n">6.0</span>, <span class="n">1.5</span>)
438446
scene.collection.objects.link(cam)
447+
aim = bpy.data.objects.new(<span class="s">&quot;Aim&quot;</span>, <span class="k">None</span>)
448+
aim.location = (<span class="n">0.0</span>, <span class="n">0.0</span>, <span class="n">1.05</span>)
449+
scene.collection.objects.link(aim)
450+
con = cam.constraints.new(<span class="s">&#x27;TRACK_TO&#x27;</span>)
451+
con.target = aim
452+
con.track_axis = <span class="s">&#x27;TRACK_NEGATIVE_Z&#x27;</span>
453+
con.up_axis = <span class="s">&#x27;UP_Y&#x27;</span>
439454
scene.camera = cam
440455

441456
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()
@@ -450,8 +465,22 @@ <h2>Source</h2>
450465
scene.render.resolution_y = <span class="n">720</span>
451466
scene.render.image_settings.file_format = <span class="s">&#x27;PNG&#x27;</span>
452467
scene.render.filepath = path
468+
<span class="c"># Layer 1 framing gate (silhouette matte) — exit 10 on violation, before</span>
469+
<span class="c"># the beauty render so a defective composition ships no artifact. The hero</span>
470+
<span class="c"># is the version stamp; caption and underline bar count for margins.</span>
471+
fcode = gallery_framing.check_framing(
472+
scene, cam,
473+
hero=[obj],
474+
elements=[obj, cap_obj, bar],
475+
stage=[floor, wall],
476+
)
477+
<span class="k">if</span> fcode:
478+
<span class="k">return</span> fcode
453479
bpy.ops.render.render(write_still=<span class="k">True</span>)
454-
<span class="k">return</span> os.path.exists(path) <span class="k">and</span> os.path.getsize(path) &gt; <span class="n">0</span>
480+
<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>):
481+
print(<span class="s">&quot;ERROR: render produced no file&quot;</span>, file=sys.stderr)
482+
<span class="k">return</span> <span class="n">9</span>
483+
<span class="k">return</span> <span class="n">0</span>
455484

456485

457486
<span class="k">def</span> main():
@@ -468,9 +497,9 @@ <h2>Source</h2>
468497
<span class="k">return</span> code
469498

470499
<span class="k">if</span> args.output:
471-
<span class="k">if</span> <span class="k">not</span> render_still(obj, os.path.abspath(args.output), args.engine):
472-
print(<span class="s">&quot;ERROR: render produced no file&quot;</span>, file=sys.stderr)
473-
<span class="k">return</span> <span class="n">9</span>
500+
rcode = render_still(obj, os.path.abspath(args.output), args.engine)
501+
<span class="k">if</span> rcode:
502+
<span class="k">return</span> rcode
474503
print(<span class="s">f&quot;</span><span class="s">rendered still </span>{args.output}<span class="s">&quot;</span>)
475504

476505
print(<span class="s">&quot;text-version-stamp OK&quot;</span>)

‎examples/text-version-stamp/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ non-planar flat text, extrude/bevel closed form off, geometry not regenerating,
3838
`to_mesh_clear()` reference surviving). The `blender-smoke` workflow runs the check on
3939
Blender 4.5 LTS and 5.1. The render scales the stamp to a constant width, so the frame
4040
holds for any version-string length.
41+
42+
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.
2.82 KB
Loading

‎examples/text-version-stamp/text_version_stamp.py‎

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
"""
2424
import bpy, sys, os, math, argparse
2525

26+
# Shared Layer 1 framing measurement (render path only) — see gallery_framing.py
27+
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir))
28+
sys.dont_write_bytecode = True # keep examples/__pycache__ out of the repo tree
29+
import gallery_framing
30+
2631
EXTRUDE = 0.06
2732
BEVEL = 0.02
2833
TOL = 1e-4
@@ -230,9 +235,18 @@ def light(name, loc, energy, size, col, rot):
230235
cam_data = bpy.data.cameras.new("Cam")
231236
cam_data.lens = 50.0
232237
cam = bpy.data.objects.new("Cam", cam_data)
233-
cam.location = (0.0, -8.5, 1.15)
234-
cam.rotation_euler = (math.radians(86.5), 0.0, 0.0)
238+
# Reframed: the old (0,-8.5,1.15) fixed 86.5° pitch left the stamp at
239+
# 0.663 fill with a dead lower third; moved in with an aim on the stamp's
240+
# vertical center so text, caption, and underline bar balance the frame.
241+
cam.location = (0.0, -6.0, 1.5)
235242
scene.collection.objects.link(cam)
243+
aim = bpy.data.objects.new("Aim", None)
244+
aim.location = (0.0, 0.0, 1.05)
245+
scene.collection.objects.link(aim)
246+
con = cam.constraints.new('TRACK_TO')
247+
con.target = aim
248+
con.track_axis = 'TRACK_NEGATIVE_Z'
249+
con.up_axis = 'UP_Y'
236250
scene.camera = cam
237251

238252
scene.render.engine = 'CYCLES' if engine == 'cycles' else eevee_engine_id()
@@ -247,8 +261,22 @@ def light(name, loc, energy, size, col, rot):
247261
scene.render.resolution_y = 720
248262
scene.render.image_settings.file_format = 'PNG'
249263
scene.render.filepath = path
264+
# Layer 1 framing gate (silhouette matte) — exit 10 on violation, before
265+
# the beauty render so a defective composition ships no artifact. The hero
266+
# is the version stamp; caption and underline bar count for margins.
267+
fcode = gallery_framing.check_framing(
268+
scene, cam,
269+
hero=[obj],
270+
elements=[obj, cap_obj, bar],
271+
stage=[floor, wall],
272+
)
273+
if fcode:
274+
return fcode
250275
bpy.ops.render.render(write_still=True)
251-
return os.path.exists(path) and os.path.getsize(path) > 0
276+
if not (os.path.exists(path) and os.path.getsize(path) > 0):
277+
print("ERROR: render produced no file", file=sys.stderr)
278+
return 9
279+
return 0
252280

253281

254282
def main():
@@ -265,9 +293,9 @@ def main():
265293
return code
266294

267295
if args.output:
268-
if not render_still(obj, os.path.abspath(args.output), args.engine):
269-
print("ERROR: render produced no file", file=sys.stderr)
270-
return 9
296+
rcode = render_still(obj, os.path.abspath(args.output), args.engine)
297+
if rcode:
298+
return rcode
271299
print(f"rendered still {args.output}")
272300

273301
print("text-version-stamp OK")

0 commit comments

Comments
 (0)