BREP_render 0.20.0

BREP Rust rendering engine: kernel-fed scene store + wgpu renderer (headless artifact, desktop window, and wasm canvas shells).
Documentation
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
//! The active PMI view's annotation graphics: dimension lines, extension
//! lines, arcs, leaders and arrowheads baked into the `pmi-overlay` group
//! from the kernel's presentation layout (the SAME layout the STEP file
//! writes), sized in pixels at bake time and re-baked when the zoom or the
//! viewing direction moves materially; plus the label feed the app's chip
//! pass draws.

use super::*;
use brep_kernel::{pmi_present, pmi_type, PmiLayoutStyle, PmiStatus};

const PMI_OVERLAY_GROUP: &str = "pmi-overlay";
/// Arrowhead length, in pixels.
pub(crate) const ARROW_PX: f64 = 12.0;
/// The reference text cap height at 12 pt, in pixels (frames scale with the
/// view's text size).
pub(crate) const TEXT_PX_AT_12PT: f64 = 11.0;
/// PMI line / arrow colour (amber, distinct from the dimension gizmo's rods
/// and the constraint status colours).
const PMI_RGB: [f32; 3] = [0.98, 0.78, 0.22];
/// An exploded view's trace arrows and the instructions' insertion arrows:
/// black on a light ground, near-white on the dark viewport.
const EXPLODE_ARROW_RGB: [f32; 3] = [0.0, 0.0, 0.0];
const EXPLODE_ARROW_ON_DARK_RGB: [f32; 3] = [0.92, 0.94, 0.96];
/// Their filled head's length on screen, px (the reference frames' ~20 px;
/// its width is 0.7 of it).
const INSERTION_HEAD_PX: f64 = 20.0;
/// An error annotation's chip colour.
const ERROR_RGB: [f32; 3] = [0.97, 0.32, 0.29];
/// A disabled annotation's chip colour.
const DISABLED_RGB: [f32; 3] = [0.55, 0.55, 0.55];
/// The error a balloon shows while its target is hidden in the viewport and
/// the view's hidden list has not caught up (no run has happened).
pub(crate) const LIVE_HIDDEN_MESSAGE: &str = "target hidden in the viewport: show it, or update the view's visibility";

/// One chip of [`EngineState::pmi_labels`]; serialised, the
/// `__brepPmiLabels` row.
#[derive(Debug, Clone, PartialEq, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PmiLabel {
    pub id: String,
    #[serde(rename = "type")]
    pub kind: String,
    pub icon: &'static str,
    /// What the chip reads: the resolved text, or the type's glyph and the
    /// id for an error or an empty one.
    pub text: String,
    /// `ok` or `error`.
    pub status: &'static str,
    pub message: String,
    pub color: [f32; 3],
    /// The label anchor, world coordinates.
    pub world: [f64; 3],
    pub enabled: bool,
    /// Its form is open.
    pub open: bool,
    /// Selected in the PMI tree.
    pub selected: bool,
    pub text_size_pt: f64,
}

