Skip to content

Commit e457a12

Browse files
feat: add CLI falsifiers and exit tables to the remaining twelve examples
Closes the last behavior gap in the retrofit: every example now has a flag that makes an existing assertion fail, without touching Grease Pencil version shims or changing any exit code value. Signed-off-by: TMHSDigital <154358121+TMHSDigital@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 06edfe3 commit e457a12

24 files changed

Lines changed: 454 additions & 87 deletions

File tree

‎examples/compositor-glare/README.md‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,29 @@ absence of any EEVEE bloom toggle.
2929
# Cheap correctness check (two tiny renders) — the CI check:
3030
blender --background --python compositor_glare.py --
3131

32+
# Falsifier: Threshold=10.0. Must exit non-zero (Threshold==1.0).
33+
blender --background --python compositor_glare.py -- --threshold-high
34+
3235
# Also render a still (EEVEE on a GPU host; use --engine cycles on GPU-less hosts):
3336
blender --background --python compositor_glare.py -- --output rings.png
3437
blender --background --python compositor_glare.py -- --output rings.png --engine cycles
3538
```
3639

37-
It exits non-zero on failure (wrong tree plumbing, wrong Glare configuration, a
38-
missing or non-falling halo, or halo pixels that appear without the compositor).
39-
The `blender-smoke` workflow runs the check on Blender 5.2 LTS and 4.5 LTS.
40+
## Exit codes
41+
42+
Per-script sequential checks. `9` is a valid check code; there is no rule
43+
against it.
44+
45+
| Code | Meaning |
46+
| --- | --- |
47+
| 0 | Success |
48+
| 1 | Uncaught exception (FATAL wrapper) |
49+
| 2 | argparse / usage |
50+
| 3 | Compositor tree / Glare / Threshold / link-chain contract (`--threshold-high` lands here) |
51+
| 4 | Check render missing, tube dark, no halo, or halo does not fall off |
52+
| 5 | Halo present with compositing off |
53+
| 6 | `--output` produced no file |
54+
55+
The `blender-smoke` workflow runs the check on Blender 5.2 LTS and 4.5 LTS
56+
(5.1 on the weekly cron, the `needs-5.1` PR label, or manual dispatch).
57+
Smoke does not pass `--output` or `--threshold-high`.

‎examples/compositor-glare/compositor_glare.py‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,17 @@
1717
the ring silhouette, falls off strictly with distance, and vanishes entirely
1818
when `scene.render.use_compositing` is off.
1919
20+
``--threshold-high`` sets the shared ``Threshold`` input to 10.0 and still
21+
asserts it equals 1.0. That is the falsifier (``--same-axis`` in
22+
export-preset-axis). The 4.x/5.x Type-menu shim is untouched.
23+
2024
By default it runs only the correctness check (two 96x54 single-sample Cycles
2125
renders, compositor on vs off) — the CI smoke check. Pass --output to also
2226
render a still:
2327
24-
blender --background --python compositor_glare.py -- # check only
25-
blender --background --python compositor_glare.py -- --output n.png # + render
28+
blender --background --python compositor_glare.py -- # check only
29+
blender --background --python compositor_glare.py -- --threshold-high # must fail
30+
blender --background --python compositor_glare.py -- --output n.png # + render
2631
"""
2732
import bpy
2833
import sys
@@ -337,9 +342,14 @@ def main():
337342
help="render engine for --output (cycles for GPU-less hosts)")
338343
p.add_argument("--samples", type=int, default=32, help="--output sample count")
339344
p.add_argument("--width", type=int, default=1280, help="--output width; height is width*9/16")
345+
p.add_argument("--threshold-high", action="store_true",
346+
help="falsifier: Threshold=10.0, still assert Threshold==1.0")
340347
args = p.parse_args(argv)
341348

342349
scene, tree, glare = build_scene()
350+
if args.threshold_high:
351+
glare.inputs['Threshold'].default_value = 10.0
352+
343353
code = check_structure(scene, tree, glare)
344354
if code:
345355
return code

‎examples/curve-bevel-arc/README.md‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,34 @@ and that the depsgraph-evaluated mesh has the deterministic topology (1044 verts
1717
# Cheap correctness check (no render) — the CI check:
1818
blender --background --python curve_bevel_arc.py --
1919

20+
# Falsifier: uncapped tube. Must exit non-zero (use_fill_caps).
21+
blender --background --python curve_bevel_arc.py -- --no-caps
22+
2023
# Also render a still (EEVEE on a GPU host; use --engine cycles on GPU-less hosts):
2124
blender --background --python curve_bevel_arc.py -- --output arc.png
2225
blender --background --python curve_bevel_arc.py -- --output arc.png --engine cycles
2326
```
2427

