Fix selection highlight for primitives

This commit is contained in:
Danny McGee
2024-03-21 22:34:44 -04:00
parent cde6b51bc7
commit 8dfc721686
+24 -16
View File
@@ -213,22 +213,30 @@ fn draw_selection_outline(
cmd.entity(ent).remove::<OutlineBundle>(); cmd.entity(ent).remove::<OutlineBundle>();
} }
if let Some(selected_children) = r_selection let Some(selection) = r_selection else {
.as_ref() return;
.and_then(|selection| q_children.get(***selection).ok()) };
{
for &child in selected_children.iter() { let target = if q_meshes.contains(**selection) {
if q_meshes.contains(child) { Some(**selection)
cmd.entity(child).insert(OutlineBundle { } else {
outline: OutlineVolume { q_children.get(**selection).ok().and_then(|children| {
visible: true, children
width: 4., .iter()
colour: Color::YELLOW, .copied()
}, .find(|&child| q_meshes.contains(child))
..default() })
}); };
}
} if let Some(target) = target {
cmd.entity(target).insert(OutlineBundle {
outline: OutlineVolume {
visible: true,
width: 4.,
colour: Color::YELLOW,
},
..default()
});
} }
} }