impl EngineState {
    /// Re-bake the overlay from the cached report (empty without an active
    /// view or while a sketch edit is live).
    pub fn refresh_pmi_overlay(&mut self) {
        let Some(active) = self.pmi_active_view.clone() else {
            self.clear_pmi_overlay();
            return;
        };
        if self.any_sketch_mode() {
            self.clear_pmi_overlay();
            return;
        }
        // Camera movement changes an automatic leader's closest screen point.
        // Fetch missing topology in one batch; the topology callback retries
        // this bake once the last pending balloon can be projected.
        let camera = self.snapshot_camera();
        let ids: Vec<String> = self.pmi_report.as_ref().and_then(|r| r.view(&active))
            .map(|v| v.annotations.iter().filter(|row| matches!(&row.geometry,
                brep_kernel::PmiGeometry::Leader { anchor: Some(a), balloon: true, .. }
                if matches!(a.mode, brep_kernel::BalloonAnchorMode::Surface) && a.camera.as_ref() != Some(&camera)))
                .map(|row| row.id.clone()).collect()).unwrap_or_default();
        let mut missing = Vec::new();
        for id in &ids {
            if let Some(names) = self.pmi_balloon_head_now(id) {
                missing.extend(names);
                self.pmi_balloon_stale = Some(id.clone());
            }
        }
        if !missing.is_empty() {
            missing.sort();
            missing.dedup();
            self.request_exact_solids(missing.iter().map(String::as_str));
            for id in &ids { let _ = self.pmi_balloon_head_now(id); }
        }
        // Borrowed, not cloned: a 500-step view's rows are ~4 ms to copy, every
        // animation frame. Nothing below writes `self` until the bake is done.
        let Some(view) = self.pmi_report.as_ref().and_then(|report| report.view(&active)) else {
            self.clear_pmi_overlay();
            return;
        };
        let text_size = self
            .pmi_state_shared()
            .find_view(&active)
            .map(|view| view.display.text_size_pt)
            .unwrap_or(12.0);
        let wpp = self.camera.world_per_pixel();
        let (_, up, view_dir) = self.camera.basis();
        let style = PmiLayoutStyle {
            arrow: ARROW_PX * wpp,
            text_height: TEXT_PX_AT_12PT * wpp * (text_size / 12.0),
            view_dir,
            view_up: up,
            plane: None,
        };
        let mut lines: Vec<f32> = Vec::new();
        let mut line_colors: Vec<f32> = Vec::new();
        let mut tris: Vec<f32> = Vec::new();
        let mut tri_colors: Vec<f32> = Vec::new();
        let mut explode_step = 0;
        let mut arrows: Vec<([f64; 3], [f64; 3])> = Vec::new();
        let mut center_marks: Vec<(String, Vec<[[f64; 3]; 2]>)> = Vec::new();
        // Part-way through playback, a balloon rides its moving target.
        let playback = self.explode_playback_poses();
        for row in &view.annotations {
            if !row.enabled || row.status != PmiStatus::Ok || self.balloon_target_hidden_live(row) {
                continue;
            }
            // An explode trail follows its step's playback fraction, like its bodies.
            let geometry = if matches!(row.geometry, brep_kernel::PmiGeometry::Explode { .. }) {
                explode_step += 1;
                super::exploded_ops::explode_at(&row.geometry, self.explode_fraction(explode_step - 1))
            } else {
                playback.as_ref().and_then(|poses| poses.shown_geometry(row)).unwrap_or_else(|| row.geometry.clone())
            };
            let label = playback.as_ref().map_or(row.label_world, |poses| poses.shown(row, row.label_world));
            // A picked annotation plane lays the row out in that plane.
            let row_style = PmiLayoutStyle {
                plane: row.plane,
                ..style
            };
            // An explode trace is an insertion arrow (`arrows` below), drawn
            // from the parts where they stand to their seat.
            if let brep_kernel::PmiGeometry::Explode { solids, translate, trace, .. } = &geometry {
                if *trace {
                    let mut now = crate::camera::Aabb::empty();
                    for solid in self.scene.solids() {
                        if solids.iter().any(|s| solid.name == *s || solid.name.strip_prefix(s.as_str()).is_some_and(|rest| rest.starts_with(':'))) {
                            now.union(&solid.bbox);
                        }
                    }
                    if !now.is_empty() {
                        let home = crate::camera::Aabb {
                            min: std::array::from_fn(|k| now.min[k] - translate[k]),
                            max: std::array::from_fn(|k| now.max[k] - translate[k]),
                        };
                        arrows.extend(self.outline_arrow(&home, *translate));
                    }
                }
                continue;
            }
            // A weld callout in symbol style is drawn as its weld symbol from the
            // kernel leader's seam point and the label (the elbow).
            let drawn = match self.weld_symbol_layout(row, &geometry, label) {
                Some((symbol, anchor, elbow, frame)) => {
                    let mut drawn = crate::pmi_weld_symbol::present(&symbol, anchor, elbow, &frame);
                    let strokes: Vec<Vec<[f64; 3]>> = drawn.texts.iter().flat_map(|run| run.strokes()).collect();
                    drawn.polylines.extend(strokes);
                    drawn
                }
                None => pmi_present(&geometry, label, &row.text, &row_style),
            };
            if let brep_kernel::PmiGeometry::CenterMark { marks, .. } = &geometry {
                // Each mark is drawn as six polylines, its two short cross
                // arms first.
                let arm = |line: &Vec<[f64; 3]>| -> [f64; 3] {
                    let d: [f64; 3] = std::array::from_fn(|k| line[1][k] - line[0][k]);
                    let length = (d[0] * d[0] + d[1] * d[1] + d[2] * d[2]).sqrt();
                    if length > 0.0 { d.map(|c| c / length) } else { [0.0; 3] }
                };
                let arms = (0..marks.len())
                    .filter_map(|k| Some([arm(drawn.polylines.get(6 * k)?), arm(drawn.polylines.get(6 * k + 1)?)]))
                    .collect();
                center_marks.push((row.id.clone(), arms));
            }
            let rgb = PMI_RGB;
            for polyline in &drawn.polylines {
                for pair in polyline.windows(2) {
                    for point in pair {
                        lines.extend(point.iter().map(|c| *c as f32));
                        line_colors.extend_from_slice(&rgb);
                    }
                }
            }
            for arrow in &drawn.arrows {
                for point in arrow {
                    tris.extend(point.iter().map(|c| *c as f32));
                    tri_colors.extend_from_slice(&rgb);
                }
                // Both windings, so the arrowhead reads from either side.
                for point in [arrow[0], arrow[2], arrow[1]] {
                    tris.extend(point.iter().map(|c| *c as f32));
                    tri_colors.extend_from_slice(&rgb);
                }
            }
        }
        // The exploded view's traces and the instructions player's insertion
        // arrows: a thin solid line from each moving part to its seat and a
        // filled head there (owner 2026-11-07), in ink that reads on the
        // ground: black on a light one (a Line art step's), near-white on
        // the dark viewport.
        arrows.extend(self.instructions_insertion_arrows());
        let ground = if self.scene.line_art.is_some() { crate::thumbnail::line_art::BACKGROUND } else { self.settings.background };
        let light = 0.2126 * ground[0] + 0.7152 * ground[1] + 0.0722 * ground[2] > 0.5;
        let ink = if light { EXPLODE_ARROW_RGB } else { EXPLODE_ARROW_ON_DARK_RGB };
        for (tail, tip) in arrows {
            let d = [tip[0] - tail[0], tip[1] - tail[1], tip[2] - tail[2]];
            let length = (d[0] * d[0] + d[1] * d[1] + d[2] * d[2]).sqrt();
            if !(length > 1e-9) {
                continue;
            }
            let d = d.map(|v| v / length);
            let head = (INSERTION_HEAD_PX * wpp).min(length * 0.6);
            let w = crate::geometry3d::cross3(view_dir, d);
            let wl = (w[0] * w[0] + w[1] * w[1] + w[2] * w[2]).sqrt();
            let w = if wl > 1e-9 { w.map(|v| v / wl) } else { up };
            let base: [f64; 3] = std::array::from_fn(|k| tip[k] - d[k] * head);
            for point in [tail, base] {
                lines.extend(point.iter().map(|c| *c as f32));
                line_colors.extend_from_slice(&ink);
            }
            let half = head * 0.35;
            let corners = [tip, std::array::from_fn(|k| base[k] + w[k] * half), std::array::from_fn(|k| base[k] - w[k] * half)];
            for point in [corners[0], corners[1], corners[2], corners[0], corners[2], corners[1]] {
                tris.extend(point.iter().map(|c| *c as f32));
                tri_colors.extend_from_slice(&ink);
            }
        }
        let group = if lines.is_empty() && tris.is_empty() {
            serde_json::json!({ "name": PMI_OVERLAY_GROUP })
        } else {
            serde_json::json!({
                "name": PMI_OVERLAY_GROUP,
                "renderOrder": 10001,
                "lines": { "positions": lines, "colors": line_colors },
                "tris": { "positions": tris, "colors": tri_colors },
            })
        };
        let _ = self.set_overlay_json(&serde_json::json!({ "groups": [group] }).to_string());
        self.pmi_overlay_key = Some((if wpp > 0.0 { wpp } else { f64::MIN_POSITIVE }, view_dir));
        self.pmi_center_marks_drawn = (center_marks, view_dir);
        self.dirty = true;
    }

