From 73c653445f341f04dc6ff277435ecce179a8f5d1 Mon Sep 17 00:00:00 2001 From: John Mitchell <6656977+StarArawn@users.noreply.github.com> Date: Wed, 26 Apr 2023 13:50:22 -0400 Subject: [PATCH] Fixed some more issues. --- src/children.rs | 4 +++- src/context.rs | 10 +++++++--- src/render/unified/pipeline.rs | 1 - 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/children.rs b/src/children.rs index a956d2f..d670c06 100644 --- a/src/children.rs +++ b/src/children.rs @@ -58,7 +58,9 @@ impl KChildren { ) { for child in self.inner.iter() { if let Some(parent_id) = parent_id { - commands.entity(*child).set_parent(parent_id); + if let Some(mut entity_commands) = commands.get_entity(*child) { + entity_commands.set_parent(parent_id); + } } widget_context.add_widget(parent_id, *child); } diff --git a/src/context.rs b/src/context.rs index e06dc2d..bfb1023 100644 --- a/src/context.rs +++ b/src/context.rs @@ -1056,12 +1056,12 @@ fn update_widget( commands.entity(entity.0).remove::<Mounted>(); let diff = if let Ok(tree) = tree.read() { - tree.diff_children(&widget_context, entity, UPDATE_DEPTH) + tree.diff_children(&widget_context, entity, 0) } else { panic!("Failed to acquire read lock."); }; - // log::info!("Entity: {:?}, Diff: {:?}", entity.0, &diff); + log::trace!("Entity: {:?}, Diff: {:?}", entity.0, &diff); // Always mark widget dirty if it's re-rendered. // Mark node as needing a recalculation of rendering/layout. @@ -1078,7 +1078,11 @@ fn update_widget( entity_commands.insert(Mounted); entity_commands.set_parent(parent.0); } - world.entity_mut(parent.0).add_child(changed_entity.0); + if world.get_entity(changed_entity.0).is_some() { + if let Some(mut entity_commands) = world.get_entity_mut(parent.0) { + entity_commands.add_child(changed_entity.0); + } + } } else if changes .iter() .any(|change| matches!(change, Change::Deleted)) diff --git a/src/render/unified/pipeline.rs b/src/render/unified/pipeline.rs index 6a4ccf0..2291065 100644 --- a/src/render/unified/pipeline.rs +++ b/src/render/unified/pipeline.rs @@ -791,7 +791,6 @@ pub fn queue_quads_inner( }); } else { // Skip unloaded texture. - dbg!("Skip texture not loaded in!"); return; } } -- GitLab