(
ctx: &mut ScriptContext<'_, API>,
root_id: NodeID,
idx: usize,
)
| 44 | |
| 45 | pub fn update_inspector_bitmask_grid<API: ScriptAPI + ?Sized>( |
| 46 | ctx: &mut ScriptContext<'_, API>, |
| 47 | idx: usize, |
| 48 | mask: u32, |
| 49 | ) { |
| 50 | for bit in 1..=32 { |
| 51 | let on = mask & (1_u32 << (bit - 1)) != 0; |
| 52 | let Some(id) = find_named(ctx, &format!("inspector_var_{idx}_bit_{bit}")) else { |
| 53 | continue; |
| 54 | }; |
| 55 | let _ = with_node_mut!(ctx.run, UiButton, id, |node| { |
| 56 | node.style.fill = |
| 57 | Color::from_hex(if on { "#4D84D1" } else { "#2A2F36" }).unwrap_or(node.style.fill); |
| 58 | node.style.stroke = Color::from_hex(if on { "#5A91DD" } else { "#343A43" }) |
| 59 | .unwrap_or(node.style.stroke); |
| 60 | }); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | fn rename_bitmask_instance<API: ScriptAPI + ?Sized>( |
| 65 | ctx: &mut ScriptContext<'_, API>, |
| 66 | root_id: NodeID, |
| 67 | idx: usize, |
| 68 | ) { |
| 69 | let mut stack = vec![root_id]; |
| 70 | while let Some(id) = stack.pop() { |
| 71 | if let Some(children) = ctx.run.Nodes().get_node_children_ids(id) { |
| 72 | stack.extend(children); |
| 73 | } |
no test coverage detected