More reliable SceneElement tagging

This commit is contained in:
Danny McGee
2024-02-28 19:58:22 -05:00
parent 7fec3eb118
commit 5d89a28ecd
2 changed files with 6 additions and 11 deletions
+5 -1
View File
@@ -131,6 +131,7 @@ pub(super) fn notify_entity_spawn_changes(
mut l_missing_parents: Local<VecDeque<Entity>>,
q_window: Query<&Window, With<PrimaryWindow>>,
q_inspectables: Query<(Entity, &SceneElement)>,
q_element_changes: Query<Entity, Changed<SceneElement>>,
q_others: Query<Entity, Without<SceneElement>>,
q_names: Query<&Name>,
q_parents: Query<&Children>,
@@ -146,6 +147,7 @@ pub(super) fn notify_entity_spawn_changes(
ent,
type_,
&q_inspectables,
&q_element_changes,
&q_names,
&q_parents,
&q_children,
@@ -166,6 +168,7 @@ pub(super) fn notify_entity_spawn_changes(
ent,
SceneElement::Generic,
&q_inspectables,
&q_element_changes,
&q_names,
&q_parents,
&q_children,
@@ -204,11 +207,12 @@ fn build_scene_object(
ent: Entity,
type_: SceneElement,
q_inspectables: &Query<(Entity, &SceneElement)>,
q_element_changes: &Query<Entity, Changed<SceneElement>>,
q_names: &Query<&Name>,
q_parents: &Query<&Children>,
q_children: &Query<&Parent>,
) -> Option<SceneObject> {
if notified.contains(&ent) {
if notified.contains(&ent) && !q_element_changes.contains(ent) {
return None;
}
+1 -10
View File
@@ -395,17 +395,8 @@ fn tag_scene_elements(
mesh_entities: Query<Entity, With<Handle<Mesh>>>,
) {
for (e, children) in q_named_non_primitives.iter() {
let mut has_mesh = false;
for child in children {
if mesh_entities.contains(*child) {
has_mesh = true;
break;
}
}
if has_mesh {
if children.iter().any(|child| mesh_entities.contains(*child)) {
cmd.entity(e).insert(SceneElement::Mesh);
} else {
cmd.entity(e).insert(SceneElement::Generic);
}
}
}