25-
It exits non-zero on failure (wrong point count, bevel, caps, topology, or span).
26-
The `blender-smoke` workflow runs the check on Blender 5.2 LTS and 4.5 LTS.
28+
## Exit codes
29+
30+
Per-script sequential checks. `9` is a valid check code; there is no rule
31+
against it. `10` is also the shared framing helper.
32+
33+
| Code | Meaning |
34+
| --- | --- |
35+
| 0 | Success |
36+
| 1 | Uncaught exception (FATAL wrapper) |
37+
| 2 | argparse / usage |
38+
| 3 | Spline type is not BEZIER |
39+
| 4 | Bezier point count ≠ 8 |
40+
| 5 | `bevel_depth` ≠ 0.15 |
41+
| 6 | `use_fill_caps` is False (`--no-caps` lands here) |
42+
| 7 | Evaluated vert/face count off measured tessellation |
43+
| 8 | Tube does not rest on the floor |
44+
| 9 | Tube height ≠ 2 × bevel |
45+
| 10 | X span off closed form; also gallery framing violation |
46+
| 11 | `--output` produced no file |
2747

28-
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.
48+
The `blender-smoke` workflow runs the check on Blender 5.2 LTS and 4.5 LTS
49+
(5.1 on the weekly cron, the `needs-5.1` PR label, or manual dispatch).
50+
Smoke does not pass `--output` or `--no-caps`.