    /// The center marks the PMI overlay last drew, for automation:
    /// `{viewDir, marks: [{id, arms: [[u, v], …]}]}` — per mark the cross's
    /// two arms as unit world directions (f64, before the overlay's f32
    /// buffers) and the view direction of that bake, so a check can see the
    /// overlay re-baked while the arms held still.
    pub fn pmi_center_marks_json(&self) -> String {
        let (marks, view_dir) = &self.pmi_center_marks_drawn;
        serde_json::json!({
            "viewDir": view_dir,
            "marks": marks.iter().map(|(id, arms)| serde_json::json!({ "id": id, "arms": arms })).collect::<Vec<_>>(),
        })
        .to_string()
    }

    /// Whether a balloon row's target is hidden in the LIVE scene: every
    /// solid its recipe projects onto is invisible now. The kernel resolves
    /// against the view's stored hidden list; a hide made in the viewport
    /// after the run is only known here, so the leader is withheld and the
    /// chip reads as an error until the view's visibility is updated.
    pub(crate) fn balloon_target_hidden_live(&self, row: &brep_kernel::PmiAnnotationReport) -> bool {
        match &row.geometry {
            brep_kernel::PmiGeometry::Leader { balloon: true, anchor: Some(anchor), .. } => {
                !anchor.solids.is_empty()
                    && anchor
                        .solids
                        .iter()
                        .all(|name| self.scene.solid(name).is_none_or(|solid| !solid.visible))
            }
            _ => false,
        }
    }

