Skip to content

Commit 7e2736a

Browse files
committed
feat: add color-attribute-wheel example
Witnesses the modern color-attributes API (mesh.color_attributes.new on the CORNER domain) that AI code routinely swaps for the deprecated vertex_colors alias, and the domain-size trap that follows: a CORNER attribute is sized to loop count, not vertex count, so per-vertex data must be expanded across face corners before writing. Also asserts the Attribute node is actually linked to Base Color, since AI code frequently creates the attribute but forgets to wire it into the shader.
1 parent ed31a3f commit 7e2736a

12 files changed

Lines changed: 917 additions & 7 deletions

File tree

‎.cursor-plugin/plugin.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
],
6161
"examples": [
6262
"examples/bmesh-gear",
63+
"examples/color-attribute-wheel",
6364
"examples/compositor-glare",
6465
"examples/curve-bevel-arc",
6566
"examples/damped-track-aim",

‎.github/workflows/blender-smoke.yml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,14 @@ jobs:
253253
# aligns toward the core (dot ≥ 0.998). Exits non-zero on failure.
254254
xvfb-run -a "$BLENDER" --background \
255255
--python examples/damped-track-aim/damped_track_aim.py --
256+
257+
- name: Shipped example - color attribute wheel (color_attributes CORNER domain)
258+
run: |
259+
set -euo pipefail
260+
# Frame-independent check only (no render): an HSV wheel disc colored via
261+
# mesh.color_attributes.new() on the CORNER domain; asserts the attribute
262+
# is sized to loop count (not vertex count), is active_color, and probe
263+
# loops match the closed-form HSV for their vertex. Exits non-zero on
264+
# failure.
265+
xvfb-run -a "$BLENDER" --background \
266+
--python examples/color-attribute-wheel/color_attribute_wheel.py --

‎AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The content base (counts are CI-enforced against README.md and the manifest):
2727
- 2 templates: `extension-addon-template` for Extensions Platform add-ons,
2828
and `headless-batch-script-template` for unattended batch jobs.
2929
- 17 snippets covering canonical patterns.
30-
- 14 examples under `examples/<name>/`: runnable scripts that assert a real
30+
- 15 examples under `examples/<name>/`: runnable scripts that assert a real
3131
API contract with deterministic checks, exit non-zero on failure, and
3232
optionally render a still via `--output`. Each is executed headless on
3333
Blender 4.5 LTS and 5.1 by `blender-smoke.yml`; its render ships in the
@@ -41,7 +41,7 @@ Blender-Developer-Tools/
4141
rules/<rule-name>.mdc # 6 rule files
4242
templates/<template-name>/ # 2 starter templates
4343
snippets/<snippet-name>.py # 17 standalone Python snippets
44-
examples/<name>/ # 14 runnable smoke-gated examples (+ gallery.json)
44+
examples/<name>/ # 15 runnable smoke-gated examples (+ gallery.json)
4545
scripts/build_gallery.py # generates docs/gallery/ (stdlib only)
4646
scripts/site/ # vendored landing-page build (build_site.py + template)
4747
docs/gallery/ # committed generated gallery pages + hero assets

‎CLAUDE.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ skills/<skill-name>/SKILL.md - AI workflow definitions, 12 total
1919
rules/<rule-name>.mdc - Anti-pattern rules, 6 total
2020
templates/<template-name>/ - Starter projects, 2 total
2121
snippets/<snippet-name>.py - Standalone code patterns, 17 total
22-
examples/<name>/ - Runnable smoke-gated examples, 14 total (+ gallery.json)
22+
examples/<name>/ - Runnable smoke-gated examples, 15 total (+ gallery.json)
2323
scripts/build_gallery.py - Regenerates docs/gallery/ from gallery.json (stdlib only)
2424
scripts/site/ - Vendored landing-page build (Jinja2)
2525
docs/gallery/ - Committed generated gallery pages + hero renders
@@ -80,11 +80,11 @@ v0.1.0: canonical object creation and deletion, depsgraph evaluated mesh, bmesh
8080

8181
v0.2.0: Principled BSDF material, driver-with-custom-function via `driver_namespace`, application handler registration, shader node group with cross-version `interface` API, `foreach_get` bulk vertex read, version-branch skeleton, and USD export with `evaluation_mode='RENDER'`.
8282

83-
## Examples (14)
83+
## Examples (15)
8484

8585
Runnable scripts at `examples/<name>/`, each asserting a real API contract with
8686
deterministic checks (exit non-zero on failure) and optionally rendering a still via
87-
`--output`. All fourteen run headless on Blender 4.5 LTS and 5.1 in `blender-smoke.yml`;
87+
`--output`. All fifteen run headless on Blender 4.5 LTS and 5.1 in `blender-smoke.yml`;
8888
their renders ship in the site gallery at `docs/gallery/`. `examples/gallery.json` is the
8989
gallery's source of truth. When authoring a new one, copy the anatomy of
9090
`examples/bmesh-gear/` (script structure, README shape, dark-studio render recipe) and

‎README.md‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
</p>
1818

1919
<p align="center">
20-
<strong>12 skills</strong> &nbsp;&bull;&nbsp; <strong>6 rules</strong> &nbsp;&bull;&nbsp; <strong>2 templates</strong> &nbsp;&bull;&nbsp; <strong>17 snippets</strong> &nbsp;&bull;&nbsp; <strong>14 examples</strong>
20+
<strong>12 skills</strong> &nbsp;&bull;&nbsp; <strong>6 rules</strong> &nbsp;&bull;&nbsp; <strong>2 templates</strong> &nbsp;&bull;&nbsp; <strong>17 snippets</strong> &nbsp;&bull;&nbsp; <strong>15 examples</strong>
2121
</p>
2222

2323
---
2424

2525
## Overview
2626

27-
This repository ships **12 skills, 6 rules, 2 templates, 17 snippets, and 14 runnable examples** for Blender Python development targeting Blender 5.1 (current stable) with Blender 4.5 LTS fallback support.
27+
This repository ships **12 skills, 6 rules, 2 templates, 17 snippets, and 15 runnable examples** for Blender Python development targeting Blender 5.1 (current stable) with Blender 4.5 LTS fallback support.
2828

2929
The content is consumed by AI coding agents (Cursor, Claude Code, any MCP-capable client) when working on Blender add-ons, geometry nodes scripts, batch pipelines, or animation tooling. There is no build step. Edit the markdown and Python files directly.
3030

@@ -248,6 +248,22 @@ Aim constraints via the data API — `Object.constraints.new('DAMPED_TRACK')` wi
248248
Asserts twelve unmuted Damped Track constraints and evaluated local `+Z` alignment
249249
toward the core (dot ≥ 0.998).
250250

251+
</td>
252+
</tr>
253+
<tr>
254+
<td width="46%" valign="middle">
255+
<a href="examples/color-attribute-wheel/"><img src="examples/color-attribute-wheel/preview.webp" alt="Color attribute wheel: an HSV color wheel disc with a white center fading into a vivid rainbow rim, resting on a dark studio floor" /></a>
256+
</td>
257+
<td valign="middle">
258+
259+
### [color-attribute-wheel](examples/color-attribute-wheel/)
260+
261+
The modern color-attributes API — `mesh.color_attributes.new()` on the `CORNER`
262+
domain, not the deprecated `vertex_colors` alias, filled by expanding per-vertex
263+
HSV across face corners with `foreach_get`/`foreach_set`. Asserts the attribute
264+
is sized to loop count (not vertex count), is `active_color`, and that the
265+
shader `Attribute` node is actually linked to Base Color.
266+
251267
</td>
252268
</tr>
253269
</table>
16 KB
Loading

0 commit comments

Comments
 (0)