‎examples/curve-bevel-arc/curve_bevel_arc.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
99
has no simple closed form, so those two constants pin today's behavior (see
1010
EXPECT_VERTS below for how to re-measure if a future Blender retessellates).
1111
12+
``--no-caps`` leaves ``use_fill_caps`` False and still asserts the ends are
13+
capped. That is the falsifier (``--same-axis`` in export-preset-axis).
14+
1215
By default it runs only the correctness check (no render) — the CI smoke
1316
check. Pass --output to also render a still:
1417
1518
blender --background --python curve_bevel_arc.py -- # check only
19+
blender --background --python curve_bevel_arc.py -- --no-caps # must fail
1620
blender --background --python curve_bevel_arc.py -- --output c.png # + render
1721
"""
1822
import bpy, bmesh, sys, os, math, argparse
@@ -35,14 +39,15 @@
3539
EXPECT_FACES = 1028
3640

3741

38-
def build():
42+
def build(no_caps=False):
3943
bpy.ops.wm.read_factory_settings(use_empty=True)
4044
curve = bpy.data.curves.new("Arc", 'CURVE')
4145
curve.dimensions = '3D'
4246
curve.bevel_depth = BEVEL
4347
curve.bevel_resolution = BEVEL_RES
4448
curve.resolution_u = RES_U
45-
curve.use_fill_caps = True # solid ends — not a hollow pipe
49+
curve.use_fill_caps = not no_caps # solid ends — not a hollow pipe
50+
4651

4752
spline = curve.splines.new('BEZIER')
4853
spline.bezier_points.add(N_POINTS - 1) # one point exists already
@@ -231,9 +236,12 @@ def main():
231236
p.add_argument("--output", default=None, help="optional: render a still PNG here")
232237
p.add_argument("--engine", default="eevee", choices=("eevee", "cycles"),
233238
help="render engine for --output (cycles for GPU-less hosts)")
239+
p.add_argument("--no-caps", action="store_true",
240+
help="falsifier: use_fill_caps=False, still assert caps")
234241
args = p.parse_args(argv)
235242

236-
obj = build()
243+
obj = build(no_caps=args.no_caps)
244+
237245
code = check(obj)
238246
if code:
239247
return code

‎examples/gp-lineart-contour/README.md‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,31 @@ not zeroing strokes (exit 6), flags-off or restore failure (exit 7).
3636
# Depsgraph contour check — the CI check:
3737
blender --background --python gp_lineart_contour.py --
3838

39+
# Falsifier: use_contour off. Must exit non-zero.
40+
blender --background --python gp_lineart_contour.py -- --no-contour
41+
3942
# Also render the gallery still:
4043
blender --background --python gp_lineart_contour.py -- --output lineart.png
4144
```
4245

43-
It exits non-zero on failure. The `blender-smoke` workflow runs the check on
44-
Blender 5.2 LTS and 4.5 LTS.
46+
## Exit codes
47+
48+
Per-script sequential checks. `9` is a valid check code; there is no rule
49+
against it. `10` is the shared framing helper.
50+
51+
| Code | Meaning |
52+
| --- | --- |
53+
| 0 | Success |
54+
| 1 | Uncaught exception (FATAL wrapper) |
55+
| 2 | argparse / usage; also GPv3 collection address contract |
56+
| 3 | LINEART `thickness` / `radius` trap for this Blender |
57+
| 4 | LINEART type, source, or `use_contour` (`--no-contour` lands here) |
58+
| 5 | Evaluated contour too thin |
59+
| 6 | Cleared `source_object` still produced strokes |
60+
| 7 | Contour+crease off still produced strokes, or restore failed |
61+
| 8 | `--output` produced no file |
62+
| 10 | Gallery framing violation |
4563

46-
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.
64+
The `blender-smoke` workflow runs the check on Blender 5.2 LTS and 4.5 LTS
65+
(5.1 on the weekly cron, the `needs-5.1` PR label, or manual dispatch).
66+
Smoke does not pass `--output` or `--no-contour`.

‎examples/gp-lineart-contour/gp_lineart_contour.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@
1717
The check evaluates the modifier through the depsgraph (no bake required)
1818
and asserts stroke/point lower bounds against the known failure modes above.
1919
20+
``--no-contour`` clears ``use_contour`` after the modifier is built and
21+
still asserts it is True. That is the falsifier (``--same-axis`` in
22+
export-preset-axis). The GPv3 address shim and the thickness/radius trap
23+
are untouched.
24+
2025
By default it runs the correctness check only. Pass --output to render:
2126
2227
blender --background --python gp_lineart_contour.py --
28+
blender --background --python gp_lineart_contour.py -- --no-contour
2329
blender --background --python gp_lineart_contour.py -- --output l.png
2430
"""
2531
import bpy, bmesh, sys, os, math, argparse
@@ -415,10 +421,18 @@ def main():
415421
choices=("eevee", "cycles"),
416422
help="render engine for --output",
417423
)
424+
p.add_argument(
425+
"--no-contour",
426+
action="store_true",
427+
help="falsifier: use_contour=False, still assert True",
428+
)
418429
args = p.parse_args(argv)
419430

420431
print(f"binary version: {bpy.app.version} ({bpy.app.version_string})")
421432
sc, crystal, la_ob, mod = build_scene()
433+
if args.no_contour:
434+
mod.use_contour = False
435+
422436
code = check(sc, crystal, la_ob, mod)
423437
if code:
424438
return code

‎examples/grease-pencil-rosette/README.md‎

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,32 @@ raw `position` attribute buffer via `foreach_get`.
2727
# Cheap correctness check (no render) — the CI check:
2828
blender --background --python grease_pencil_rosette.py --
2929

