euv_cli/blender/struct.rs
1use super::*;
2
3/// Configuration for `euv blender doctor`.
4#[derive(Clone, Data, Debug, Eq, PartialEq)]
5pub struct BlenderDoctorConfig {
6 /// Optional explicit path to a Blender executable overriding environment and PATH discovery.
7 pub(crate) blender_bin: Option<PathBuf>,
8 /// Localhost TCP port probed for the official Blender Lab MCP bridge (default `9876`).
9 #[get(type(copy))]
10 pub(crate) mcp_port: u16,
11 /// Whether to invoke Blender in background mode to verify `io_scene_gltf2` readiness.
12 #[get(type(copy))]
13 pub(crate) probe_gltf_exporter: bool,
14}
15
16/// Structured host readiness report produced by `euv blender doctor`.
17#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
18pub struct BlenderDoctorReport {
19 /// Whether a Blender binary was detected on this machine.
20 #[get(type(copy))]
21 pub(crate) blender_found: bool,
22 /// Resolved absolute path to the Blender binary, if found.
23 pub(crate) blender_path: Option<String>,
24 /// Discovery origin (`cli-flag`, `env-var`, `path`, `os-install`, or `not-found`).
25 #[get(type(copy))]
26 pub(crate) binary_source: BlenderBinarySource,
27 /// Raw version line reported by `blender --version`, if available.
28 pub(crate) version_raw: Option<String>,
29 /// Parsed major version (`4`, `5`, etc.).
30 #[get(type(copy))]
31 pub(crate) version_major: Option<u16>,
32 /// Parsed minor version (`0`, `1`, `2`, etc.).
33 #[get(type(copy))]
34 pub(crate) version_minor: Option<u16>,
35 /// Parsed patch version.
36 #[get(type(copy))]
37 pub(crate) version_patch: Option<u16>,
38 /// Whether the detected Blender version meets the `4.0+` glTF 2.0 / Principled BSDF floor.
39 #[get(type(copy))]
40 pub(crate) supports_gltf_exporter: bool,
41 /// Whether Blender's `io_scene_gltf2` operator responded ready.
42 #[get(type(copy))]
43 pub(crate) gltf_exporter_ready: bool,
44 /// Whether the detected Blender version meets the `5.1+` Blender Lab MCP requirement.
45 #[get(type(copy))]
46 pub(crate) supports_blender_mcp_version: bool,
47 /// Whether the `euv_live_link.py` add-on file was detected in a Blender user add-ons directory.
48 #[get(type(copy))]
49 pub(crate) live_link_addon_installed: bool,
50 /// Discovered path to an installed `euv_live_link.py` add-on, if present.
51 pub(crate) live_link_addon_path: Option<String>,
52 /// Default port used by `euv blender live-sync` (`9877`).
53 #[get(type(copy))]
54 pub(crate) live_sync_default_port: u16,
55 /// Probed localhost TCP port for the official Blender Lab MCP bridge (`9876`).
56 #[get(type(copy))]
57 pub(crate) mcp_port: u16,
58 /// Whether the official Blender Lab MCP TCP bridge answered on `127.0.0.1:<mcp_port>`.
59 #[get(type(copy))]
60 pub(crate) mcp_reachable: bool,
61 /// Actionable setup hints when Blender, the Live-Link add-on, or MCP is not yet configured.
62 pub(crate) hints: Vec<String>,
63}
64
65/// Summary of one 64-byte-aligned binary section inside an `.euv3d` archive.
66#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
67pub struct BlenderEuv3dSectionSummary {
68 /// Semantic section label.
69 pub(crate) kind: String,
70 /// Starting byte offset inside the archive.
71 #[get(type(copy))]
72 pub(crate) offset: u64,
73 /// Payload byte length excluding trailing alignment padding.
74 #[get(type(copy))]
75 pub(crate) byte_length: u64,
76 /// Number of logical elements stored in the section.
77 #[get(type(copy))]
78 pub(crate) element_count: u32,
79 /// Whether `offset` is aligned to `64` bytes.
80 #[get(type(copy))]
81 pub(crate) aligned_64: bool,
82}
83
84/// Native `.blend` inspection summary embedded inside `BlenderInspectReport`.
85#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
86pub struct BlenderNativeBlendSummary {
87 /// Formatted Blender version string (`"4.2"`, `"5.1"`, etc.).
88 pub(crate) version: String,
89 /// Pointer width in bytes (`4` or `8`).
90 #[get(type(copy))]
91 pub(crate) pointer_size_bytes: u8,
92 /// Whether the file uses little-endian byte order.
93 #[get(type(copy))]
94 pub(crate) is_little_endian: bool,
95 /// Whether the file uses Blender 5.0+ extended large headers (`LargeBHead8`).
96 #[get(type(copy))]
97 pub(crate) is_large_header_v5: bool,
98 /// Detected container compression (`"none"`, `"gzip"`, or `"zstd"`).
99 pub(crate) compression: String,
100 /// Total number of `BHead` blocks scanned.
101 #[get(type(copy))]
102 pub(crate) block_count: usize,
103 /// Number of SDNA struct definitions parsed from `DNA1`.
104 #[get(type(copy))]
105 pub(crate) dna_struct_count: usize,
106 /// Discovered Scene (`SC`) names.
107 pub(crate) scenes: Vec<String>,
108 /// Discovered Collection (`GR`) names.
109 pub(crate) collections: Vec<String>,
110 /// Discovered Object (`OB`) names.
111 pub(crate) objects: Vec<String>,
112 /// Discovered Mesh (`ME`) names.
113 pub(crate) meshes: Vec<String>,
114 /// Discovered Material (`MA`) names.
115 pub(crate) materials: Vec<String>,
116 /// Discovered Camera (`CA`) names.
117 pub(crate) cameras: Vec<String>,
118 /// Discovered Light (`LA`) names.
119 pub(crate) lights: Vec<String>,
120 /// Discovered Armature (`AR`) names.
121 pub(crate) armatures: Vec<String>,
122 /// Discovered Animation Action (`AC`) names.
123 pub(crate) actions: Vec<String>,
124 /// Discovered Image (`IM`) names.
125 pub(crate) images: Vec<String>,
126 /// Discovered NodeTree (`NT`) names.
127 pub(crate) node_trees: Vec<String>,
128 /// Non-fatal structural warnings recorded during inspection.
129 pub(crate) warnings: Vec<String>,
130}
131
132/// Scene-level geometry, material, rig, and animation inventory for `.glb`, `.gltf`, `.euv3d`, and `.obj` files.
133#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
134pub struct BlenderSceneSummary {
135 /// Scene or root asset name.
136 pub(crate) name: String,
137 /// Generator tool string (e.g., `"Khronos glTF Blender I/O"`).
138 pub(crate) generator: String,
139 /// Total hierarchical scene nodes.
140 #[get(type(copy))]
141 pub(crate) node_count: usize,
142 /// Blender Collection names discovered in `extras.euv`.
143 pub(crate) collections: Vec<String>,
144 /// Total mesh primitives.
145 #[get(type(copy))]
146 pub(crate) mesh_count: usize,
147 /// Sum of `LOD0` vertices across all meshes.
148 #[get(type(copy))]
149 pub(crate) total_vertices: usize,
150 /// Sum of `LOD0` triangles across all meshes.
151 #[get(type(copy))]
152 pub(crate) total_triangles: usize,
153 /// Total Principled BSDF materials.
154 #[get(type(copy))]
155 pub(crate) material_count: usize,
156 /// Ordered material names.
157 pub(crate) material_names: Vec<String>,
158 /// Total decoded textures.
159 #[get(type(copy))]
160 pub(crate) texture_count: usize,
161 /// Total skeletal armature skins.
162 #[get(type(copy))]
163 pub(crate) skin_count: usize,
164 /// Total animation clips.
165 #[get(type(copy))]
166 pub(crate) animation_count: usize,
167 /// Ordered animation clip names.
168 pub(crate) animation_names: Vec<String>,
169 /// Total imported cameras.
170 #[get(type(copy))]
171 pub(crate) camera_count: usize,
172 /// Total imported punctual and area lights.
173 #[get(type(copy))]
174 pub(crate) light_count: usize,
175}
176
177/// Baked `.euv3d` archive summary embedded inside `BlenderInspectReport`.
178#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
179pub struct BlenderEuv3dSummary {
180 /// `.euv3d` format specification version.
181 #[get(type(copy))]
182 pub(crate) format_version: u32,
183 /// Header CRC32 checksum of the payload section bytes.
184 #[get(type(copy))]
185 pub(crate) content_crc32: u32,
186 /// Deterministic 64-bit FNV-1a archive digest.
187 #[get(type(copy))]
188 pub(crate) digest_fnv1a: u64,
189 /// Whether pre-baked SIMD BVH4 acceleration sections are present.
190 #[get(type(copy))]
191 pub(crate) has_bvh4: bool,
192 /// Whether spatial meshlet cluster sections are present.
193 #[get(type(copy))]
194 pub(crate) has_meshlets: bool,
195 /// Whether multi-level QEM LOD chains are present.
196 #[get(type(copy))]
197 pub(crate) has_lods: bool,
198 /// Maximum LOD count across meshes inside the archive.
199 #[get(type(copy))]
200 pub(crate) max_lod_levels: usize,
201 /// Total pre-baked local BVH4 acceleration trees restored without rebuild.
202 #[get(type(copy))]
203 pub(crate) bvh_count: usize,
204 /// Per-section alignment and byte-size breakdown.
205 pub(crate) sections: Vec<BlenderEuv3dSectionSummary>,
206}
207
208/// Unified pure-Rust inspection report produced by `euv blender inspect <file>`.
209#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
210pub struct BlenderInspectReport {
211 /// Inspected file path.
212 pub(crate) path: String,
213 /// Detected 3D asset format (`blend`, `glb`, `gltf`, `euv3d`, `obj`).
214 #[get(type(copy))]
215 pub(crate) format: BlenderAssetFormat,
216 /// File size on disk in bytes.
217 #[get(type(copy))]
218 pub(crate) file_bytes: u64,
219 /// Native `.blend` inspection details when `format == Blend`.
220 pub(crate) blend: Option<BlenderNativeBlendSummary>,
221 /// Scene inventory for `.glb`, `.gltf`, `.euv3d`, and `.obj` files.
222 pub(crate) scene: Option<BlenderSceneSummary>,
223 /// Binary package details when `format == Euv3d`.
224 pub(crate) euv3d: Option<BlenderEuv3dSummary>,
225}
226
227/// Configuration for `euv blender import`.
228#[derive(Clone, Data, Debug, Eq, PartialEq)]
229pub struct BlenderImportConfig {
230 /// Source `.blend`, `.glb`, `.gltf`, or `.obj` file path.
231 pub(crate) input: PathBuf,
232 /// Output directory receiving the imported `.glb`, manifest, and optional `.euv3d`.
233 pub(crate) out_dir: PathBuf,
234 /// Optional explicit Blender binary override for `.blend` files.
235 pub(crate) blender_bin: Option<PathBuf>,
236 /// Whether to also compile an optimized `.euv3d` archive into `out_dir`.
237 #[get(type(copy))]
238 pub(crate) bake: bool,
239 /// Target QEM LOD chain depth when `bake` is enabled (`1..=4`).
240 #[get(type(copy))]
241 pub(crate) lods: usize,
242 /// Whether to build spatial meshlets when `bake` is enabled.
243 #[get(type(copy))]
244 pub(crate) build_meshlets: bool,
245 /// Whether to pre-bake SIMD BVH4 acceleration trees when `bake` is enabled.
246 #[get(type(copy))]
247 pub(crate) bake_bvh4: bool,
248 /// Return a dry-run execution plan without invoking Blender or writing files.
249 #[get(type(copy))]
250 pub(crate) plan: bool,
251}
252
253/// Machine-readable report produced by `euv blender import`.
254#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
255pub struct BlenderImportReport {
256 /// Source asset path.
257 pub(crate) input_path: String,
258 /// Detected source format.
259 #[get(type(copy))]
260 pub(crate) input_format: BlenderAssetFormat,
261 /// Output directory path.
262 pub(crate) out_dir: String,
263 /// Path to the exported or copied `.glb`/`.gltf`/`.obj` file inside `out_dir`, if written.
264 pub(crate) asset_output_path: Option<String>,
265 /// Path to the compiled `.euv3d` file inside `out_dir`, if `--bake` was enabled.
266 pub(crate) baked_euv3d_path: Option<String>,
267 /// Path to the generated `asset-manifest.json` file, if written.
268 pub(crate) manifest_path: Option<String>,
269 /// Planned headless Blender invocation when `--plan` is used or `.blend` was exported.
270 pub(crate) planned_command: Vec<String>,
271 /// Imported scene inventory summary, when executed.
272 pub(crate) scene: Option<BlenderSceneSummary>,
273 /// Elapsed wall-clock duration in milliseconds.
274 #[get(type(copy))]
275 pub(crate) elapsed_ms: u64,
276}
277
278/// Configuration for `euv blender bake`.
279#[derive(Clone, Data, Debug, Eq, PartialEq)]
280pub struct BlenderBakeConfig {
281 /// Source `.blend`, `.glb`, `.gltf`, or `.obj` file path.
282 pub(crate) input: PathBuf,
283 /// Destination `.euv3d` output file path.
284 pub(crate) out_file: PathBuf,
285 /// Optional explicit Blender binary override for `.blend` files.
286 pub(crate) blender_bin: Option<PathBuf>,
287 /// Number of Garland-Heckbert QEM LOD levels (`1..=4`).
288 #[get(type(copy))]
289 pub(crate) lods: usize,
290 /// Whether to generate spatially clustered meshlets.
291 #[get(type(copy))]
292 pub(crate) build_meshlets: bool,
293 /// Whether to pre-bake local SIMD BVH4 acceleration trees.
294 #[get(type(copy))]
295 pub(crate) bake_bvh4: bool,
296 /// Return a dry-run execution plan without running Blender or writing output.
297 #[get(type(copy))]
298 pub(crate) plan: bool,
299}
300
301/// Machine-readable report produced by `euv blender bake`.
302#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
303pub struct BlenderBakeReport {
304 /// Source asset path.
305 pub(crate) input_path: String,
306 /// Detected source format.
307 #[get(type(copy))]
308 pub(crate) input_format: BlenderAssetFormat,
309 /// Written `.euv3d` output file path.
310 pub(crate) out_file: String,
311 /// Input file size in bytes.
312 #[get(type(copy))]
313 pub(crate) input_bytes: u64,
314 /// Compiled `.euv3d` archive size in bytes.
315 #[get(type(copy))]
316 pub(crate) output_bytes: u64,
317 /// Configured QEM LOD levels.
318 #[get(type(copy))]
319 pub(crate) lod_levels: usize,
320 /// Whether spatial meshlets were enabled.
321 #[get(type(copy))]
322 pub(crate) meshlets_enabled: bool,
323 /// Whether pre-baked SIMD BVH4 trees were enabled.
324 #[get(type(copy))]
325 pub(crate) bvh4_enabled: bool,
326 /// Verified CRC32 checksum of the `.euv3d` payload.
327 #[get(type(copy))]
328 pub(crate) content_crc32: u32,
329 /// Verified FNV-1a 64-bit content digest of the `.euv3d` payload.
330 #[get(type(copy))]
331 pub(crate) digest_fnv1a: u64,
332 /// Total section entries written into the `.euv3d` table.
333 #[get(type(copy))]
334 pub(crate) section_count: usize,
335 /// Imported scene inventory summary.
336 pub(crate) scene: Option<BlenderSceneSummary>,
337 /// Planned commands when `--plan` is set.
338 pub(crate) planned_command: Vec<String>,
339 /// Elapsed wall-clock bake time in milliseconds.
340 #[get(type(copy))]
341 pub(crate) elapsed_ms: u64,
342}
343
344/// Configuration for `euv blender addon-install`.
345#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
346pub struct BlenderAddonInstallConfig {
347 /// Explicit destination file or directory path for `euv_live_link.py`.
348 pub(crate) out: Option<PathBuf>,
349 /// When `true`, returns the raw Python source without writing to disk.
350 #[get(type(copy))]
351 pub(crate) print_only: bool,
352}
353
354/// Result report produced by `euv blender addon-install`.
355#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
356pub struct BlenderAddonInstallReport {
357 /// Canonical add-on filename (`euv_live_link.py`).
358 pub(crate) filename: String,
359 /// Destination path written on disk, or `None` when `--print` was requested.
360 pub(crate) installed_path: Option<String>,
361 /// Byte length of the add-on Python source.
362 #[get(type(copy))]
363 pub(crate) byte_length: usize,
364 /// SHA-256 hex digest of the add-on Python source.
365 pub(crate) sha256: String,
366 /// Target Live-Link port embedded by default in the add-on (`9877`).
367 #[get(type(copy))]
368 pub(crate) default_port: u16,
369 /// Human-readable activation steps inside Blender Preferences -> Add-ons.
370 pub(crate) instructions: String,
371}
372
373/// Configuration for `euv blender live-sync`.
374#[derive(Clone, Data, Debug, Eq, PartialEq)]
375pub struct BlenderLiveSyncConfig {
376 /// Host bind address (default `127.0.0.1`).
377 pub(crate) host: String,
378 /// TCP bind port (`9877` default; `0` allocates an ephemeral port).
379 #[get(type(copy))]
380 pub(crate) port: u16,
381 /// Optional directory where hot-swapped `.glb` / `.euv3d` binaries are also persisted.
382 pub(crate) out_dir: Option<PathBuf>,
383 /// SSE keep-alive heartbeat interval in milliseconds.
384 #[get(type(copy))]
385 pub(crate) heartbeat_ms: u64,
386 /// Bounded replay capacity for `GET /blender/events` reconnects.
387 #[get(type(copy))]
388 pub(crate) replay_capacity: usize,
389 /// Maximum accepted binary asset upload size in bytes.
390 #[get(type(copy))]
391 pub(crate) max_asset_bytes: usize,
392 /// Validate listener startup and exit immediately when `true`.
393 #[get(type(copy))]
394 pub(crate) once: bool,
395}
396
397/// Configuration for `euv blender watch`.
398#[derive(Clone, Data, Debug, Eq, PartialEq)]
399pub struct BlenderWatchConfig {
400 /// Watched `.blend`, `.glb`, `.gltf`, `.obj` file or directory path.
401 pub(crate) path: PathBuf,
402 /// Output directory receiving compiled `.euv3d` and manifest artifacts.
403 pub(crate) out_dir: PathBuf,
404 /// Live-Link server bind host.
405 pub(crate) host: String,
406 /// Live-Link server bind port (`9877` default; `0` ephemeral).
407 #[get(type(copy))]
408 pub(crate) port: u16,
409 /// Optional explicit Blender binary override for `.blend` sources.
410 pub(crate) blender_bin: Option<PathBuf>,
411 /// Polling cadence in milliseconds.
412 #[get(type(copy))]
413 pub(crate) poll_ms: u64,
414 /// QEM LOD depth for baked `.euv3d` outputs (`1..=4`).
415 #[get(type(copy))]
416 pub(crate) lods: usize,
417 /// Run a single watch/bake + server check pass then exit cleanly.
418 #[get(type(copy))]
419 pub(crate) once: bool,
420}
421
422/// Machine-readable report produced by `euv blender watch --once` or startup diagnostics.
423#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
424pub struct BlenderWatchReport {
425 /// Watched source file or directory path.
426 pub(crate) watch_path: String,
427 /// Output artifact directory path.
428 pub(crate) out_dir: String,
429 /// Active Live-Link base URL when the `update-server` feature is active.
430 pub(crate) live_sync_url: Option<String>,
431 /// Active SSE stream URL (`<base>/blender/events`), if running.
432 pub(crate) events_url: Option<String>,
433 /// Baked asset reports from the initial synchronization pass.
434 pub(crate) baked_assets: Vec<BlenderBakeReport>,
435 /// Whether the command exited after a single pass (`--once`).
436 #[get(type(copy))]
437 pub(crate) once: bool,
438}
439
440/// Single object transform delta entry posted by `euv_live_link.py` to `POST /blender/delta`.
441#[derive(Clone, Data, Debug, Default, Deserialize, PartialEq, Serialize)]
442pub struct BlenderLiveTransformDelta {
443 /// Blender object or scene node name.
444 pub(crate) name: String,
445 /// Optional world/local Y-up translation `[x, y, z]`.
446 #[get(type(copy))]
447 pub(crate) translation: Option<[f32; 3]>,
448 /// Optional unit Hamilton quaternion `[x, y, z, w]`.
449 #[get(type(copy))]
450 pub(crate) rotation: Option<[f32; 4]>,
451 /// Optional non-uniform scale `[sx, sy, sz]`.
452 #[get(type(copy))]
453 pub(crate) scale: Option<[f32; 3]>,
454 /// Optional viewport visibility toggle.
455 #[get(type(copy))]
456 pub(crate) visible: Option<bool>,
457 /// Optional Blender collection names containing this object.
458 #[serde(default)]
459 pub(crate) collections: Vec<String>,
460}
461
462/// Single camera delta entry posted to `POST /blender/delta`.
463#[derive(Clone, Data, Debug, Default, Deserialize, PartialEq, Serialize)]
464pub struct BlenderLiveCameraDelta {
465 /// Camera name.
466 pub(crate) name: String,
467 /// `true` for perspective projection, `false` for orthographic.
468 #[get(type(copy))]
469 pub(crate) is_perspective: Option<bool>,
470 /// Vertical field of view in degrees.
471 #[get(type(copy))]
472 pub(crate) fov_deg: Option<f32>,
473 /// Orthographic scale width.
474 #[get(type(copy))]
475 pub(crate) ortho_scale: Option<f32>,
476 /// Near clipping plane distance.
477 #[get(type(copy))]
478 pub(crate) clip_start: Option<f32>,
479 /// Far clipping plane distance.
480 #[get(type(copy))]
481 pub(crate) clip_end: Option<f32>,
482 /// Optional camera translation `[x, y, z]`.
483 #[get(type(copy))]
484 pub(crate) translation: Option<[f32; 3]>,
485 /// Optional camera quaternion `[x, y, z, w]`.
486 #[get(type(copy))]
487 pub(crate) rotation: Option<[f32; 4]>,
488}
489
490/// Single light delta entry posted to `POST /blender/delta`.
491#[derive(Clone, Data, Debug, Default, Deserialize, PartialEq, Serialize)]
492pub struct BlenderLiveLightDelta {
493 /// Light name.
494 pub(crate) name: String,
495 /// Light kind (`sun`, `point`, `spot`, `area`, `directional`).
496 pub(crate) kind: Option<String>,
497 /// Linear RGB light color `[r, g, b]`.
498 #[get(type(copy))]
499 pub(crate) color: Option<[f32; 3]>,
500 /// Light intensity / energy scalar.
501 #[get(type(copy))]
502 pub(crate) intensity: Option<f32>,
503 /// Optional area-light width in meters.
504 #[get(type(copy))]
505 pub(crate) width: Option<f32>,
506 /// Optional area-light height in meters.
507 #[get(type(copy))]
508 pub(crate) height: Option<f32>,
509 /// Optional light translation `[x, y, z]`.
510 #[get(type(copy))]
511 pub(crate) translation: Option<[f32; 3]>,
512 /// Optional light quaternion `[x, y, z, w]`.
513 #[get(type(copy))]
514 pub(crate) rotation: Option<[f32; 4]>,
515}
516
517/// Single Principled BSDF material slider delta posted to `POST /blender/delta`.
518#[derive(Clone, Data, Debug, Default, Deserialize, PartialEq, Serialize)]
519pub struct BlenderLiveMaterialDelta {
520 /// Material name.
521 pub(crate) name: String,
522 /// Optional RGBA base color multiplier.
523 #[get(type(copy))]
524 pub(crate) base_color: Option<[f32; 4]>,
525 /// Optional metallic slider in `[0.0, 1.0]`.
526 #[get(type(copy))]
527 pub(crate) metallic: Option<f32>,
528 /// Optional roughness slider in `[0.0, 1.0]`.
529 #[get(type(copy))]
530 pub(crate) roughness: Option<f32>,
531 /// Optional dielectric index of refraction.
532 #[get(type(copy))]
533 pub(crate) ior: Option<f32>,
534 /// Optional specular IOR level factor.
535 #[get(type(copy))]
536 pub(crate) specular: Option<f32>,
537 /// Optional clearcoat weight.
538 #[get(type(copy))]
539 pub(crate) clearcoat: Option<f32>,
540 /// Optional clearcoat roughness.
541 #[get(type(copy))]
542 pub(crate) clearcoat_roughness: Option<f32>,
543 /// Optional optical transmission weight.
544 #[get(type(copy))]
545 pub(crate) transmission: Option<f32>,
546 /// Optional grazing sheen weight.
547 #[get(type(copy))]
548 pub(crate) sheen: Option<f32>,
549 /// Optional sheen roughness.
550 #[get(type(copy))]
551 pub(crate) sheen_roughness: Option<f32>,
552 /// Optional linear emissive RGB.
553 #[get(type(copy))]
554 pub(crate) emissive: Option<[f32; 3]>,
555 /// Optional HDR emissive strength multiplier.
556 #[get(type(copy))]
557 pub(crate) emissive_strength: Option<f32>,
558}
559
560/// Single shape-key / morph-target weights delta posted to `POST /blender/delta`.
561#[derive(Clone, Data, Debug, Default, Deserialize, PartialEq, Serialize)]
562pub struct BlenderLiveMorphDelta {
563 /// Target mesh object name.
564 pub(crate) name: String,
565 /// Ordered shape-key morph weights.
566 #[serde(default)]
567 pub(crate) weights: Vec<f32>,
568}
569
570/// Structured JSON delta packet posted to `POST /blender/delta` and fanned out via SSE.
571#[derive(Clone, Data, Debug, Default, Deserialize, PartialEq, Serialize)]
572pub struct BlenderLiveDeltaPayload {
573 /// Active Blender scene name.
574 #[serde(default)]
575 pub(crate) scene_name: String,
576 /// Optional Blender version string reported by the add-on.
577 pub(crate) blender_version: Option<String>,
578 /// Optional timeline frame index.
579 #[get(type(copy))]
580 pub(crate) frame: Option<i32>,
581 /// Optional client-side monotonic sequence counter.
582 #[get(type(copy))]
583 pub(crate) client_seq: Option<u64>,
584 /// Optional client UNIX millisecond timestamp.
585 #[get(type(copy))]
586 pub(crate) timestamp_ms: Option<u64>,
587 /// Updated object transforms.
588 #[serde(default)]
589 pub(crate) transforms: Vec<BlenderLiveTransformDelta>,
590 /// Updated cameras.
591 #[serde(default)]
592 pub(crate) cameras: Vec<BlenderLiveCameraDelta>,
593 /// Updated punctual and area lights.
594 #[serde(default)]
595 pub(crate) lights: Vec<BlenderLiveLightDelta>,
596 /// Updated Principled BSDF materials.
597 #[serde(default)]
598 pub(crate) materials: Vec<BlenderLiveMaterialDelta>,
599 /// Updated shape-key morph target weights.
600 #[serde(default)]
601 pub(crate) morph_weights: Vec<BlenderLiveMorphDelta>,
602}
603
604/// Metadata broadcast over SSE when a binary `.glb` or `.euv3d` asset is hot-swapped via `POST /blender/asset/{id}`.
605#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
606pub struct BlenderLiveAssetNotice {
607 /// Monotonic Live-Link event sequence number.
608 #[get(type(copy))]
609 pub(crate) seq: u64,
610 /// Sanitized asset identifier (`{id}`).
611 pub(crate) asset_id: String,
612 /// Detected binary format (`glb` or `euv3d`).
613 #[get(type(copy))]
614 pub(crate) format: BlenderAssetFormat,
615 /// Raw asset size in bytes.
616 #[get(type(copy))]
617 pub(crate) size_bytes: usize,
618 /// SHA-256 hex digest of the binary asset bytes.
619 pub(crate) sha256: String,
620 /// Number of meshes verified in the uploaded binary.
621 #[get(type(copy))]
622 pub(crate) mesh_count: usize,
623 /// Number of triangles verified in the uploaded binary.
624 #[get(type(copy))]
625 pub(crate) triangle_count: usize,
626 /// Relative HTTP fetch route (`/blender/asset/{id}`).
627 pub(crate) asset_url: String,
628 /// Optional persisted path on disk when `--out-dir` is configured.
629 pub(crate) disk_path: Option<String>,
630}
631
632/// Stored Live-Link event record cached in the bounded replay buffer for `Last-Event-ID` SSE reconnects.
633#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
634pub struct BlenderLiveEventRecord {
635 /// Monotonic event sequence number used as SSE `id:`.
636 #[get(type(copy))]
637 pub(crate) seq: u64,
638 /// Event kind (`delta` or `asset`).
639 #[get(type(copy))]
640 pub(crate) kind: BlenderLiveEventKind,
641 /// SSE `event:` name (`blender.delta` or `blender.asset`).
642 pub(crate) event_name: String,
643 /// Serialized UTF-8 JSON data payload.
644 pub(crate) json_data: String,
645}
646
647/// Stored binary asset entry held in memory by `BlenderLiveSyncState`.
648#[derive(Clone, Data, Debug, Eq, PartialEq)]
649pub struct BlenderStoredAsset {
650 /// Verified metadata notice for this asset.
651 pub(crate) notice: BlenderLiveAssetNotice,
652 /// Raw `.glb` or `.euv3d` payload bytes served by `GET /blender/asset/{id}`.
653 pub(crate) bytes: Vec<u8>,
654}
655
656/// Machine-readable startup and diagnostics report for `euv blender live-sync`.
657#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
658pub struct BlenderLiveSyncReport {
659 /// Base HTTP URL (`http://host:port`).
660 pub(crate) url: String,
661 /// Delta ingest endpoint (`POST <url>/blender/delta`).
662 pub(crate) delta_url: String,
663 /// Binary asset hot-swap endpoint template (`POST/GET <url>/blender/asset/{id}`).
664 pub(crate) asset_url: String,
665 /// Live SSE event stream endpoint (`GET <url>/blender/events`).
666 pub(crate) events_url: String,
667 /// Status diagnostics endpoint (`GET <url>/blender/status`).
668 pub(crate) status_url: String,
669 /// Current monotonic event sequence number.
670 #[get(type(copy))]
671 pub(crate) latest_seq: u64,
672 /// Total deltas received since startup.
673 #[get(type(copy))]
674 pub(crate) delta_count: u64,
675 /// Total binary asset hot-swaps received since startup.
676 #[get(type(copy))]
677 pub(crate) asset_count: u64,
678 /// Currently cached asset identifiers.
679 pub(crate) asset_ids: Vec<String>,
680 /// Whether the server exited immediately after verifying startup (`--once`).
681 #[get(type(copy))]
682 pub(crate) once: bool,
683}
684
685/// Shared concurrent runtime state backing the Hyperlane `euv blender live-sync` daemon.
686#[cfg(feature = "update-server")]
687#[derive(CustomDebug)]
688pub struct BlenderLiveSyncState {
689 /// Shared Hyperlane SSE pub/sub hub fanning out `blender.delta` and `blender.asset` frames.
690 #[debug(skip)]
691 pub(crate) sse_hub: SseHub,
692 /// Active Hyperlane SSE heartbeat and retry configuration.
693 pub(crate) sse_config: SseConfig,
694 /// Optional directory where uploaded binary assets are mirrored to disk.
695 pub(crate) out_dir: Option<PathBuf>,
696 /// Maximum allowed binary upload size in bytes.
697 pub(crate) max_asset_bytes: usize,
698 /// Maximum number of replay events retained in memory.
699 pub(crate) replay_capacity: usize,
700 /// Monotonic event sequence counter.
701 pub(crate) next_seq: AtomicU64,
702 /// Total accepted JSON delta packets.
703 pub(crate) delta_count: AtomicU64,
704 /// Total accepted binary asset hot-swaps.
705 pub(crate) asset_count: AtomicU64,
706 /// Bounded ring buffer of recent serialized SSE events for `Last-Event-ID` replay.
707 pub(crate) event_log: Mutex<Vec<BlenderLiveEventRecord>>,
708 /// In-memory cache of latest hot-swapped `.glb` / `.euv3d` binaries keyed by asset ID.
709 pub(crate) assets: RwLock<BTreeMap<String, BlenderStoredAsset>>,
710 /// Most recent JSON delta payload received from Blender.
711 pub(crate) latest_delta: RwLock<Option<BlenderLiveDeltaPayload>>,
712 /// Running flag cleared on shutdown.
713 pub(crate) running: AtomicBool,
714}
715
716/// Running handle for an embedded or CLI `euv blender live-sync` Hyperlane HTTP+SSE server.
717#[cfg(feature = "update-server")]
718#[derive(Debug)]
719pub struct BlenderLiveSyncHandle {
720 /// Bound socket address (concrete port even when configured with `port == 0`).
721 pub(crate) address: SocketAddr,
722 /// Shared concurrent Live-Link state.
723 pub(crate) state: Arc<BlenderLiveSyncState>,
724 /// Hyperlane shutdown control hook.
725 pub(crate) control: Option<ServerControlHook>,
726 /// Dedicated Tokio runtime driving the Hyperlane listener.
727 pub(crate) runtime: Option<runtime::Runtime>,
728}
729
730/// Stateless Hyperlane route hook handling `POST /blender/delta`.
731#[cfg(feature = "update-server")]
732#[derive(Clone, Copy, Debug, Default)]
733pub(crate) struct BlenderDeltaRouteHook;
734
735/// Stateless Hyperlane route hook handling `POST /blender/asset/{id}` and `GET /blender/asset/{id}`.
736#[cfg(feature = "update-server")]
737#[derive(Clone, Copy, Debug, Default)]
738pub(crate) struct BlenderAssetRouteHook;
739
740/// Stateless Hyperlane route hook handling `GET /blender/events` SSE streaming.
741#[cfg(feature = "update-server")]
742#[derive(Clone, Copy, Debug, Default)]
743pub(crate) struct BlenderEventsRouteHook;
744
745/// Stateless Hyperlane route hook handling `GET /blender/status` and `GET /healthz`.
746#[cfg(feature = "update-server")]
747#[derive(Clone, Copy, Debug, Default)]
748pub(crate) struct BlenderStatusRouteHook;