    fn clear_pmi_overlay(&mut self) {
        self.pmi_center_marks_drawn.0.clear();
        if self.pmi_overlay_key.take().is_some() {
            let _ = self.set_overlay_json(
                &serde_json::json!({ "groups": [ { "name": PMI_OVERLAY_GROUP } ] }).to_string(),
            );
            self.dirty = true;
        }
    }

    /// Per-frame upkeep: re-bake when the zoom (>0.5 %) or the viewing
    /// direction (>0.5°) moved, so arrowheads stay pixel-sized and face the
    /// camera.
    pub fn ensure_pmi_overlay_current(&mut self) {
        let Some((baked_wpp, baked_dir)) = self.pmi_overlay_key else {
            if self.pmi_active_view.is_some() {
                self.refresh_pmi_overlay();
            }
            return;
        };
        if self.any_sketch_mode() {
            self.clear_pmi_overlay();
            return;
        }
        let wpp = self.camera.world_per_pixel();
        let (_, _, view_dir) = self.camera.basis();
        let dot = baked_dir[0] * view_dir[0] + baked_dir[1] * view_dir[1] + baked_dir[2] * view_dir[2];
        let camera = self.snapshot_camera();
        let balloon_camera_changed = self.pmi_report.as_ref()
            .and_then(|r| self.pmi_active_view.as_ref().and_then(|id| r.view(id)))
            .is_some_and(|v| v.annotations.iter().any(|row| matches!(&row.geometry,
                brep_kernel::PmiGeometry::Leader { anchor: Some(a), balloon: true, .. }
                if matches!(a.mode, brep_kernel::BalloonAnchorMode::Surface) && a.camera.as_ref() != Some(&camera))));
        if balloon_camera_changed || super::overlay_wpp_stale(baked_wpp, wpp) || dot < (0.5f64).to_radians().cos() {
            self.refresh_pmi_overlay();
        }
    }

