Skip to content

Commit 4a891d1

Browse files
TMHSDigitalclaude
andcommitted
feat: gpu-draw-handler and set-sharp-from-angle snippets, no-legacy-vse-sequences rule
- snippets/gpu-draw-handler.py: POST_VIEW overlay that stores its draw_handler_add handle and removes it in unregister() - snippets/set-sharp-from-angle.py: the 4.1+ replacement for use_auto_smooth, reading corner_normals - rules/no-legacy-vse-sequences.mdc: flags .sequences and .sequences_all. Measured hasattr on a fresh SequenceEditor: 4.5.14 LTS has sequences, sequences_all, strips and strips_all; 5.2.1 LTS has only strips and strips_all (.sequences_all raises AttributeError too) Both snippets ran headless on 4.5.14 and 5.2.1 (register twice, unregister, handle cleared; 96 corner normals, all 18 faces smooth). Counts now 12 rules, 31 snippets; rule exports regenerated; run_all.py 35/35. Closes #500 Closes #501 Closes #502 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 5e73719 commit 4a891d1

19 files changed

Lines changed: 192 additions & 21 deletions

File tree

‎.cursor-plugin/plugin.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"rules/no-unapplied-modifiers-on-export.mdc",
5353
"rules/use-correct-axis-rna-per-exporter.mdc",
5454
"rules/no-bgl.mdc",
55-
"rules/no-removed-normals-api.mdc"
55+
"rules/no-removed-normals-api.mdc",
56+
"rules/no-legacy-vse-sequences.mdc"
5657
]
5758
}

‎AGENTS.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ a `.cursor-plugin/plugin.json` manifest so the ecosystem drift checker
2020
classifies it as a `cursor-plugin`. This is content the AI loads when the user
2121
asks Blender questions or works on Blender add-ons in Cursor or Claude Code.
2222

23-
The content base is 20 skills, 11 rules, 3 templates, 29 snippets, 66
23+
The content base is 20 skills, 12 rules, 3 templates, 31 snippets, 66
2424
examples, and 80 showcase pieces (counts are CI-enforced across README.md, the agent docs, ROADMAP.md,
2525
`site.json` and the site templates). The full inventory tables and per-item purposes live in
2626
`CLAUDE.md`. Example anatomy and authoring rules: copy `examples/bmesh-gear/`;
@@ -33,9 +33,9 @@ in `docs/VISUAL-STYLE.md`; the canonical run prompt is
3333
```
3434
Blender-Developer-Tools/
3535
skills/<skill-name>/SKILL.md # 20 skill files
36-
rules/<rule-name>.mdc # 11 rule files
36+
rules/<rule-name>.mdc # 12 rule files
3737
templates/<template-name>/ # 3 starter templates
38-
snippets/<snippet-name>.py # 29 standalone Python snippets
38+
snippets/<snippet-name>.py # 31 standalone Python snippets
3939
examples/<name>/ # 69 runnable smoke-gated examples (+ gallery.json)
4040
examples/gallery_framing.py # shared Layer 1 framing measurement (render path only)
4141
showcase/<name>/ # budget-conformance props (sibling of examples/)

‎CLAUDE.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ The **Blender Developer Tools** repository is at **v0.156.0**. It packages skill
1818

1919
```
2020
skills/<skill-name>/SKILL.md - AI workflow definitions, 20 total
21-
rules/<rule-name>.mdc - Anti-pattern rules, 11 total
21+
rules/<rule-name>.mdc - Anti-pattern rules, 12 total
2222
templates/<template-name>/ - Starter projects, 3 total
23-
snippets/<snippet-name>.py - Standalone code patterns, 29 total
23+
snippets/<snippet-name>.py - Standalone code patterns, 31 total
2424
examples/<name>/ - Runnable smoke-gated examples, 69 total (+ gallery.json)
2525
showcase/<name>/ - Budget-conformance props, 80 pieces, each with a gallery `category` (sibling of examples/; see showcase/README.md § Categories)
2626
scripts/build_gallery.py - Regenerates docs/gallery/ from examples/gallery.json + showcase/gallery.json
@@ -55,7 +55,7 @@ VERSION - Source of truth for the repo version
5555
| porting-to-blender-5 | Index of every 4.x → 5.x break the pack covers (bgl, `action.fcurves`, `use_auto_smooth`, Principled sockets, `.sequences`, ID properties, compositor, NodesModifier inputs, ...), each linked to the skill, rule or example that owns the fix; headless triage recipe |
5656
| gpu-drawing-and-overlays | `gpu` instead of the removed `bgl`: `draw_handler_add`/`remove`, builtin shader names, `gpu.state` blending and depth, `POLYLINE_*` line width, `blf` text, `GPUOffScreen` with 5.2's `gpu.init()` headless |
5757