30+
# Falsifier: open strokes. Must exit non-zero (cyclic).
31+
blender --background --python grease_pencil_rosette.py -- --open-strokes
32+
3033
# Also render a still (EEVEE on a GPU host; use --engine cycles on GPU-less hosts):
3134
blender --background --python grease_pencil_rosette.py -- --output rosette.png
3235
blender --background --python grease_pencil_rosette.py -- --output rosette.png --engine cycles
3336
```
3437

35-
It exits non-zero on failure (wrong version gate, structural mismatch, missing attribute
36-
layers, or attribute-buffer deviation from the closed form). The `blender-smoke` workflow
37-
runs the check on Blender 5.2 LTS and 4.5 LTS.
38+
## Exit codes
39+
40+
Per-script sequential checks. `9` is a valid check code; there is no rule
41+
against it.
42+
43+
| Code | Meaning |
44+
| --- | --- |
45+
| 0 | Success |
46+
| 1 | Uncaught exception (FATAL wrapper) |
47+
| 2 | argparse / usage |
48+
| 3 | GPv3 address / legacy trap for this Blender |
49+
| 4 | Object type, layer count, or frame number |
50+
| 5 | Stroke topology or cyclic (`--open-strokes` lands here) |
51+
| 6 | Lazy attribute layers missing or wrong domain/type |
52+
| 7 | Position buffer length or closed-form round-trip |
53+
| 8 | Grease Pencil material missing gpencil settings |
54+
| 9 | `--output` produced no file |
55+
56+
The `blender-smoke` workflow runs the check on Blender 5.2 LTS and 4.5 LTS
57+
(5.1 on the weekly cron, the `needs-5.1` PR label, or manual dispatch).
58+
Smoke does not pass `--output` or `--open-strokes`.

‎examples/grease-pencil-rosette/grease_pencil_rosette.py‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,16 @@
1919
materialization, and a closed-form round-trip of every position through the
2020
raw POINT attribute buffer.
2121
22+
``--open-strokes`` leaves every stroke non-cyclic and still asserts they
23+
are cyclic. That is the falsifier (``--same-axis`` in export-preset-axis).
24+
The GPv3 address shim is untouched.
25+
2226
By default it runs only the correctness check (no render) — the CI smoke
2327
check. Pass --output to also render a still:
2428
25-
blender --background --python grease_pencil_rosette.py -- # check only
26-
blender --background --python grease_pencil_rosette.py -- --output r.png # + render
29+
blender --background --python grease_pencil_rosette.py -- # check only
30+
blender --background --python grease_pencil_rosette.py -- --open-strokes # must fail
31+
blender --background --python grease_pencil_rosette.py -- --output r.png # + render
2732
"""
2833
import bpy, sys, os, math, argparse, colorsys
2934

@@ -66,7 +71,7 @@ def gp_data_new(name):
6671
return bpy.data.grease_pencils_v3.new(name) # 4.5 LTS: GPv3 lives at _v3
6772

6873

69-
def build_rosette():
74+
def build_rosette(open_strokes=False):
7075
bpy.ops.wm.read_factory_settings(use_empty=True)
7176
gp = gp_data_new("Rosette")
7277
layer = gp.layers.new("Ink")
@@ -75,8 +80,9 @@ def build_rosette():
7580

7681
drawing.add_strokes([POINTS] * RINGS)
7782
for ring, stroke in enumerate(drawing.strokes):
78-
stroke.cyclic = True
83+
stroke.cyclic = not open_strokes
7984
for i, pt in enumerate(stroke.points):
85+
8086
pt.position = rose_point(ring, i)
8187
pt.radius = point_radius(ring, i)
8288
pt.opacity = 1.0
@@ -267,9 +273,12 @@ def main():
267273
p.add_argument("--output", default=None, help="optional: render a still PNG here")
268274
p.add_argument("--engine", default="eevee", choices=("eevee", "cycles"),
269275
help="render engine for --output (cycles for GPU-less hosts)")
276+
p.add_argument("--open-strokes", action="store_true",
277+
help="falsifier: strokes not cyclic, still assert cyclic")
270278
args = p.parse_args(argv)
271279

272-
obj = build_rosette()
280+
obj = build_rosette(open_strokes=args.open_strokes)
281+
273282
code = check(obj)
274283
if code:
275284
return code

‎examples/light-link-studio/README.md‎

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,31 @@ pool raking the wall behind them — one key, one hero.
5353
# Two-render correctness check (tiny Cycles CPU renders) — the CI check:
5454
blender --background --python light_link_studio.py --
5555

56+
# Falsifier: receiver_collection unset. Must exit non-zero (assignment).
57+
blender --background --python light_link_studio.py -- --skip-link
58+
5659
# Also render the gallery still (Cycles, deterministic samples):
5760
blender --background --python light_link_studio.py -- --output linked.png
5861
```
5962