    /// The label feed for the app's chip pass — the active view's
    /// annotations: `[{id, type, icon, text, status, message, color:[r,g,b],
    /// world:[x,y,z], enabled, open, selected, textSizePt}]`. Empty without an
    /// active view. The automation registry's copy of [`Self::pmi_labels`].
    /// The weld symbol a `weldCallout` row asks for: `None` for another type,
    /// the text-leader style or a weld feature not in the history; `Err` when
    /// one of its numbers does not evaluate (the row then shows the error).
    pub(crate) fn weld_symbol_result(&self, row: &brep_kernel::PmiAnnotationReport) -> Option<Result<crate::pmi_weld_symbol::WeldSymbol, String>> {
        if row.kind != crate::pmi_weld_symbol::WELD_CALLOUT {
            return None;
        }
        let state = self.pmi_state_shared();
        let (_, annotation) = state.find_annotation(&row.id)?;
        let weld_id = annotation.params.get("weld")?.as_str()?.trim().to_string();
        let mut index = 0;
        let weld = loop {
            let id = self.feature_id_at(index)?;
            if id == weld_id && self.feature_type_at(index).as_deref() == Some("WELD") {
                break serde_json::from_str::<serde_json::Value>(&self.feature_params_json(index)).ok()?;
            }
            index += 1;
        };
        let env = brep_kernel::Env::build(&self.history.expressions(), &self.history.configurator()).ok();
        let evaluate = |source: &str| env.as_ref().and_then(|env| env.eval(source).ok());
        crate::pmi_weld_symbol::WeldSymbol::from_params(&annotation.params, &weld, &evaluate).transpose()
    }

    /// The weld symbol a row draws, when it draws one.
    pub(crate) fn weld_symbol(&self, row: &brep_kernel::PmiAnnotationReport) -> Option<crate::pmi_weld_symbol::WeldSymbol> {
        self.weld_symbol_result(row).and_then(Result::ok)
    }

    /// Everything a weld symbol row is drawn from: the symbol, the seam point
    /// (the kernel leader's target), the elbow (the dragged label, else a
    /// screen-space default beside the seam) and the view frame.
    pub(crate) fn weld_symbol_layout(
        &self,
        row: &brep_kernel::PmiAnnotationReport,
        geometry: &brep_kernel::PmiGeometry,
        label: [f64; 3],
    ) -> Option<(crate::pmi_weld_symbol::WeldSymbol, [f64; 3], [f64; 3], crate::pmi_weld_symbol::Frame)> {
        let brep_kernel::PmiGeometry::Leader { targets, .. } = geometry else { return None };
        let anchor = *targets.first()?;
        let symbol = self.weld_symbol(row)?;
        let active = self.pmi_active_view.as_deref()?;
        let state = self.pmi_state_shared();
        let text_size = state.find_view(active).map(|view| view.display.text_size_pt).unwrap_or(12.0);
        let wpp = self.camera.world_per_pixel();
        let (_, up, forward) = self.camera.basis();
        let (height, arrow) = (TEXT_PX_AT_12PT * wpp * (text_size / 12.0), ARROW_PX * wpp);
        // A picked annotation plane holds the symbol, as it holds every planar PMI row.
        let frame = match row.plane {
            Some(plane) => crate::pmi_weld_symbol::Frame::from_plane(plane.normal, plane.x_axis, height, arrow),
            None => crate::pmi_weld_symbol::Frame::from_view(forward, up, height, arrow),
        };
        let dragged = state.find_annotation(&row.id).is_some_and(|(_, annotation)| annotation.label_world.is_some());
        let elbow = if dragged { label } else { crate::pmi_weld_symbol::default_elbow(anchor, &frame) };
        // In a picked annotation plane the elbow (and so the whole symbol) lies
        // in the plane, as the kernel projects a dragged label.
        let elbow = row.plane.map_or(elbow, |plane| plane.project(elbow));
        Some((symbol, anchor, elbow, frame))
    }

    pub fn pmi_labels_json(&self) -> String {
        serde_json::to_string(&self.pmi_labels()).unwrap_or_else(|_| "[]".into())
    }

