(state: &EditorState)
| 1335 | let has_sep = parts.get(idx + 1).is_some(); |
| 1336 | set_ui_display(ctx, &format!("inspector_chain_chip_{idx}"), has_chip); |
| 1337 | set_ui_display(ctx, &format!("inspector_chain_label_{idx}"), has_chip); |
| 1338 | if idx < 3 { |
| 1339 | set_ui_display(ctx, &format!("inspector_chain_sep_{idx}"), has_sep); |
| 1340 | } |
| 1341 | let Some(label) = parts.get(idx) else { |
| 1342 | continue; |
| 1343 | }; |
| 1344 | set_label(ctx, &format!("inspector_chain_label_{idx}"), label); |
| 1345 | let width = (0.10 + label.len() as f32 * 0.015).clamp(0.16, 0.34); |
| 1346 | set_ui_node_size(ctx, &format!("inspector_chain_chip_{idx}"), (width, 0.96)); |
| 1347 | let (fill, stroke, text) = inspector_chain_chip_colors(parts, idx); |
| 1348 | set_panel_style( |
| 1349 | ctx, |
| 1350 | &format!("inspector_chain_chip_{idx}"), |
| 1351 | fill, |
| 1352 | stroke, |
| 1353 | 0.5, |
| 1354 | ); |
| 1355 | set_label_color(ctx, &format!("inspector_chain_label_{idx}"), text); |
| 1356 | set_label_size_ratio(ctx, &format!("inspector_chain_label_{idx}"), (1.0, 1.0)); |
| 1357 | set_label_text_ratio( |
| 1358 | ctx, |
| 1359 | &format!("inspector_chain_label_{idx}"), |
| 1360 | if idx + 1 == parts.len() { 0.38 } else { 0.40 }, |
| 1361 | ); |
| 1362 | if idx < 3 { |
| 1363 | set_ui_node_size(ctx, &format!("inspector_chain_sep_{idx}"), (0.030, 0.96)); |
| 1364 | } |
| 1365 | } |
| 1366 | } |
| 1367 | |
| 1368 | fn inspector_chain_chip_colors( |
| 1369 | parts: &[String], |
| 1370 | idx: usize, |
| 1371 | ) -> (&'static str, &'static str, &'static str) { |
| 1372 | let label = parts.get(idx).map(String::as_str).unwrap_or_default(); |
| 1373 | let is_3d = parts.iter().any(|part| part == "Node3D"); |
| 1374 | let is_2d = parts.iter().any(|part| part == "Node2D"); |
| 1375 | if label == "Script" { |
| 1376 | ("#29243A", "#A98BEA", "#C5AFF2") |
| 1377 | } else if label == "Node" { |
| 1378 | ("#23272D", "#F2F4F7", "#F2F4F7") |
| 1379 | } else if label == "Node3D" { |
| 1380 | ("#2F261F", "#E59A4E", "#F0B36A") |
| 1381 | } else if is_3d { |
| 1382 | ("#33291C", "#D9852E", "#E8A24A") |
| 1383 | } else if label == "Node2D" { |
| 1384 | ("#1F2A36", "#5DA2FF", "#8EC0FF") |
| 1385 | } else if is_2d { |
| 1386 | ("#1C2C38", "#3E8DD6", "#72B5EA") |
| 1387 | } else { |
| 1388 | ("#23272D", theme::TEXT_DIM, theme::TEXT) |
| 1389 | } |
| 1390 | } |
| 1391 | |
| 1392 | fn apply_inspector_static_layout<API: ScriptAPI + ?Sized>(ctx: &mut ScriptContext<'_, API>) { |
| 1393 | for name in ["add_node_popup", "inspector_pick_popup"] { |
| 1394 | set_ui_node_z_index(ctx, name, 200); |
nothing calls this directly
no test coverage detected