58-
## Rules (11)
58+
## Rules (12)
5959

6060
Every rule sets `alwaysApply: false`, so the Scope column below is the rule's
6161
actual load condition, not a description: a rule enters context only when a file
@@ -74,6 +74,7 @@ matching its `globs` does. Changing a glob changes when the rule fires.
7474
| use-correct-axis-rna-per-exporter | `*.py` | `export_scene.gltf` with FBX `axis_forward`/`axis_up`, or `export_scene.fbx` with glTF `export_yup` |
7575
| no-bgl | `*.py` | `import bgl` or any `bgl.` call (removed in 5.x; the add-on fails to register) |
7676
| no-removed-normals-api | `*.py` | `use_auto_smooth`, `auto_smooth_angle`, `calc_normals_split()` and the other normals calls removed in 4.1 |
77+
| no-legacy-vse-sequences | `*.py` | `sequence_editor.sequences` / `.sequences_all` (removed in 5.x; `.strips` / `.strips_all` exist on 4.5 too) |
7778

7879
## Templates (3)
7980

@@ -101,7 +102,7 @@ matching its `globs` does. Changing a glob changes when the rule fires.
101102
- Unity / Godot / Unreal glTF export via the engine-export-presets contract
102103
- Explicit exit codes matching `headless-batch-script-template` (0, then 2+)
103104

104-
## Snippets (29)
105+
## Snippets (31)
105106

106107
Small standalone `.py` files at `snippets/<name>.py`, each 5 to 75 lines.
107108