    /// The label feed, typed: what the viewport's chip pass reads every
    /// frame. It reads the shared parse of the PMI block, so a frame with
    /// nothing changed builds the rows and nothing else.
    pub fn pmi_labels(&self) -> Vec<PmiLabel> {
        let Some(active) = self.pmi_active_view.as_deref() else {
            return Vec::new();
        };
        let Some(view) = self.pmi_report.as_ref().and_then(|report| report.view(active)) else {
            return Vec::new();
        };
        // An explode step's chip is an editing handle of the PMI workbench; an
        // exploded view shown from the Assembly workbench draws its bodies and
        // trails without them (`exploded_ops`).
        let explode_chips = matches!(self.settings.workbench.as_str(), "pmi" | "all");
        if !explode_chips && view.annotations.iter().all(|row| matches!(row.kind.as_str(), "explode" | "hide")) {
            return Vec::new();
        }
        let text_size = self
            .pmi_state_shared()
            .find_view(active)
            .map(|view| view.display.text_size_pt)
            .unwrap_or(12.0);
        // Part-way through playback a balloon rides its body.
        let playback = self.explode_playback_poses();
        // An explode step draws NO label in the 3D view (owner 2026-10-26:
        // "I don't want to see the exploded labels at all"): its name lives
        // in the PMI tree and the Assembly workbench's step list, and while
        // its form is open the transform gizmo stands on its parts. A hide
        // step draws nothing either: its bodies are not there to label. A
        // center mark or centerline carries no text and draws no chip:
        // its name lives in the PMI tree; only an
        // unresolved one keeps its red chip, the one place its error shows
        // in the view.
        view.annotations
            .iter()
            .filter(|row| !matches!(row.kind.as_str(), "explode" | "hide"))
            .filter(|row| !(row.kind == "centerline" && row.status == PmiStatus::Ok))
            .map(|row| {
                // A balloon whose target was hidden in the viewport AFTER
                // the run (the view's hidden list not yet updated) is an
                // error chip with no leader: the kernel's head is on a body
                // nobody sees.
                let (status, message) = if row.status == PmiStatus::Ok && self.balloon_target_hidden_live(row) {
                    (PmiStatus::Error, LIVE_HIDDEN_MESSAGE.to_string())
                } else if let (PmiStatus::Ok, Some(Err(error))) = (row.status, self.weld_symbol_result(row)) {
                    // A weld symbol number that does not evaluate: the row shows
                    // its text leader and this error, never a silently empty field.
                    (PmiStatus::Error, error)
                } else {
                    (row.status, row.message.clone())
                };
                let color = if status == PmiStatus::Error {
                    ERROR_RGB
                } else if !row.enabled {
                    DISABLED_RGB
                } else {
                    PMI_RGB
                };
                let icon = pmi_type(&row.kind).map(|def| def.icon).unwrap_or("");
                let text = if status == PmiStatus::Error || row.text.is_empty() {
                    format!("{} {}", icon, row.id)
                } else if self.weld_symbol(row).is_some() {
                    // The symbol carries the weld's texts; its chip is just the
                    // handle (the type icon), so it does not cover the symbol.
                    icon.to_string()
                } else {
                    row.text.clone()
                };
                PmiLabel {
                    id: row.id.clone(),
                    kind: row.kind.clone(),
                    icon,
                    text,
                    status: match status { PmiStatus::Ok => "ok", PmiStatus::Error => "error" },
                    message,
                    color,
                    world: match self.weld_symbol_layout(row, &row.geometry, row.label_world) {
                        Some((_, _, elbow, _)) => elbow,
                        None => playback.as_ref().map_or(row.label_world, |poses| poses.shown(row, row.label_world)),
                    },
                    enabled: row.enabled,
                    open: self.pmi_open_annotation.as_deref() == Some(row.id.as_str()),
                    selected: self.pmi_selected_annotation.as_deref() == Some(row.id.as_str()),
                    text_size_pt: text_size,
                }
            })
            .collect()
    }
}