mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-17 00:13:17 +00:00
More reliable SceneElement tagging
This commit is contained in:
@@ -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
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user