Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
277 lines (265 loc) · 18.1 KB
/
Copy pathindex.html
File metadata and controls
277 lines (265 loc) · 18.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Examples Gallery — Blender Developer Tools</title>
<meta name="description" content="Runnable, smoke-gated Blender Python examples — each executed headless on Blender 4.5 LTS and 5.1, so every render reflects code that actually runs." />
<link rel="canonical" href="https://tmhsdigital.github.io/Blender-Developer-Tools/gallery/" />
<link rel="icon" href="../assets/favicon.svg" type="image/svg+xml" />
<meta name="theme-color" content="#0d1117" media="(prefers-color-scheme: dark)" />
<meta name="theme-color" content="#f6f8fa" media="(prefers-color-scheme: light)" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Examples Gallery — Blender Developer Tools" />
<meta property="og:description" content="Runnable, smoke-gated Blender Python examples — each executed headless on Blender 4.5 LTS and 5.1, so every render reflects code that actually runs." />
<meta property="og:url" content="https://tmhsdigital.github.io/Blender-Developer-Tools/gallery/" />
<meta property="og:image" content="https://tmhsdigital.github.io/Blender-Developer-Tools/gallery/assets/swatch-grid-hero.webp" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Examples Gallery — Blender Developer Tools" />
<meta name="twitter:description" content="Runnable, smoke-gated Blender Python examples — each executed headless on Blender 4.5 LTS and 5.1, so every render reflects code that actually runs." />
<meta name="twitter:image" content="https://tmhsdigital.github.io/Blender-Developer-Tools/gallery/assets/swatch-grid-hero.webp" />
<!-- FOUC guard: apply the saved theme before first paint. Shares the 'theme'
key with the landing page, so a visitor's choice carries across. -->
<script>(function(){try{var t=localStorage.getItem('theme');if(t==='light'||t==='dark')document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
<style>
:root {
--bg: #0d1117; --bg2: #161b22; --surface: #161b22; --surface-2: #1c2128;
--border: #30363d; --text: #e6edf3; --text-dim: #8b949e;
--accent: #7c3aed; --accent-light: #a78bfa;
--radius: 8px; --radius-lg: 12px; --maxw: 1080px;
--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
--font-mono: ui-monospace, 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
--code-k: #ff7b72; --code-s: #a5d6ff; --code-c: #8b949e; --code-n: #79c0ff;
}
/* auto mode: follow the OS unless the user forced dark */
@media (prefers-color-scheme: light) {
:root:not([data-theme="dark"]) {
--bg: #f6f8fa; --bg2: #ffffff; --surface: #ffffff; --surface-2: #f0f2f5;
--border: #d0d7de; --text: #1f2328; --text-dim: #656d76;
--code-k: #cf222e; --code-s: #0a3069; --code-c: #6e7781; --code-n: #0550ae;
}
}
/* explicit override */
[data-theme="light"] {
--bg: #f6f8fa; --bg2: #ffffff; --surface: #ffffff; --surface-2: #f0f2f5;
--border: #d0d7de; --text: #1f2328; --text-dim: #656d76;
--code-k: #cf222e; --code-s: #0a3069; --code-c: #6e7781; --code-n: #0550ae;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text);
line-height: 1.6; min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff;
padding: 0.5rem 1rem; border-radius: var(--radius); z-index: 10; }
.skip:focus { left: 0.5rem; top: 0.5rem; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center;
justify-content: space-between; gap: 1rem; padding: 0.75rem 1.25rem;
background: color-mix(in srgb, var(--bg) 88%, transparent);
backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .back { color: var(--text-dim); font-size: 0.9rem; font-weight: 500; }
.topbar .back:hover { color: var(--accent-light); }
.topbar-right { display: flex; align-items: center; gap: 0.85rem; }
.topbar-right .ghlink { color: var(--text-dim); font-size: 0.9rem; font-weight: 500; }
.topbar-right .ghlink:hover { color: var(--accent-light); }
.theme-toggle { background: var(--surface-2); border: 1px solid var(--border);
color: var(--text); border-radius: var(--radius); padding: 0.35rem 0.6rem;
font-size: 0.95rem; cursor: pointer; line-height: 1; transition: border-color 0.15s, background 0.15s; }
.theme-toggle:hover { border-color: var(--accent-light); }
header.hero { max-width: var(--maxw); margin: 0 auto; padding: 3rem 1.25rem 1.5rem; }
header.hero h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -0.02em; line-height: 1.15; }
header.hero p { color: var(--text-dim); max-width: 62ch; margin-top: 0.6rem; font-size: 1.02rem; }
/* ---- index: filter chips ---- */
.chips { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem 0.25rem;
display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
border-radius: 999px; padding: 0.25rem 0.85rem; font-size: 0.82rem; font-weight: 500;
font-family: var(--font-sans); cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.chip:hover { color: var(--accent-light); border-color: var(--accent); }
.chip.active { color: #fff; background: var(--accent); border-color: var(--accent); }
main { max-width: var(--maxw); margin: 0 auto; padding: 1rem 1.25rem 2rem; }
.grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; align-items: stretch; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
overflow: hidden; display: flex; flex-direction: column;
transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease; }
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
box-shadow: 0 8px 28px rgba(0,0,0,0.28); }
.card.hidden { display: none; }
.card-media { display: block; background: var(--bg2); line-height: 0; }
.card-media img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.card-body { padding: 1.15rem 1.4rem 1.45rem; display: flex; flex-direction: column; flex: 1 1 auto; }
.card-body h2 { font-size: 1.22rem; letter-spacing: -0.01em; margin-bottom: 0.5rem; }
.card-body h2 a { color: var(--text); }
.card-body h2 a:hover { color: var(--accent-light); text-decoration: none; }
.teaches { color: var(--text); margin-bottom: 0.7rem; }
.witnesses { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 1rem; }
.tag { display: inline-block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em;
color: var(--accent-light); border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
border-radius: 999px; padding: 0.08rem 0.55rem; margin-right: 0.4rem; vertical-align: 1px; }
.card-link { font-weight: 600; font-size: 0.95rem; margin-top: auto; }
/* ---- detail page ---- */
.detail-hero { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
background: var(--bg2); padding: 0; display: block; width: 100%; cursor: zoom-in; line-height: 0; }
.detail-hero img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.zoom-hint { color: var(--text-dim); font-size: 0.78rem; margin-top: 0.4rem; }
.callout { border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
border-left: 3px solid var(--accent); border-radius: var(--radius);
background: color-mix(in srgb, var(--accent) 7%, var(--surface));
padding: 0.85rem 1.1rem; margin: 1.5rem 0; font-size: 0.95rem; }
.runline { display: flex; align-items: stretch; gap: 0.5rem; margin: 1.5rem 0; }
.runline pre { flex: 1 1 auto; background: var(--surface-2); border: 1px solid var(--border);
border-radius: var(--radius); padding: 0.7rem 0.9rem; overflow-x: auto;
font-family: var(--font-mono); font-size: 0.83rem; line-height: 1.5; }
.copy-btn { flex: 0 0 auto; background: var(--surface-2); border: 1px solid var(--border);
color: var(--text-dim); border-radius: var(--radius); padding: 0 0.85rem; cursor: pointer;
font-family: var(--font-sans); font-size: 0.82rem; font-weight: 500; transition: color 0.15s, border-color 0.15s; }
.copy-btn:hover { color: var(--accent-light); border-color: var(--accent); }
.detail-section { margin-top: 2.25rem; }
.detail-section > h2 { font-size: 1.15rem; letter-spacing: -0.01em; padding-bottom: 0.5rem;
border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.md h1, .md h2, .md h3 { letter-spacing: -0.01em; margin: 1.4rem 0 0.6rem; line-height: 1.25; }
.md h1 { font-size: 1.35rem; } .md h2 { font-size: 1.15rem; } .md h3 { font-size: 1rem; }
.md p { margin: 0.7rem 0; }
.md ul { margin: 0.7rem 0 0.7rem 1.4rem; }
.md li { margin: 0.3rem 0; }
.md code { background: var(--surface-2); border: 1px solid var(--border); padding: 0.08rem 0.35rem;
border-radius: 4px; font-family: var(--font-mono); font-size: 0.84em; }
.md pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
padding: 0.85rem 1rem; overflow-x: auto; margin: 0.9rem 0; }
.md pre code { background: none; border: none; padding: 0; font-size: 0.83rem; line-height: 1.55; }
.src pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
padding: 1rem 1.1rem; overflow-x: auto; font-family: var(--font-mono);
font-size: 0.82rem; line-height: 1.55; }
.src .k { color: var(--code-k); } .src .s { color: var(--code-s); }
.src .c { color: var(--code-c); font-style: italic; } .src .n { color: var(--code-n); }
.src-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
flex-wrap: wrap; margin-bottom: 0.6rem; color: var(--text-dim); font-size: 0.85rem; }
.src-meta code { font-family: var(--font-mono); font-size: 0.82rem; }
.lightbox { position: fixed; inset: 0; z-index: 50; display: none; align-items: center;
justify-content: center; background: rgba(0,0,0,0.85); padding: 2rem; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--radius); }
footer { max-width: var(--maxw); margin: 0 auto; padding: 2rem 1.25rem 3rem;
color: var(--text-dim); font-size: 0.85rem; border-top: 1px solid var(--border); }
footer code { background: var(--surface-2); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.82rem; }
@media (min-width: 720px) { .grid { grid-template-columns: 1fr 1fr; gap: 1.75rem; } }
@media (prefers-reduced-motion: reduce) {
html { scroll-behavior: auto; }
.card, .theme-toggle { transition: none; }
.card:hover { transform: none; }
}
</style>
</head>
<body>
<a class="skip" href="#main">Skip to content</a>
<div class="topbar">
<a class="back" href="../"><span aria-hidden="true">←</span> Blender Developer Tools</a>
<div class="topbar-right">
<a class="ghlink" href="https://github.com/TMHSDigital/Blender-Developer-Tools">GitHub</a>
<button class="theme-toggle" id="themeToggle" type="button" aria-label="Theme: auto (click to change)">☼</button>
</div>
</div>
<header class="hero">
<h1>Examples Gallery</h1>
<p>Runnable, smoke-gated Blender Python examples — each executed headless on Blender 4.5 LTS and 5.1, so every render reflects code that actually runs.</p>
</header>
<div class="chips" role="toolbar" aria-label="Filter examples by topic">
<button class="chip active" data-tag="" type="button">All</button>
<button class="chip" data-tag="animation" type="button">animation</button>
<button class="chip" data-tag="depsgraph" type="button">depsgraph</button>
<button class="chip" data-tag="export" type="button">export</button>
<button class="chip" data-tag="geometry-nodes" type="button">geometry-nodes</button>
<button class="chip" data-tag="materials" type="button">materials</button>
<button class="chip" data-tag="rendering" type="button">rendering</button>
</div>
<main id="main">
<div class="grid">
<article class="card" data-tags="materials rendering">
<a class="card-media" href="swatch-grid/" aria-label="swatch-grid example detail page">
<img src="assets/swatch-grid-hero.webp" alt="swatch-grid — Procedural Principled materials — metal and dielectric, the emission pattern, and the cross-version set_specular shim" loading="lazy" decoding="async" />
</a>
<div class="card-body">
<h2><a href="swatch-grid/">swatch-grid</a></h2>
<p class="teaches">Procedural Principled materials — metal and dielectric, the emission pattern, and the cross-version set_specular shim.</p>
<p class="witnesses"><span class="tag">witnesses</span> EEVEE engine-id mapping: BLENDER_EEVEE on 5.x, BLENDER_EEVEE_NEXT on 4.2–4.5.</p>
<a class="card-link" href="swatch-grid/">View example <span aria-hidden="true">→</span></a>
</div>
</article>
<article class="card" data-tags="animation">
<a class="card-media" href="turntable/" aria-label="turntable example detail page">
<img src="assets/turntable-hero.webp" alt="turntable — A slotted-actions Z-rotation turntable keyed through the cross-version channelbag path (get_channelbag_for_slot)" loading="lazy" decoding="async" />
</a>
<div class="card-body">
<h2><a href="turntable/">turntable</a></h2>
<p class="teaches">A slotted-actions Z-rotation turntable keyed through the cross-version channelbag path (get_channelbag_for_slot).</p>
<p class="witnesses"><span class="tag">witnesses</span> Slotted-actions boundary: ensure-helper channelbag on 5.x, strip.channelbag on 4.4/4.5.</p>
<a class="card-link" href="turntable/">View example <span aria-hidden="true">→</span></a>
</div>
</article>
<article class="card" data-tags="geometry-nodes materials">
<a class="card-media" href="gn-sdf-remesh/" aria-label="gn-sdf-remesh example detail page">
<img src="assets/gn-sdf-remesh-hero.webp" alt="gn-sdf-remesh — A Geometry Nodes SDF remesh (MeshToSDFGrid → GridToMesh at the SDF zero-level), with a Set Material node carrying the material through the remesh" loading="lazy" decoding="async" />
</a>
<div class="card-body">
<h2><a href="gn-sdf-remesh/">gn-sdf-remesh</a></h2>
<p class="teaches">A Geometry Nodes SDF remesh (MeshToSDFGrid → GridToMesh at the SDF zero-level), with a Set Material node carrying the material through the remesh.</p>
<p class="witnesses"><span class="tag">witnesses</span> An SDF grid is meshed with Grid to Mesh, not Volume to Mesh; GN geometry needs Set Material or it renders untextured.</p>
<a class="card-link" href="gn-sdf-remesh/">View example <span aria-hidden="true">→</span></a>
</div>
</article>
<article class="card" data-tags="depsgraph export">
<a class="card-media" href="depsgraph-export/" aria-label="depsgraph-export example detail page">
<img src="assets/depsgraph-export-hero.webp" alt="depsgraph-export — The depsgraph lifetime contract — evaluated_get()" loading="lazy" decoding="async" />
</a>
<div class="card-body">
<h2><a href="depsgraph-export/">depsgraph-export</a></h2>
<p class="teaches">The depsgraph lifetime contract — evaluated_get().to_mesh() paired with to_mesh_clear() — measured against an OBJ export of the same object.</p>
<p class="witnesses"><span class="tag">witnesses</span> Exports ship evaluated geometry: the exported vertex count equals the subsurf-applied count and is strictly greater than the base mesh.</p>
<a class="card-link" href="depsgraph-export/">View example <span aria-hidden="true">→</span></a>
</div>
</article>
</div>
</main>
<footer>
Generated from <code>examples/gallery.json</code> by <code>scripts/build_gallery.py</code>.
• CC-BY-NC-ND-4.0
</footer>
<script>
(function () {
var btn = document.getElementById('themeToggle');
var root = document.documentElement;
var order = ['auto', 'light', 'dark'];
var glyph = { auto: '\u263C', light: '\u2600', dark: '\u263D' };
function get() { try { return localStorage.getItem('theme') || 'auto'; } catch (e) { return 'auto'; } }
function apply(state) {
if (state === 'light' || state === 'dark') root.setAttribute('data-theme', state);
else root.removeAttribute('data-theme');
try { if (state === 'auto') localStorage.removeItem('theme'); else localStorage.setItem('theme', state); } catch (e) {}
btn.innerHTML = glyph[state]; btn.setAttribute('aria-label', 'Theme: ' + state + ' (click to change)');
}
apply(get());
btn.addEventListener('click', function () {
var next = order[(order.indexOf(get()) + 1) % order.length];
apply(next);
});
})();
(function () {
var chips = document.querySelectorAll('.chip');
var cards = document.querySelectorAll('.card');
chips.forEach(function (chip) {
chip.addEventListener('click', function () {
chips.forEach(function (c) { c.classList.remove('active'); });
chip.classList.add('active');
var tag = chip.getAttribute('data-tag');
cards.forEach(function (card) {
var tags = (card.getAttribute('data-tags') || '').split(' ');
card.classList.toggle('hidden', !!tag && tags.indexOf(tag) === -1);
});
});
});
})();
</script>
</body>
</html>