@@ -111,7 +112,7 @@ v0.2.0: Principled BSDF material, driver-with-custom-function via `driver_namesp
111112

112113
AI asset pipeline track: `decimate_to_budget.py`, `convex_hull_collider.py`, `lod_chain.py` (helper duplicated, not imported), `gltf_draco_export.py`, `export_preset_unity.py`, `export_preset_godot.py`, `export_preset_unreal.py`, `setup_bake_target_image.py`, `bake_normal_high_to_low.py`, `save_baked_image.py`.
113114

114-
Extensions runtime: `extension-user-data.py` (`extension_path_user` settings file and an `online_access` guard). Long-running work: `thread-queue-timer.py` (worker thread, `queue.Queue`, main-thread drain timer).
115+
Extensions runtime: `extension-user-data.py` (`extension_path_user` settings file and an `online_access` guard). Long-running work: `thread-queue-timer.py` (worker thread, `queue.Queue`, main-thread drain timer). Porting to 5.x: `gpu-draw-handler.py` (viewport overlay with a stored, removable draw handler) and `set-sharp-from-angle.py` (the 4.1+ replacement for `use_auto_smooth`).
115116

116117
## Examples (69)
117118

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ The drift-check workflow enforces these on every push and PR.
292292

293293
## Aggregate Counts
294294

295-
`README.md` declares aggregate counts (e.g. "20 skills, 11 rules, 3 templates, 29 snippets, 69 examples, and 80 showcase pieces"). The `validate-counts` job in `.github/workflows/validate.yml` enforces these substrings against the filesystem on every push and PR. Showcase pieces are counted separately from examples. When you add or remove content, update the README counts in the same commit.
295+
`README.md` declares aggregate counts (e.g. "20 skills, 12 rules, 3 templates, 31 snippets, 69 examples, and 80 showcase pieces"). The `validate-counts` job in `.github/workflows/validate.yml` enforces these substrings against the filesystem on every push and PR. Showcase pieces are counted separately from examples. When you add or remove content, update the README counts in the same commit.
296296

297297
## Pull Request Process
298298

‎README.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</p>
2626

2727
<p align="center">
28-
<strong>20 skills</strong> &nbsp;&bull;&nbsp; <strong>11 rules</strong> &nbsp;&bull;&nbsp; <strong>3 templates</strong> &nbsp;&bull;&nbsp; <strong>29 snippets</strong> &nbsp;&bull;&nbsp; <strong>69 examples</strong> &nbsp;&bull;&nbsp; <strong>80 showcase pieces</strong>
28+
<strong>20 skills</strong> &nbsp;&bull;&nbsp; <strong>12 rules</strong> &nbsp;&bull;&nbsp; <strong>3 templates</strong> &nbsp;&bull;&nbsp; <strong>31 snippets</strong> &nbsp;&bull;&nbsp; <strong>69 examples</strong> &nbsp;&bull;&nbsp; <strong>80 showcase pieces</strong>
2929
</p>
3030

3131
<p align="center">
@@ -44,7 +44,7 @@
4444

4545
## Overview
4646

47-
This repository ships **20 skills, 11 rules, 3 templates, 29 snippets, 69 examples, and 80 showcase pieces** for Blender Python development targeting Blender 5.2 LTS (current stable) with Blender 4.5 LTS fallback support. Blender 5.1 is prior stable.
47+
This repository ships **20 skills, 12 rules, 3 templates, 31 snippets, 69 examples, and 80 showcase pieces** for Blender Python development targeting Blender 5.2 LTS (current stable) with Blender 4.5 LTS fallback support. Blender 5.1 is prior stable.
4848

4949
The content is consumed by AI coding agents, installed as a plugin or read from a checkout. An optional second plugin registers the official [Blender Lab MCP server](https://www.blender.org/lab/mcp-server/) for live sessions (see [Live Blender session](#live-blender-session-mcp)); the server is referenced from upstream, not part of this repository, and nothing else depends on it. Cursor and Claude Code both install it as a plugin (see [Quick start](#quick-start)): Cursor loads the skills and applies `rules/*.mdc` wherever their scope globs match; Claude Code loads the skills and gets the rules through a generated `blender-rules` skill, since it does not read Cursor `.mdc` files. An agent picks a skill up when its description matches the task. Any agent that can read files in a workspace can use it the same way. There is no build step for the content — edit the Markdown and Python files directly.
5050

@@ -53,15 +53,15 @@ The content is consumed by AI coding agents, installed as a plugin or read from
5353
| **Skills** | Guided workflows: scaffolding, operators, panels, properties, mesh and bmesh, headless batch, slotted actions, geometry nodes, procedural materials, depsgraph queries, drivers and handlers, `bl_info` migration, video sequencer, imported-mesh cleanup, high-to-low baking, engine export presets, extension runtime and packaging, timers, modal operators and threading, GPU drawing and viewport overlays, porting add-ons to Blender 5 |
5454
| **Rules** | Guardrails for the most common AI mistakes: ops-in-loops, bmesh leaks, legacy `bl_info` only, prop assignments, deprecated context-copy override, per-element loops over bulk mesh data, import without scale check, export without evaluated geometry, mixed glTF/FBX axis RNA |
5555
| **Templates** | A working Extensions Platform add-on starter, a headless batch script starter, and a GLB-in engine-ready asset pipeline |
56-
| **Snippets** | 29 small standalone Python files demonstrating canonical patterns, 5 to 75 lines each |
56+
| **Snippets** | 31 small standalone Python files demonstrating canonical patterns, 5 to 75 lines each |
5757
| **Examples** | Runnable headless scripts under [`examples/`](examples/). Each asserts an API contract and exits non-zero on failure. |
5858
| **Showcase** | Proof that the skills compose: each piece under [`showcase/`](showcase/) is one headless Python script that builds a game prop and runs the whole asset pipeline (cleanup, high-to-low bake, LODs, convex collider, engine export), asserting measured budgets on every LTS. Not API examples. Conventions: [`showcase/README.md`](showcase/README.md) |
5959

6060
## Quick start
6161

6262
Neither agent needs a clone of `main`: both install the slim `plugin-dist` build. Clone the full repository only to [run the examples or contribute](#run-the-examples-or-contribute).
6363

64-
- **Cursor** — install it as a local plugin from the slim `plugin-dist` branch, then run **Developer: Reload Window**. **Customize** lists the 20 skills and 11 rules; the rules apply by glob scope and the agent loads a skill when its description matches the task.
64+
- **Cursor** — install it as a local plugin from the slim `plugin-dist` branch, then run **Developer: Reload Window**. **Customize** lists the 20 skills and 12 rules; the rules apply by glob scope and the agent loads a skill when its description matches the task.
6565

6666
```bash
6767
git clone --branch plugin-dist --single-branch https://github.com/TMHSDigital/Blender-Developer-Tools.git ~/.cursor/plugins/local/blender-developer-tools
@@ -189,9 +189,9 @@ Browse both, with filters, full-size renders and each script's README, in the **
189189

190190
```
191191
skills/<name>/SKILL.md - 20 skill files, YAML frontmatter, one canonical pattern each
192-
rules/<name>.mdc - 11 rule files, anti-pattern + correction
192+
rules/<name>.mdc - 12 rule files, anti-pattern + correction
193193
templates/<name>/ - 3 template directories (extension-addon-template, headless-batch-script-template, ai-asset-pipeline-template)
194-
snippets/<name>.py - 29 standalone Python snippets, 5 to 75 lines each
194+
snippets/<name>.py - 31 standalone Python snippets, 5 to 75 lines each
195195
examples/<name>/ - 69 example directories: script, README with exit codes and falsifier
196196
showcase/<name>/ - 80 showcase pieces: budget-gated game props, script and README
197197
claude/ - generated Claude Code copies of the rules (blender-rules skill + import file)

‎ROADMAP.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ derives the actual version from conventional-commit types.
3939
| GPU drawing without `bgl` | 19 | 10 | 3 | 29 | Shipped |
4040
| Removed normals API rule (pre-4.1 auto smooth) | 19 | 11 | 3 | 29 | Shipped |
4141
| Porting index skill (`porting-to-blender-5`) | 20 | 11 | 3 | 29 | Shipped |
42+
| Porting snippets and the legacy VSE `.sequences` rule | 20 | 12 | 3 | 31 | Shipped |
4243
| Live-session bridge (opt-in `blender-live-session` plugin, upstream Blender Lab MCP) | - | - | - | - | Shipped |
4344
| Stable (1.0) | — | — | — | — | Upcoming; criteria below |
4445

‎claude/blender-rules.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ Flag `import bgl` and any `bgl.` call. The `bgl` OpenGL wrapper was deprecated i
1717

1818
Applies to: `**/*.py`. Full rule: [`rules/no-bgl.mdc`](https://github.com/TMHSDigital/Blender-Developer-Tools/blob/main/rules/no-bgl.mdc).
1919

20+
## no-legacy-vse-sequences
21+
22+
Flag `sequence_editor.sequences` and `.sequences_all`. Both are gone in Blender 5.x (AttributeError on 5.0, 5.1 and 5.2), while `.strips` and `.strips_all` already exist on 4.5 LTS, so use those everywhere with no version branch. See the vse-python skill.
23+
24+
Applies to: `**/*.py`. Full rule: [`rules/no-legacy-vse-sequences.mdc`](https://github.com/TMHSDigital/Blender-Developer-Tools/blob/main/rules/no-legacy-vse-sequences.mdc).
25+
2026
## no-removed-normals-api
2127

2228
Flag the mesh normals API removed in Blender 4.1 — `use_auto_smooth`, `auto_smooth_angle`, `calc_normals_split()`, `free_normals_split()`, `create_normals_split()`. Each raises AttributeError on 4.5 LTS and 5.x. Use `Mesh.set_sharp_from_angle`, `object.shade_auto_smooth`, and `Mesh.corner_normals` (always current) instead.

‎claude/skills/blender-rules/SKILL.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ Flag `import bgl` and any `bgl.` call. The `bgl` OpenGL wrapper was deprecated i
2222

2323
Applies to: `**/*.py`. Full rule: [`rules/no-bgl.mdc`](https://github.com/TMHSDigital/Blender-Developer-Tools/blob/main/rules/no-bgl.mdc).
2424

25+
## no-legacy-vse-sequences
26+
27+
Flag `sequence_editor.sequences` and `.sequences_all`. Both are gone in Blender 5.x (AttributeError on 5.0, 5.1 and 5.2), while `.strips` and `.strips_all` already exist on 4.5 LTS, so use those everywhere with no version branch. See the vse-python skill.
28+
29+
Applies to: `**/*.py`. Full rule: [`rules/no-legacy-vse-sequences.mdc`](https://github.com/TMHSDigital/Blender-Developer-Tools/blob/main/rules/no-legacy-vse-sequences.mdc).
30+
2531
## no-removed-normals-api
2632

2733
Flag the mesh normals API removed in Blender 4.1 — `use_auto_smooth`, `auto_smooth_angle`, `calc_normals_split()`, `free_normals_split()`, `create_normals_split()`. Each raises AttributeError on 4.5 LTS and 5.x. Use `Mesh.set_sharp_from_angle`, `object.shade_auto_smooth`, and `Mesh.corner_normals` (always current) instead.

‎exports/AGENTS.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ Flag `import bgl` and any `bgl.` call. The `bgl` OpenGL wrapper was deprecated i
1717

1818
Applies to: `**/*.py`. Full rule: [`rules/no-bgl.mdc`](https://github.com/TMHSDigital/Blender-Developer-Tools/blob/main/rules/no-bgl.mdc).
1919

20+
## no-legacy-vse-sequences
21+
22+
Flag `sequence_editor.sequences` and `.sequences_all`. Both are gone in Blender 5.x (AttributeError on 5.0, 5.1 and 5.2), while `.strips` and `.strips_all` already exist on 4.5 LTS, so use those everywhere with no version branch. See the vse-python skill.
23+
24+
Applies to: `**/*.py`. Full rule: [`rules/no-legacy-vse-sequences.mdc`](https://github.com/TMHSDigital/Blender-Developer-Tools/blob/main/rules/no-legacy-vse-sequences.mdc).
25+
2026
## no-removed-normals-api
2127

2228
Flag the mesh normals API removed in Blender 4.1 — `use_auto_smooth`, `auto_smooth_angle`, `calc_normals_split()`, `free_normals_split()`, `create_normals_split()`. Each raises AttributeError on 4.5 LTS and 5.x. Use `Mesh.set_sharp_from_angle`, `object.shade_auto_smooth`, and `Mesh.corner_normals` (always current) instead.

‎exports/copilot/blender-python.instructions.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ Flag `import bgl` and any `bgl.` call. The `bgl` OpenGL wrapper was deprecated i
2121

2222
Applies to: `**/*.py`. Full rule: [`rules/no-bgl.mdc`](https://github.com/TMHSDigital/Blender-Developer-Tools/blob/main/rules/no-bgl.mdc).
2323

24+
## no-legacy-vse-sequences
25+
26+
Flag `sequence_editor.sequences` and `.sequences_all`. Both are gone in Blender 5.x (AttributeError on 5.0, 5.1 and 5.2), while `.strips` and `.strips_all` already exist on 4.5 LTS, so use those everywhere with no version branch. See the vse-python skill.
27+
28+
Applies to: `**/*.py`. Full rule: [`rules/no-legacy-vse-sequences.mdc`](https://github.com/TMHSDigital/Blender-Developer-Tools/blob/main/rules/no-legacy-vse-sequences.mdc).
29+
2430
## no-removed-normals-api
2531

2632
Flag the mesh normals API removed in Blender 4.1 — `use_auto_smooth`, `auto_smooth_angle`, `calc_normals_split()`, `free_normals_split()`, `create_normals_split()`. Each raises AttributeError on 4.5 LTS and 5.x. Use `Mesh.set_sharp_from_angle`, `object.shade_auto_smooth`, and `Mesh.corner_normals` (always current) instead.

0 commit comments

Comments
 (0)