@synap-core/workspace-templates 0.45.0 → 0.45.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/capabilities/media-blender.capability.json +629 -0
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,629 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiVersion": "synap/v1",
|
|
3
|
+
"kind": "capability",
|
|
4
|
+
"meta": {
|
|
5
|
+
"slug": "media-blender",
|
|
6
|
+
"name": "Blender on your computer",
|
|
7
|
+
"description": "Renders 3D scenes and motion design on your own computer with Blender and a library of named recipes: a still, a shot straight to a movie file, a Python shot script, the film kit's style frames, and a report of what the computer can do. Each render runs in its own background Blender, never in the one you have open. Nothing leaves the computer. Blender is GPL software, installed from its usual source, never bundled.",
|
|
8
|
+
"tags": [
|
|
9
|
+
"capability",
|
|
10
|
+
"media",
|
|
11
|
+
"3d",
|
|
12
|
+
"video",
|
|
13
|
+
"computer"
|
|
14
|
+
],
|
|
15
|
+
"isPublic": true
|
|
16
|
+
},
|
|
17
|
+
"spec": {
|
|
18
|
+
"key": "media-blender",
|
|
19
|
+
"name": "Blender on your computer",
|
|
20
|
+
"description": "Blender, installed on a computer and pinned to its path, plus the recipe library (spec.recipes): each recipe is typed params and argv steps the computer fills, never a shell line, and every step is a fresh background Blender (-b --factory-startup --python-exit-code 1) running a helper script pinned by its sha256. Mac (Apple silicon; Blender 5 ships no Intel Mac build): the Blender already in /Applications is used as it is, else Homebrew's cask blender is installed; the step is a script shown before it runs and never replaces an existing Blender. Linux: the official Blender 5.2.4 LTS x64 tarball from download.blender.org, pinned by its sha256, unpacked in Synap's tools folder (no sudo; about 1.2 GB unpacked). A headless Linux box needs the X11 client libraries the official build links (libSM, libICE: Debian libsm6, libice6), and libEGL for EEVEE; the check fails, naming the missing library, until they are there. The check prints the Blender version and the GPUs Cycles sees (Metal, OptiX, CUDA, HIP, oneAPI); the smoke test renders a 64x36 Cycles frame on the CPU.",
|
|
21
|
+
"licence": "GPL-3.0-or-later",
|
|
22
|
+
"placement": {
|
|
23
|
+
"runsOn": [
|
|
24
|
+
"computer"
|
|
25
|
+
],
|
|
26
|
+
"prefer": [
|
|
27
|
+
"computer"
|
|
28
|
+
],
|
|
29
|
+
"platforms": [
|
|
30
|
+
{
|
|
31
|
+
"os": "darwin",
|
|
32
|
+
"arch": [
|
|
33
|
+
"arm64"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"os": "linux",
|
|
38
|
+
"arch": [
|
|
39
|
+
"x64"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"labels": [
|
|
44
|
+
"gpu?"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"install": {
|
|
48
|
+
"darwin": {
|
|
49
|
+
"steps": [
|
|
50
|
+
{
|
|
51
|
+
"kind": "script",
|
|
52
|
+
"name": "blender-mac.sh",
|
|
53
|
+
"source": "#!/bin/sh\n# blender-mac.sh: use the Blender already in /Applications, or install it with Homebrew (cask blender).\n# Never replaces, upgrades or moves a Blender that is already there.\nset -eu\nAPP=/Applications/Blender.app/Contents/MacOS/Blender\nif [ -x \"$APP\" ]; then\n echo \"Blender is already in /Applications: using it, nothing installed.\"\n exit 0\nfi\nif ! command -v brew >/dev/null 2>&1; then\n echo \"No Blender in /Applications and no Homebrew (https://brew.sh): install Blender from https://www.blender.org/download/ then check again.\" >&2\n exit 3\nfi\necho \"No Blender in /Applications: installing it with Homebrew (brew install --cask blender, about 1.3 GB).\"\nbrew install --cask blender\n[ -x \"$APP\" ] || { echo \"Homebrew finished but there is no $APP\" >&2; exit 1; }\n",
|
|
54
|
+
"sha256": "8f89fa3f4a7e896c5326ffcebd0bd9a0f6f21455f7ebbe9e97f4cfbefc1933a1",
|
|
55
|
+
"elevation": "never"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"bins": {
|
|
59
|
+
"blender": "/Applications/Blender.app/Contents/MacOS/Blender"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"linux": {
|
|
63
|
+
"steps": [
|
|
64
|
+
{
|
|
65
|
+
"kind": "download",
|
|
66
|
+
"what": "archive",
|
|
67
|
+
"url": "https://download.blender.org/release/Blender5.2/blender-5.2.4-linux-x64.tar.xz",
|
|
68
|
+
"sha256": "2fd14c50987426897ba60237ee996edf2b4151f4b1a72a460ca20be58c1d2d86",
|
|
69
|
+
"dest": "{tools}/blender",
|
|
70
|
+
"stripComponents": 1,
|
|
71
|
+
"sizeMb": 368,
|
|
72
|
+
"arch": [
|
|
73
|
+
"x64"
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"bins": {
|
|
78
|
+
"blender": "{tools}/blender/blender"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"elevation": "never",
|
|
82
|
+
"diskFreeMb": 2000
|
|
83
|
+
},
|
|
84
|
+
"verify": {
|
|
85
|
+
"darwin": {
|
|
86
|
+
"command": [
|
|
87
|
+
"blender",
|
|
88
|
+
"-b",
|
|
89
|
+
"--factory-startup",
|
|
90
|
+
"--python-exit-code",
|
|
91
|
+
"1",
|
|
92
|
+
"--python-expr",
|
|
93
|
+
"import bpy\nprint(\"BLENDER_VERSION\", bpy.app.version_string)\nfound = []\nprefs = bpy.context.preferences.addons[\"cycles\"].preferences\nfor kind in (\"METAL\", \"OPTIX\", \"CUDA\", \"HIP\", \"ONEAPI\"):\n try:\n prefs.compute_device_type = kind\n prefs.get_devices()\n except Exception:\n continue\n found += [kind + \":\" + d.name for d in prefs.devices if d.type == kind]\nprint(\"BLENDER_GPU\", \", \".join(found) or \"none (Cycles renders on the CPU)\")"
|
|
94
|
+
],
|
|
95
|
+
"expect": {
|
|
96
|
+
"exitCode": 0,
|
|
97
|
+
"stdoutMatches": "BLENDER_VERSION (\\d+\\.\\d+(?:\\.\\d+)?)"
|
|
98
|
+
},
|
|
99
|
+
"captureVersion": 1,
|
|
100
|
+
"smoke": {
|
|
101
|
+
"command": [
|
|
102
|
+
"blender",
|
|
103
|
+
"-b",
|
|
104
|
+
"--factory-startup",
|
|
105
|
+
"--python-exit-code",
|
|
106
|
+
"1",
|
|
107
|
+
"--python-expr",
|
|
108
|
+
"import bpy\nsc = bpy.context.scene\nsc.render.engine = \"CYCLES\"\nsc.cycles.device = \"CPU\"\nsc.cycles.samples = 1\nsc.render.resolution_x = 64\nsc.render.resolution_y = 36\nbpy.ops.render.render()\nprint(\"BLENDER_SMOKE_OK\", sc.render.engine)"
|
|
109
|
+
],
|
|
110
|
+
"expect": {
|
|
111
|
+
"exitCode": 0,
|
|
112
|
+
"stdoutContains": "BLENDER_SMOKE_OK"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"linux": {
|
|
117
|
+
"command": [
|
|
118
|
+
"blender",
|
|
119
|
+
"-b",
|
|
120
|
+
"--factory-startup",
|
|
121
|
+
"--python-exit-code",
|
|
122
|
+
"1",
|
|
123
|
+
"--python-expr",
|
|
124
|
+
"import bpy\nprint(\"BLENDER_VERSION\", bpy.app.version_string)\nfound = []\nprefs = bpy.context.preferences.addons[\"cycles\"].preferences\nfor kind in (\"METAL\", \"OPTIX\", \"CUDA\", \"HIP\", \"ONEAPI\"):\n try:\n prefs.compute_device_type = kind\n prefs.get_devices()\n except Exception:\n continue\n found += [kind + \":\" + d.name for d in prefs.devices if d.type == kind]\nprint(\"BLENDER_GPU\", \", \".join(found) or \"none (Cycles renders on the CPU)\")"
|
|
125
|
+
],
|
|
126
|
+
"expect": {
|
|
127
|
+
"exitCode": 0,
|
|
128
|
+
"stdoutMatches": "BLENDER_VERSION (\\d+\\.\\d+(?:\\.\\d+)?)"
|
|
129
|
+
},
|
|
130
|
+
"captureVersion": 1,
|
|
131
|
+
"smoke": {
|
|
132
|
+
"command": [
|
|
133
|
+
"blender",
|
|
134
|
+
"-b",
|
|
135
|
+
"--factory-startup",
|
|
136
|
+
"--python-exit-code",
|
|
137
|
+
"1",
|
|
138
|
+
"--python-expr",
|
|
139
|
+
"import bpy\nsc = bpy.context.scene\nsc.render.engine = \"CYCLES\"\nsc.cycles.device = \"CPU\"\nsc.cycles.samples = 1\nsc.render.resolution_x = 64\nsc.render.resolution_y = 36\nbpy.ops.render.render()\nprint(\"BLENDER_SMOKE_OK\", sc.render.engine)"
|
|
140
|
+
],
|
|
141
|
+
"expect": {
|
|
142
|
+
"exitCode": 0,
|
|
143
|
+
"stdoutContains": "BLENDER_SMOKE_OK"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"timeoutSec": 120,
|
|
148
|
+
"reverifyEvery": "P7D"
|
|
149
|
+
},
|
|
150
|
+
"permissions": {
|
|
151
|
+
"filesystem": [
|
|
152
|
+
{
|
|
153
|
+
"path": "{workdir}",
|
|
154
|
+
"access": "rw"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"path": "{home}",
|
|
158
|
+
"access": "r"
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
"network": [],
|
|
162
|
+
"devices": [
|
|
163
|
+
"gpu"
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
"recipes": [
|
|
167
|
+
{
|
|
168
|
+
"name": "render-still",
|
|
169
|
+
"description": "Render one frame of a .blend (or of a scene a .py script builds) to a PNG, JPEG, TIFF or EXR, with EEVEE or Cycles, in a separate background Blender.",
|
|
170
|
+
"params": {
|
|
171
|
+
"scene": {
|
|
172
|
+
"type": "file",
|
|
173
|
+
"description": "The scene: a .blend file (fonts and images packed into it), or a .py script that builds the scene from an empty file.",
|
|
174
|
+
"required": true
|
|
175
|
+
},
|
|
176
|
+
"out": {
|
|
177
|
+
"type": "output",
|
|
178
|
+
"description": "Where the image is written; its extension picks the format (.png, .jpg, .tif, .exr).",
|
|
179
|
+
"required": true
|
|
180
|
+
},
|
|
181
|
+
"frame": {
|
|
182
|
+
"type": "integer",
|
|
183
|
+
"description": "The frame to render.",
|
|
184
|
+
"default": 1
|
|
185
|
+
},
|
|
186
|
+
"engine": {
|
|
187
|
+
"type": "enum",
|
|
188
|
+
"description": "Render engine: EEVEE (fast, needs a GPU) or CYCLES (path traced, runs on the CPU when there is no GPU).",
|
|
189
|
+
"default": "EEVEE",
|
|
190
|
+
"options": [
|
|
191
|
+
"EEVEE",
|
|
192
|
+
"CYCLES"
|
|
193
|
+
]
|
|
194
|
+
},
|
|
195
|
+
"width": {
|
|
196
|
+
"type": "integer",
|
|
197
|
+
"description": "Width in pixels.",
|
|
198
|
+
"default": 1920
|
|
199
|
+
},
|
|
200
|
+
"height": {
|
|
201
|
+
"type": "integer",
|
|
202
|
+
"description": "Height in pixels.",
|
|
203
|
+
"default": 1080
|
|
204
|
+
},
|
|
205
|
+
"samples": {
|
|
206
|
+
"type": "integer",
|
|
207
|
+
"description": "Samples per pixel (EEVEE TAA or Cycles).",
|
|
208
|
+
"default": 64
|
|
209
|
+
},
|
|
210
|
+
"viewTransform": {
|
|
211
|
+
"type": "enum",
|
|
212
|
+
"description": "View transform. Standard keeps brand colours exact; AgX and Filmic wash them out.",
|
|
213
|
+
"default": "Standard",
|
|
214
|
+
"options": [
|
|
215
|
+
"Standard",
|
|
216
|
+
"AgX",
|
|
217
|
+
"Filmic",
|
|
218
|
+
"Khronos PBR Neutral"
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
"cyclesDevice": {
|
|
222
|
+
"type": "enum",
|
|
223
|
+
"description": "Cycles device: GPU (Metal on a Mac, else OptiX, CUDA, HIP or oneAPI; falls back to the CPU when none is found) or CPU.",
|
|
224
|
+
"default": "GPU",
|
|
225
|
+
"options": [
|
|
226
|
+
"GPU",
|
|
227
|
+
"CPU"
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
"minFreeMb": {
|
|
231
|
+
"type": "integer",
|
|
232
|
+
"description": "Refuse to start when the disk holding the output has less than this many MB free.",
|
|
233
|
+
"default": 1024
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"steps": [
|
|
237
|
+
{
|
|
238
|
+
"program": "blender",
|
|
239
|
+
"args": [
|
|
240
|
+
"-b",
|
|
241
|
+
"--factory-startup",
|
|
242
|
+
"--python-exit-code",
|
|
243
|
+
"1",
|
|
244
|
+
"--python",
|
|
245
|
+
"{script:render_still.py}",
|
|
246
|
+
"--",
|
|
247
|
+
"{scene}",
|
|
248
|
+
"{out}",
|
|
249
|
+
"{frame}",
|
|
250
|
+
"{engine}",
|
|
251
|
+
"{width}",
|
|
252
|
+
"{height}",
|
|
253
|
+
"{samples}",
|
|
254
|
+
"{viewTransform}",
|
|
255
|
+
"{cyclesDevice}",
|
|
256
|
+
"{minFreeMb}"
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
],
|
|
260
|
+
"scripts": [
|
|
261
|
+
{
|
|
262
|
+
"name": "render_still.py",
|
|
263
|
+
"sha256": "c8b8a55ab12e1ebfbd2f4829aeebd3c04d1f16e982326ddf5b470130eb5d2fc5",
|
|
264
|
+
"source": "# render_still.py SCENE OUT FRAME ENGINE WIDTH HEIGHT SAMPLES VIEW DEVICE MIN_FREE_MB\n# Runs inside a background Blender started for this job (never the person's open Blender).\n# Renders one frame of a .blend, or of the scene a .py script builds, to PNG, JPEG, TIFF or EXR.\n# Refuses under the disk floor. Area lights are hidden from the camera; the view transform is set last.\nimport os, runpy, shutil, sys\nimport bpy\n\nscene_path, out, frame, engine, w, h, samples, view, device, floor_mb = sys.argv[sys.argv.index(\"--\") + 1:][:10]\nFORMATS = {\".png\": \"PNG\", \".jpg\": \"JPEG\", \".jpeg\": \"JPEG\", \".tif\": \"TIFF\", \".tiff\": \"TIFF\", \".exr\": \"OPEN_EXR\"}\n\n\ndef disk_floor(path, need_mb):\n free = shutil.disk_usage(path).free // (1024 * 1024)\n if free < need_mb:\n raise SystemExit(f\"refused: {free} MB free at {path}, under the {need_mb} MB floor. Free some space first.\")\n\n\ndef use_engine(sc, engine, samples, device):\n names = [e.identifier for e in bpy.types.RenderSettings.bl_rna.properties[\"engine\"].enum_items]\n if engine == \"EEVEE\":\n sc.render.engine = \"BLENDER_EEVEE_NEXT\" if \"BLENDER_EEVEE_NEXT\" in names else \"BLENDER_EEVEE\"\n sc.eevee.taa_render_samples = samples\n return\n sc.render.engine = \"CYCLES\"\n sc.cycles.samples = samples\n sc.cycles.device = \"CPU\"\n if device == \"GPU\":\n prefs = bpy.context.preferences.addons[\"cycles\"].preferences\n for kind in (\"METAL\", \"OPTIX\", \"CUDA\", \"HIP\", \"ONEAPI\"):\n try:\n prefs.compute_device_type = kind\n prefs.get_devices()\n except Exception:\n continue\n if any(d.type == kind for d in prefs.devices):\n for d in prefs.devices:\n d.use = d.type == kind\n sc.cycles.device = \"GPU\"\n break\n print(\"CYCLES_DEVICE\", sc.cycles.device)\n\n\ndef load(path):\n if path.endswith(\".blend\"):\n bpy.ops.wm.open_mainfile(filepath=path, load_ui=False)\n elif path.endswith(\".py\"):\n argv, sys.argv = sys.argv, [sys.argv[0], \"--\"]\n runpy.run_path(path, run_name=\"__main__\")\n sys.argv = argv\n else:\n raise SystemExit(f\"{os.path.basename(path)} is neither a .blend nor a .py scene script\")\n\n\ndef tidy(sc):\n hidden = 0\n for ob in sc.objects:\n if ob.type == \"LIGHT\" and ob.data.type == \"AREA\" and ob.visible_camera:\n ob.visible_camera = False\n hidden += 1\n print(\"AREA_LIGHTS_HIDDEN\", hidden)\n for f in bpy.data.fonts:\n p = (f.filepath or f.name).lower()\n if \"variable\" in p or \"[\" in p:\n print(\"WARNING variable font\", f.filepath or f.name, \": use a static instance (Geist-Medium.ttf, not Geist[wght].ttf)\")\n\n\next = os.path.splitext(out)[1].lower()\nif ext not in FORMATS:\n raise SystemExit(f\"out must end in {', '.join(FORMATS)}\")\ndisk_floor(os.path.dirname(os.path.abspath(out)), int(floor_mb))\nload(scene_path)\nsc = bpy.context.scene\nsc.frame_set(int(frame))\nsc.render.resolution_x, sc.render.resolution_y, sc.render.resolution_percentage = int(w), int(h), 100\nuse_engine(sc, engine, int(samples), device)\ntidy(sc)\nsc.view_settings.view_transform = view\nsc.view_settings.look = \"None\"\nsc.render.image_settings.file_format = FORMATS[ext]\nbpy.ops.render.render()\nbpy.data.images[\"Render Result\"].save_render(filepath=out, scene=sc)\nprint(\"WROTE\", out, sc.render.engine, sc.view_settings.view_transform)\n"
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
"gotchas": [
|
|
268
|
+
"Each run starts its own background Blender (-b --factory-startup): never run a recipe inside the person's open Blender session, and never touch the scene they have open.",
|
|
269
|
+
"Standard is the view transform for brand-exact colours: AgX (Blender's default) desaturates the AI yellow and the ochre. The recipe sets it last, after the scene loads.",
|
|
270
|
+
"Area lights must be invisible to the camera, or they show as bright rectangles in frame: the recipe turns off camera visibility on every area light before rendering.",
|
|
271
|
+
"Variable fonts render badly in Blender (wrong weight, broken outlines): load static instances (Geist-Medium.ttf, not Geist[wght].ttf). The recipe prints a WARNING for any variable font it sees.",
|
|
272
|
+
"The disk floor is a refusal, not a warning: the recipe stops before rendering when free space is under minFreeMb (1 GB by default, as the media-factory scripts do).",
|
|
273
|
+
"An EXR keeps scene-linear pixels: the view transform is not baked in. Use PNG for a preview someone will look at.",
|
|
274
|
+
"Factory settings mean no add-ons beyond the defaults and no auto-run of Python inside a .blend: a driver with a Python expression does not evaluate. Bake it, or build the scene from a .py script.",
|
|
275
|
+
"EEVEE (and any script that opens a GPU context, such as the film kit) needs OpenGL/EGL: a headless Linux box without libEGL aborts at start; use CYCLES there, or install the system's libegl1 and Mesa."
|
|
276
|
+
]
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"name": "render-sequence-video",
|
|
280
|
+
"description": "Render a frame range straight to one movie file (H.264 .mp4 or ProRes 422 HQ .mov) through Blender's own FFmpeg output, never a folder of PNG frames; checks the disk first.",
|
|
281
|
+
"params": {
|
|
282
|
+
"scene": {
|
|
283
|
+
"type": "file",
|
|
284
|
+
"description": "The scene: a .blend file (fonts and images packed into it), or a .py script that builds the scene from an empty file.",
|
|
285
|
+
"required": true
|
|
286
|
+
},
|
|
287
|
+
"out": {
|
|
288
|
+
"type": "output",
|
|
289
|
+
"description": "Where the movie is written: .mp4 for H264, .mov for PRORES.",
|
|
290
|
+
"required": true
|
|
291
|
+
},
|
|
292
|
+
"frameStart": {
|
|
293
|
+
"type": "integer",
|
|
294
|
+
"description": "First frame.",
|
|
295
|
+
"default": 1
|
|
296
|
+
},
|
|
297
|
+
"frameEnd": {
|
|
298
|
+
"type": "integer",
|
|
299
|
+
"description": "Last frame; 0 keeps the scene's own end frame.",
|
|
300
|
+
"default": 0
|
|
301
|
+
},
|
|
302
|
+
"fps": {
|
|
303
|
+
"type": "integer",
|
|
304
|
+
"description": "Frames per second.",
|
|
305
|
+
"default": 30
|
|
306
|
+
},
|
|
307
|
+
"engine": {
|
|
308
|
+
"type": "enum",
|
|
309
|
+
"description": "Render engine: EEVEE (fast, needs a GPU) or CYCLES (path traced, runs on the CPU when there is no GPU).",
|
|
310
|
+
"default": "EEVEE",
|
|
311
|
+
"options": [
|
|
312
|
+
"EEVEE",
|
|
313
|
+
"CYCLES"
|
|
314
|
+
]
|
|
315
|
+
},
|
|
316
|
+
"width": {
|
|
317
|
+
"type": "integer",
|
|
318
|
+
"description": "Width in pixels.",
|
|
319
|
+
"default": 1920
|
|
320
|
+
},
|
|
321
|
+
"height": {
|
|
322
|
+
"type": "integer",
|
|
323
|
+
"description": "Height in pixels.",
|
|
324
|
+
"default": 1080
|
|
325
|
+
},
|
|
326
|
+
"samples": {
|
|
327
|
+
"type": "integer",
|
|
328
|
+
"description": "Samples per pixel (EEVEE TAA or Cycles).",
|
|
329
|
+
"default": 64
|
|
330
|
+
},
|
|
331
|
+
"codec": {
|
|
332
|
+
"type": "enum",
|
|
333
|
+
"description": "H264 (.mp4, small, for review and upload) or PRORES (422 HQ .mov, an intermediate to edit or grade).",
|
|
334
|
+
"default": "H264",
|
|
335
|
+
"options": [
|
|
336
|
+
"H264",
|
|
337
|
+
"PRORES"
|
|
338
|
+
]
|
|
339
|
+
},
|
|
340
|
+
"viewTransform": {
|
|
341
|
+
"type": "enum",
|
|
342
|
+
"description": "View transform. Standard keeps brand colours exact; AgX and Filmic wash them out.",
|
|
343
|
+
"default": "Standard",
|
|
344
|
+
"options": [
|
|
345
|
+
"Standard",
|
|
346
|
+
"AgX",
|
|
347
|
+
"Filmic",
|
|
348
|
+
"Khronos PBR Neutral"
|
|
349
|
+
]
|
|
350
|
+
},
|
|
351
|
+
"cyclesDevice": {
|
|
352
|
+
"type": "enum",
|
|
353
|
+
"description": "Cycles device: GPU (Metal on a Mac, else OptiX, CUDA, HIP or oneAPI; falls back to the CPU when none is found) or CPU.",
|
|
354
|
+
"default": "GPU",
|
|
355
|
+
"options": [
|
|
356
|
+
"GPU",
|
|
357
|
+
"CPU"
|
|
358
|
+
]
|
|
359
|
+
},
|
|
360
|
+
"minFreeMb": {
|
|
361
|
+
"type": "integer",
|
|
362
|
+
"description": "Refuse to start when the disk holding the output has less than this many MB free.",
|
|
363
|
+
"default": 2048
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
"steps": [
|
|
367
|
+
{
|
|
368
|
+
"program": "blender",
|
|
369
|
+
"args": [
|
|
370
|
+
"-b",
|
|
371
|
+
"--factory-startup",
|
|
372
|
+
"--python-exit-code",
|
|
373
|
+
"1",
|
|
374
|
+
"--python",
|
|
375
|
+
"{script:render_video.py}",
|
|
376
|
+
"--",
|
|
377
|
+
"{scene}",
|
|
378
|
+
"{out}",
|
|
379
|
+
"{frameStart}",
|
|
380
|
+
"{frameEnd}",
|
|
381
|
+
"{fps}",
|
|
382
|
+
"{engine}",
|
|
383
|
+
"{width}",
|
|
384
|
+
"{height}",
|
|
385
|
+
"{samples}",
|
|
386
|
+
"{codec}",
|
|
387
|
+
"{viewTransform}",
|
|
388
|
+
"{cyclesDevice}",
|
|
389
|
+
"{minFreeMb}"
|
|
390
|
+
]
|
|
391
|
+
}
|
|
392
|
+
],
|
|
393
|
+
"scripts": [
|
|
394
|
+
{
|
|
395
|
+
"name": "render_video.py",
|
|
396
|
+
"sha256": "d45e0cd65c901eb08ee1eb7a484c340504b7ef5f7dcd897c0dbf6854ce617a7e",
|
|
397
|
+
"source": "# render_video.py SCENE OUT START END FPS ENGINE WIDTH HEIGHT SAMPLES CODEC VIEW DEVICE MIN_FREE_MB\n# Runs inside a background Blender started for this job (never the person's open Blender).\n# Renders a frame range straight to one movie file through Blender's FFmpeg output: H.264 .mp4 or\n# ProRes 422 HQ .mov. Never a folder of PNG frames. Refuses when the estimated file plus the floor\n# does not fit on the disk. Area lights are hidden from the camera; the view transform is set last.\nimport glob, os, runpy, shutil, sys\nimport bpy\n\n(scene_path, out, start, end, fps, engine, w, h, samples, codec, view, device, floor_mb) = sys.argv[sys.argv.index(\"--\") + 1:][:13]\n# Rough size per second of 1080p video, in MB: ProRes 422 HQ is about 220 Mbit/s; H.264 at CRF high about 12.\nMB_PER_SEC_1080 = {\"PRORES\": 28.0, \"H264\": 1.5}\n\n\ndef disk_floor(path, need_mb):\n free = shutil.disk_usage(path).free // (1024 * 1024)\n if free < need_mb:\n raise SystemExit(f\"refused: {free} MB free at {path}; this render needs about {need_mb} MB (estimate plus floor). Free some space first.\")\n\n\ndef use_engine(sc, engine, samples, device):\n names = [e.identifier for e in bpy.types.RenderSettings.bl_rna.properties[\"engine\"].enum_items]\n if engine == \"EEVEE\":\n sc.render.engine = \"BLENDER_EEVEE_NEXT\" if \"BLENDER_EEVEE_NEXT\" in names else \"BLENDER_EEVEE\"\n sc.eevee.taa_render_samples = samples\n return\n sc.render.engine = \"CYCLES\"\n sc.cycles.samples = samples\n sc.cycles.device = \"CPU\"\n if device == \"GPU\":\n prefs = bpy.context.preferences.addons[\"cycles\"].preferences\n for kind in (\"METAL\", \"OPTIX\", \"CUDA\", \"HIP\", \"ONEAPI\"):\n try:\n prefs.compute_device_type = kind\n prefs.get_devices()\n except Exception:\n continue\n if any(d.type == kind for d in prefs.devices):\n for d in prefs.devices:\n d.use = d.type == kind\n sc.cycles.device = \"GPU\"\n break\n print(\"CYCLES_DEVICE\", sc.cycles.device)\n\n\ndef load(path):\n if path.endswith(\".blend\"):\n bpy.ops.wm.open_mainfile(filepath=path, load_ui=False)\n elif path.endswith(\".py\"):\n argv, sys.argv = sys.argv, [sys.argv[0], \"--\"]\n runpy.run_path(path, run_name=\"__main__\")\n sys.argv = argv\n else:\n raise SystemExit(f\"{os.path.basename(path)} is neither a .blend nor a .py scene script\")\n\n\ndef tidy(sc):\n hidden = 0\n for ob in sc.objects:\n if ob.type == \"LIGHT\" and ob.data.type == \"AREA\" and ob.visible_camera:\n ob.visible_camera = False\n hidden += 1\n print(\"AREA_LIGHTS_HIDDEN\", hidden)\n for f in bpy.data.fonts:\n p = (f.filepath or f.name).lower()\n if \"variable\" in p or \"[\" in p:\n print(\"WARNING variable font\", f.filepath or f.name, \": use a static instance (Geist-Medium.ttf, not Geist[wght].ttf)\")\n\n\ndef has_sound(sc):\n ed = sc.sequence_editor\n if not ed:\n return False\n strips = getattr(ed, \"strips_all\", None) or getattr(ed, \"sequences_all\", None) or []\n return any(s.type == \"SOUND\" for s in strips)\n\n\next = os.path.splitext(out)[1].lower()\nwant = {\"H264\": \".mp4\", \"PRORES\": \".mov\"}[codec]\nif ext != want:\n raise SystemExit(f\"codec {codec} writes a {want} file: name out accordingly\")\nload(scene_path)\nsc = bpy.context.scene\nsc.frame_start = int(start)\nif int(end) > 0:\n sc.frame_end = int(end)\nif sc.frame_end < sc.frame_start:\n raise SystemExit(f\"the range {sc.frame_start}-{sc.frame_end} is empty\")\nsc.render.fps, sc.render.fps_base = int(fps), 1.0\nsc.render.resolution_x, sc.render.resolution_y, sc.render.resolution_percentage = int(w), int(h), 100\nseconds = (sc.frame_end - sc.frame_start + 1) / int(fps)\nestimate = int(seconds * MB_PER_SEC_1080[codec] * int(w) * int(h) / (1920 * 1080)) + 1\nprint(\"ESTIMATE_MB\", estimate, \"for\", round(seconds, 2), \"s\")\ndisk_floor(os.path.dirname(os.path.abspath(out)), int(floor_mb) + estimate)\nuse_engine(sc, engine, int(samples), device)\ntidy(sc)\nsc.view_settings.view_transform = view\nsc.view_settings.look = \"None\"\nr = sc.render\nif hasattr(r.image_settings, \"media_type\"):\n r.image_settings.media_type = \"VIDEO\"\nr.image_settings.file_format = \"FFMPEG\"\nif codec == \"H264\":\n r.ffmpeg.format, r.ffmpeg.codec = \"MPEG4\", \"H264\"\n r.ffmpeg.constant_rate_factor, r.ffmpeg.ffmpeg_preset = \"HIGH\", \"GOOD\"\n r.ffmpeg.gopsize = int(fps) * 2\nelse:\n r.ffmpeg.format, r.ffmpeg.codec = \"QUICKTIME\", \"PRORES\"\n try:\n r.ffmpeg.ffmpeg_prores_profile = \"HQ\"\n except (AttributeError, TypeError):\n pass\nr.ffmpeg.audio_codec = (\"AAC\" if codec == \"H264\" else \"PCM\") if has_sound(sc) else \"NONE\"\nr.filepath, r.use_file_extension = out, True\nbpy.ops.render.render(animation=True)\nif not os.path.exists(out):\n stem = os.path.splitext(out)[0]\n made = sorted(glob.glob(stem + \"*\" + want), key=os.path.getmtime)\n if not made:\n raise SystemExit(\"Blender wrote no movie file\")\n os.replace(made[-1], out)\nprint(\"WROTE\", out, codec, sc.frame_start, sc.frame_end, sc.view_settings.view_transform)\n"
|
|
398
|
+
}
|
|
399
|
+
],
|
|
400
|
+
"gotchas": [
|
|
401
|
+
"Never render a sequence to PNG frames on a tight disk: 1080p PNGs are 3 to 6 MB each, 10 s at 30 fps is up to 1.8 GB. This recipe writes one movie file.",
|
|
402
|
+
"The disk check adds an estimate of the movie (ProRes 422 HQ is about 28 MB per second at 1080p, H.264 about 1.5) to minFreeMb, and refuses when it does not fit.",
|
|
403
|
+
"A crash mid-render leaves a broken movie: render long shots in ranges (frameStart, frameEnd) and join them with media-ffmpeg crossfade-join or a concat.",
|
|
404
|
+
"Use PRORES as the intermediate you will cut, grade or caption, then export once for the platform with a media-ffmpeg export-* recipe.",
|
|
405
|
+
"Standard is the view transform for brand-exact colours: AgX (Blender's default) desaturates the AI yellow and the ochre. The recipe sets it last, after the scene loads.",
|
|
406
|
+
"Area lights must be invisible to the camera, or they show as bright rectangles in frame: the recipe turns off camera visibility on every area light before rendering.",
|
|
407
|
+
"Variable fonts render badly in Blender (wrong weight, broken outlines): load static instances (Geist-Medium.ttf, not Geist[wght].ttf). The recipe prints a WARNING for any variable font it sees.",
|
|
408
|
+
"Each run starts its own background Blender (-b --factory-startup): never run a recipe inside the person's open Blender session, and never touch the scene they have open.",
|
|
409
|
+
"EEVEE (and any script that opens a GPU context, such as the film kit) needs OpenGL/EGL: a headless Linux box without libEGL aborts at start; use CYCLES there, or install the system's libegl1 and Mesa."
|
|
410
|
+
]
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"name": "run-shot-script",
|
|
414
|
+
"description": "Run a Python shot script with JSON params in a separate background Blender with factory settings; the script writes its one result at --out.",
|
|
415
|
+
"params": {
|
|
416
|
+
"script": {
|
|
417
|
+
"type": "file",
|
|
418
|
+
"description": "The shot script (.py). It reads its arguments after \"--\" (argparse) and writes its result at --out.",
|
|
419
|
+
"required": true
|
|
420
|
+
},
|
|
421
|
+
"out": {
|
|
422
|
+
"type": "output",
|
|
423
|
+
"description": "The one file the script writes (a .png, .mp4, .blend…); passed to it as --out.",
|
|
424
|
+
"required": true
|
|
425
|
+
},
|
|
426
|
+
"params": {
|
|
427
|
+
"type": "string",
|
|
428
|
+
"description": "The script's arguments as a JSON object, {\"frame\": 2, \"lang\": \"en\"} -> --frame 2 --lang en (true = a bare flag, false or null = left out); none for no arguments.",
|
|
429
|
+
"default": "none"
|
|
430
|
+
},
|
|
431
|
+
"kitDir": {
|
|
432
|
+
"type": "string",
|
|
433
|
+
"description": "A kit folder on this computer to import from (put on sys.path with its kit/ folder, and in SYNAP_KIT_DIR), or none.",
|
|
434
|
+
"default": "none"
|
|
435
|
+
},
|
|
436
|
+
"minFreeMb": {
|
|
437
|
+
"type": "integer",
|
|
438
|
+
"description": "Refuse to start when the disk holding the output has less than this many MB free.",
|
|
439
|
+
"default": 1024
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
"steps": [
|
|
443
|
+
{
|
|
444
|
+
"program": "blender",
|
|
445
|
+
"args": [
|
|
446
|
+
"-b",
|
|
447
|
+
"--factory-startup",
|
|
448
|
+
"--python-exit-code",
|
|
449
|
+
"1",
|
|
450
|
+
"--python",
|
|
451
|
+
"{script:run_shot.py}",
|
|
452
|
+
"--",
|
|
453
|
+
"{script}",
|
|
454
|
+
"{kitDir}",
|
|
455
|
+
"{params}",
|
|
456
|
+
"{out}",
|
|
457
|
+
"{minFreeMb}"
|
|
458
|
+
]
|
|
459
|
+
}
|
|
460
|
+
],
|
|
461
|
+
"scripts": [
|
|
462
|
+
{
|
|
463
|
+
"name": "run_shot.py",
|
|
464
|
+
"sha256": "fa7ce49c3a4b3d368ee581802d3f49722c0b631a1dcdb9c2a704a262acab9e88",
|
|
465
|
+
"source": "# run_shot.py SCRIPT KIT_DIR PARAMS_JSON OUT MIN_FREE_MB\n# Runs a Python shot script inside a background Blender started for this job, with factory settings\n# (never inside the person's open Blender). PARAMS_JSON (an object, or \"none\") becomes the script's\n# arguments after \"--\": {\"frame\": 2, \"lang\": \"en\", \"save-blend\": true} -> --frame 2 --lang en --save-blend.\n# The script always gets --out OUT and must write its one result there. KIT_DIR (or \"none\") is put on\n# sys.path (KIT_DIR and KIT_DIR/kit) and in the SYNAP_KIT_DIR environment variable.\nimport json, os, runpy, shutil, sys\nimport bpy\n\nscript, kit, params, out, floor_mb = sys.argv[sys.argv.index(\"--\") + 1:][:5]\n\nfree = shutil.disk_usage(os.path.dirname(os.path.abspath(out))).free // (1024 * 1024)\nif free < int(floor_mb):\n raise SystemExit(f\"refused: {free} MB free, under the {floor_mb} MB floor. Free some space first.\")\n\nfwd = []\nif params != \"none\":\n p = json.loads(params)\n if not isinstance(p, dict):\n raise SystemExit(\"params is a JSON object of the script's arguments\")\n if \"out\" in p:\n raise SystemExit(\"params has no out: the recipe passes --out itself\")\n for k, v in p.items():\n if v is False or v is None:\n continue\n fwd.append(\"--\" + k)\n if v is not True:\n fwd.append(v if isinstance(v, str) else json.dumps(v))\nfwd += [\"--out\", out]\n\nif kit != \"none\":\n kit = os.path.abspath(os.path.expanduser(kit))\n if not os.path.isdir(kit):\n raise SystemExit(f\"kitDir {kit} is not a folder on this computer\")\n os.environ[\"SYNAP_KIT_DIR\"] = kit\n sys.path[:0] = [os.path.join(kit, \"kit\"), kit]\n\nprint(\"SHOT\", os.path.basename(script), \" \".join(fwd))\nsys.argv = [bpy.app.binary_path, \"--\", *fwd]\nrunpy.run_path(script, run_name=\"__main__\")\nif not os.path.exists(out) or os.path.getsize(out) == 0:\n raise SystemExit(f\"the shot script wrote nothing at --out {out}\")\nprint(\"WROTE\", out)\n"
|
|
466
|
+
}
|
|
467
|
+
],
|
|
468
|
+
"gotchas": [
|
|
469
|
+
"Each run starts its own background Blender (-b --factory-startup): never run a recipe inside the person's open Blender session, and never touch the scene they have open.",
|
|
470
|
+
"The script runs from the job's folder, not from the kit: a script that finds the kit from its own path (dirname(__file__)) must read SYNAP_KIT_DIR first, or be run with render-styleframes when it is the kit's styleframes.py.",
|
|
471
|
+
"A Python error ends the run with exit 1 (--python-exit-code 1); without that flag Blender would print the traceback and exit 0.",
|
|
472
|
+
"The script starts from factory settings: call bpy.ops.wm.read_factory_settings(use_empty=True) or open a .blend itself; set the Standard view transform for brand colours.",
|
|
473
|
+
"Variable fonts render badly in Blender (wrong weight, broken outlines): load static instances (Geist-Medium.ttf, not Geist[wght].ttf). The recipe prints a WARNING for any variable font it sees.",
|
|
474
|
+
"Area lights must be invisible to the camera, or they show as bright rectangles in frame: the recipe turns off camera visibility on every area light before rendering.",
|
|
475
|
+
"The disk floor is a refusal, not a warning: the recipe stops before rendering when free space is under minFreeMb (1 GB by default, as the media-factory scripts do)."
|
|
476
|
+
]
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
"name": "render-styleframes",
|
|
480
|
+
"description": "Render one style frame of the Synap film kit (shots/styleframes.py: 1 opening, 2 data becomes work, 3 event chain) in French or English, to a PNG.",
|
|
481
|
+
"params": {
|
|
482
|
+
"kitDir": {
|
|
483
|
+
"type": "string",
|
|
484
|
+
"description": "The film kit's blender/ folder on this computer (holding kit/, shots/, strings/), e.g. ~/Documents/Code/synap/videos-launch-blender/blender.",
|
|
485
|
+
"required": true
|
|
486
|
+
},
|
|
487
|
+
"out": {
|
|
488
|
+
"type": "output",
|
|
489
|
+
"description": "Where the PNG is written.",
|
|
490
|
+
"required": true
|
|
491
|
+
},
|
|
492
|
+
"frame": {
|
|
493
|
+
"type": "enum",
|
|
494
|
+
"description": "The style frame: 1 opening (scattered data), 2 signature (data becomes work), 3 event chain in depth.",
|
|
495
|
+
"default": "1",
|
|
496
|
+
"options": [
|
|
497
|
+
"1",
|
|
498
|
+
"2",
|
|
499
|
+
"3"
|
|
500
|
+
]
|
|
501
|
+
},
|
|
502
|
+
"lang": {
|
|
503
|
+
"type": "enum",
|
|
504
|
+
"description": "The language of every on-screen word (strings/<lang>.json).",
|
|
505
|
+
"default": "fr",
|
|
506
|
+
"options": [
|
|
507
|
+
"fr",
|
|
508
|
+
"en"
|
|
509
|
+
]
|
|
510
|
+
},
|
|
511
|
+
"engine": {
|
|
512
|
+
"type": "enum",
|
|
513
|
+
"description": "Render engine: EEVEE (fast, needs a GPU) or CYCLES (path traced, runs on the CPU when there is no GPU).",
|
|
514
|
+
"default": "EEVEE",
|
|
515
|
+
"options": [
|
|
516
|
+
"EEVEE",
|
|
517
|
+
"CYCLES"
|
|
518
|
+
]
|
|
519
|
+
},
|
|
520
|
+
"width": {
|
|
521
|
+
"type": "integer",
|
|
522
|
+
"description": "Width in pixels.",
|
|
523
|
+
"default": 1920
|
|
524
|
+
},
|
|
525
|
+
"height": {
|
|
526
|
+
"type": "integer",
|
|
527
|
+
"description": "Height in pixels.",
|
|
528
|
+
"default": 1080
|
|
529
|
+
},
|
|
530
|
+
"samples": {
|
|
531
|
+
"type": "integer",
|
|
532
|
+
"description": "Samples per pixel (EEVEE TAA or Cycles).",
|
|
533
|
+
"default": 64
|
|
534
|
+
},
|
|
535
|
+
"minFreeMb": {
|
|
536
|
+
"type": "integer",
|
|
537
|
+
"description": "Refuse to start when the disk holding the output has less than this many MB free.",
|
|
538
|
+
"default": 1024
|
|
539
|
+
}
|
|
540
|
+
},
|
|
541
|
+
"steps": [
|
|
542
|
+
{
|
|
543
|
+
"program": "blender",
|
|
544
|
+
"args": [
|
|
545
|
+
"-b",
|
|
546
|
+
"--factory-startup",
|
|
547
|
+
"--python-exit-code",
|
|
548
|
+
"1",
|
|
549
|
+
"--python",
|
|
550
|
+
"{script:render_styleframe.py}",
|
|
551
|
+
"--",
|
|
552
|
+
"{kitDir}",
|
|
553
|
+
"{frame}",
|
|
554
|
+
"{lang}",
|
|
555
|
+
"{engine}",
|
|
556
|
+
"{width}",
|
|
557
|
+
"{height}",
|
|
558
|
+
"{samples}",
|
|
559
|
+
"{out}",
|
|
560
|
+
"{minFreeMb}"
|
|
561
|
+
]
|
|
562
|
+
}
|
|
563
|
+
],
|
|
564
|
+
"scripts": [
|
|
565
|
+
{
|
|
566
|
+
"name": "render_styleframe.py",
|
|
567
|
+
"sha256": "61697a8a62f2829987f695d698f30d31ec1bf032bbb4e57c4461c08d3564ef59",
|
|
568
|
+
"source": "# render_styleframe.py KIT_DIR FRAME LANG ENGINE WIDTH HEIGHT SAMPLES OUT MIN_FREE_MB\n# Runs the film kit's own shots/styleframes.py (from KIT_DIR, the kit's blender/ folder on this computer)\n# for ONE style frame and one language, inside a background Blender started for this job, then moves\n# sf<FRAME>_<LANG>.png to OUT. The kit sets the Standard view transform and its static fonts itself.\nimport os, runpy, shutil, sys, tempfile\nimport bpy\n\nkit, frame, lang, engine, w, h, samples, out, floor_mb = sys.argv[sys.argv.index(\"--\") + 1:][:9]\nkit = os.path.abspath(os.path.expanduser(kit))\nshot = os.path.join(kit, \"shots\", \"styleframes.py\")\nif not os.path.isfile(shot):\n raise SystemExit(f\"no shots/styleframes.py under {kit}: kitDir is the kit's blender/ folder\")\nif not out.lower().endswith(\".png\"):\n raise SystemExit(\"the style frames are PNG: name out *.png\")\nwhere = os.path.dirname(os.path.abspath(out))\nfree = shutil.disk_usage(where).free // (1024 * 1024)\nif free < int(floor_mb):\n raise SystemExit(f\"refused: {free} MB free, under the {floor_mb} MB floor. Free some space first.\")\n\ntmp = tempfile.mkdtemp(prefix=\"sf-\", dir=where)\nsys.argv = [bpy.app.binary_path, \"--\", \"--frame\", frame, \"--lang\", lang, \"--engine\", engine,\n \"--res\", f\"{w}x{h}\", \"--samples\", samples, \"--out\", tmp]\nrunpy.run_path(shot, run_name=\"__main__\")\nmade = os.path.join(tmp, f\"sf{frame}_{lang}.png\")\nif not os.path.isfile(made):\n raise SystemExit(f\"styleframes.py wrote no {os.path.basename(made)}\")\nshutil.move(made, out)\nshutil.rmtree(tmp, ignore_errors=True)\nprint(\"WROTE\", out)\n"
|
|
569
|
+
}
|
|
570
|
+
],
|
|
571
|
+
"gotchas": [
|
|
572
|
+
"kitDir is the kit's blender/ folder on the computer that runs the recipe: the kit's fonts (kit/fonts, static Geist and Fraunces) and strings are read from there, never uploaded.",
|
|
573
|
+
"The kit sets the Standard view transform and hides its area lights itself: do not post-process the PNG inside Blender.",
|
|
574
|
+
"One frame and one language per run: run it three times for 1, 2, 3, and again with lang en.",
|
|
575
|
+
"Commit the kit before a run you will keep: the PNG says nothing about which kit version made it.",
|
|
576
|
+
"The disk floor is a refusal, not a warning: the recipe stops before rendering when free space is under minFreeMb (1 GB by default, as the media-factory scripts do).",
|
|
577
|
+
"EEVEE (and any script that opens a GPU context, such as the film kit) needs OpenGL/EGL: a headless Linux box without libEGL aborts at start; use CYCLES there, or install the system's libegl1 and Mesa."
|
|
578
|
+
]
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
"name": "report",
|
|
582
|
+
"description": "What this computer's Blender can do, as a JSON file: version, build, the GPUs Cycles sees (Metal, OptiX, CUDA, HIP), the render engines and the free disk.",
|
|
583
|
+
"params": {
|
|
584
|
+
"out": {
|
|
585
|
+
"type": "output",
|
|
586
|
+
"description": "Where the JSON report is written (report.json).",
|
|
587
|
+
"required": true
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
"steps": [
|
|
591
|
+
{
|
|
592
|
+
"program": "blender",
|
|
593
|
+
"args": [
|
|
594
|
+
"-b",
|
|
595
|
+
"--factory-startup",
|
|
596
|
+
"--python-exit-code",
|
|
597
|
+
"1",
|
|
598
|
+
"--python",
|
|
599
|
+
"{script:report.py}",
|
|
600
|
+
"--",
|
|
601
|
+
"{out}"
|
|
602
|
+
]
|
|
603
|
+
}
|
|
604
|
+
],
|
|
605
|
+
"scripts": [
|
|
606
|
+
{
|
|
607
|
+
"name": "report.py",
|
|
608
|
+
"sha256": "9e7c67e0563a988587a173b92be85a9d608e1fcb00e3778a829038594fd7260b",
|
|
609
|
+
"source": "# report.py OUT\n# What this computer's Blender can do, as JSON at OUT (and on stdout): version, build, the GPUs Cycles\n# sees (Metal, OptiX, CUDA, HIP, oneAPI), the render engines, and the free disk at home and here.\nimport json, os, platform, shutil, sys\nimport bpy\n\nout = sys.argv[sys.argv.index(\"--\") + 1:][0]\ngpus = []\nprefs = bpy.context.preferences.addons[\"cycles\"].preferences\nfor kind in (\"METAL\", \"OPTIX\", \"CUDA\", \"HIP\", \"ONEAPI\"):\n try:\n prefs.compute_device_type = kind\n prefs.get_devices()\n except Exception:\n continue\n gpus += [f\"{kind}: {d.name}\" for d in prefs.devices if d.type == kind]\nengines = [e.identifier for e in bpy.types.RenderSettings.bl_rna.properties[\"engine\"].enum_items]\nfor c in bpy.types.RenderEngine.__subclasses__():\n name = getattr(c, \"bl_idname\", None)\n if name and name not in engines:\n engines.append(name)\n\n\ndef free_mb(path):\n return shutil.disk_usage(path).free // (1024 * 1024)\n\n\ninfo = {\n \"blender\": bpy.app.version_string,\n \"build\": bpy.app.build_hash.decode() if isinstance(bpy.app.build_hash, bytes) else str(bpy.app.build_hash),\n \"binary\": bpy.app.binary_path,\n \"os\": platform.platform(),\n \"machine\": platform.machine(),\n \"gpu\": gpus,\n \"cycles\": \"GPU\" if gpus else \"CPU only\",\n \"engines\": engines,\n \"freeMb\": {\"home\": free_mb(os.path.expanduser(\"~\")), \"here\": free_mb(os.path.dirname(os.path.abspath(out)))},\n}\nwith open(out, \"w\") as f:\n json.dump(info, f, indent=2)\nprint(json.dumps(info))\n"
|
|
610
|
+
}
|
|
611
|
+
],
|
|
612
|
+
"gotchas": [
|
|
613
|
+
"Run it before a long render: an empty gpu list means Cycles renders on the CPU (slow) and EEVEE may not start.",
|
|
614
|
+
"freeMb.home is the disk the person's files are on: under about 5000, render stills or H.264 only, never ProRes or frame sequences."
|
|
615
|
+
]
|
|
616
|
+
}
|
|
617
|
+
],
|
|
618
|
+
"skills": [
|
|
619
|
+
{
|
|
620
|
+
"name": "run-blender-recipe",
|
|
621
|
+
"kind": "instruction",
|
|
622
|
+
"scope": "pod",
|
|
623
|
+
"description": "How to run one of this capability's Blender recipes on the computer that has it: check the tool, read the gotchas, fill the params, render in a separate background Blender.",
|
|
624
|
+
"code": "# Run a Blender recipe on this computer\n\nThis capability is Blender, installed and checked on a computer, plus named recipes (spec.recipes) that render in a separate background Blender. Use a recipe instead of driving Blender yourself: each one carries the settings that keep a render right (Standard view transform, area lights hidden from the camera, a disk floor, a Python error that fails the run).\n\n1. Check the tool is here: `synap tools verify media-blender`. The check prints the Blender version and the GPU Cycles sees (Metal on a Mac). If it is not installed, ask the person before installing (`synap tools install media-blender`): on a Mac it uses the Blender already in /Applications, else Homebrew's cask.\n2. Before a long render, run `report`: it says the GPU and the free disk. Under about 5 GB free, render stills or H.264 only.\n3. Pick the recipe by name. Read its `gotchas` before you run it.\n4. Fill its `params`: every required one, and change a default only for a reason you can say. A scene is a .blend with its fonts and images packed, or a .py script that builds it.\n5. Run its `steps` with the Blender this capability pinned (`install.<os>.bins`), never whichever Blender is first on PATH, and never inside the person's open Blender session. Each step starts its own `blender -b --factory-startup`; the helper script is written to disk only if its sha256 matches.\n\nRender to a movie (`render-sequence-video`), never to a folder of PNG frames. Keep colour decisions in the scene (Standard view transform); convert, caption and export the result with media-ffmpeg, not inside Blender.\n\nA typical film shot: `report`; `render-styleframes` (or `run-shot-script`) for a still to approve; `render-sequence-video` with codec PRORES for the shot; media-ffmpeg crossfade-join, captions-burn-in, loudness-normalize, then an export-* recipe.\n"
|
|
625
|
+
}
|
|
626
|
+
],
|
|
627
|
+
"provides": []
|
|
628
|
+
}
|
|
629
|
+
}
|