60-
It exits non-zero on failure (API moved, assignment lost, ratio below gate,
61-
insufficient unlink rise, or hero drift). The `blender-smoke` workflow runs
62-
the check on Blender 5.2 LTS and 4.5 LTS.
63+
## Exit codes
64+
65+
Per-script sequential checks. `9` is a valid check code; there is no rule
66+
against it.
67+
68+
| Code | Meaning |
69+
| --- | --- |
70+
| 0 | Success |
71+
| 1 | Uncaught exception (FATAL wrapper) |
72+
| 2 | argparse / usage |
73+
| 3 | Light datablock gained `light_linking` |
74+
| 4 | Light objects lost `light_linking` |
75+
| 5 | `receiver_collection` assignment did not read back (`--skip-link` lands here) |
76+
| 6 | Linked state: hero dark or hero/decoy ratio below gate |
77+
| 7 | Decoy rise below gate when unlinked |
78+
| 8 | Hero drifted across the unlink |
79+
| 9 | `--output` produced no file |
80+
81+
The `blender-smoke` workflow runs the check on Blender 5.2 LTS and 4.5 LTS
82+
(5.1 on the weekly cron, the `needs-5.1` PR label, or manual dispatch).
83+
Smoke does not pass `--output` or `--skip-link`.

‎examples/light-link-studio/light_link_studio.py‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@
2020
4.5 LTS and 5.1 (ObjectLightLinking with
2121
receiver_collection/blocker_collection on both).
2222
23+
``--skip-link`` leaves ``receiver_collection`` unset and still asserts the
24+
hero collection. That is the falsifier (``--same-axis`` in export-preset-axis).
25+
2326
By default it runs the two-render correctness check (no gallery still) — the
2427
CI smoke check. Pass --output to also render a still:
2528
2629
blender --background --python light_link_studio.py -- # check only
30+
blender --background --python light_link_studio.py -- --skip-link # must fail
2731
blender --background --python light_link_studio.py -- --output l.png # + render
2832
"""
2933
import bpy, bmesh, sys, os, math, argparse, tempfile, shutil
@@ -288,7 +292,7 @@ def render_lumas(sc, tmp, name, hero, decoy):
288292
return out[0], out[1]
289293

290294

291-
def check(sc, key, hero_c, hero, decoy):
295+
def check(sc, key, hero_c, hero, decoy, skip_link=False):
292296
# contract 0 (RNA guard): the API is on the light OBJECT
293297
ld = key.data
294298
if hasattr(ld, "light_linking"):
@@ -300,7 +304,7 @@ def check(sc, key, hero_c, hero, decoy):
300304
return 4
301305

302306
# contract 1 (assignment round-trip through the API itself)
303-
key.light_linking.receiver_collection = hero_c
307+
key.light_linking.receiver_collection = None if skip_link else hero_c
304308
if key.light_linking.receiver_collection != hero_c:
305309
print("ERROR: receiver_collection assignment did not read back",
306310
file=sys.stderr)
@@ -398,12 +402,15 @@ def main():
398402
argv = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
399403
p = argparse.ArgumentParser()
400404
p.add_argument("--output", default=None, help="optional: render a still PNG here")
405+
p.add_argument("--skip-link", action="store_true",
406+
help="falsifier: leave receiver_collection unset, still assert hero_c")
401407
args = p.parse_args(argv)
402408

403409
bpy.ops.wm.read_factory_settings(use_empty=True)
404410
sc = bpy.context.scene
405411
hero, decoy, hero_c, key = build_studio(sc)
406-
code = check(sc, key, hero_c, hero, decoy)
412+
code = check(sc, key, hero_c, hero, decoy, skip_link=args.skip_link)
413+
407414
if code:
408415
return code
409416

0 commit comments

Comments
 (0)