Even more bugs. Sorry :(

This commit is contained in:
Franklin 2024-03-24 16:31:25 +01:00
parent 2a38d63847
commit d2cea7f1ab
4 changed files with 7 additions and 5 deletions

2
Cargo.lock generated
View File

@ -608,7 +608,7 @@ dependencies = [
[[package]]
name = "bevy_icon_creator"
version = "0.1.6"
version = "0.1.7"
dependencies = [
"bevy",
]

View File

@ -1,6 +1,6 @@
[package]
name = "bevy_icon_creator"
version = "0.1.6"
version = "0.1.7"
edition = "2021"
authors = ["Franklin E. Blanco"]
description = "A plugin to automatically create Icons from entities/models in bevy"

View File

@ -16,7 +16,7 @@ pub fn update_icon_creator_scenes(
mut images: ResMut<Assets<Image>>,
mut created_icons: ResMut<CreatedIcons>,
) {
for (scene_root_entity, scene_marker, mut scene_root_visibility, mut scene_root_marker) in scene_query.iter_mut() {
'a: for (scene_root_entity, scene_marker, mut scene_root_visibility, mut scene_root_marker) in scene_query.iter_mut() {
for (mut scene_camera, in_scene) in scene_camera_query.iter_mut() {
if scene_marker.0 != in_scene.0 { continue; }
for (scene_parent_entity, in_scene) in scene_entity_parent_query.iter() {
@ -37,6 +37,7 @@ pub fn update_icon_creator_scenes(
scene_camera.target = RenderTarget::Image(camera_target_image_handle);
} else if scene_root_marker.0 >= MIN_FRAMES_TO_RENDER + entity_getting_icon_marker.extra_frames.unwrap_or(0) {
commands.entity(scene_root_entity).remove::<SceneOccupiedMarker>();
scene_root_marker.0 = 0;
if let Some(mut entity_commands) = commands.get_entity(scene_parent_entity) { // Unoccupy
entity_commands.remove::<SceneOccupiedMarker>();
scene_camera.is_active = false;
@ -44,6 +45,7 @@ pub fn update_icon_creator_scenes(
scene_camera.target = RenderTarget::default();
entity_commands.despawn_descendants();
}
continue 'a;
}
}
scene_root_marker.0 += 1;

View File

@ -9,7 +9,7 @@ pub fn mark_all_children_with_component<T: Bundle + Clone>(
) {
if mark_parent {
if let Some(mut entity_commands) = commands.get_entity(entity) {
entity_commands.insert(bundle.clone());
entity_commands.try_insert(bundle.clone());
}
}
mark_all_children_with_component_recursive(commands, entity, children_query, bundle, true);
@ -29,7 +29,7 @@ fn mark_all_children_with_component_recursive<T: Bundle + Clone>(
}
if !first_time {
if let Some(mut entity_commands) = commands.get_entity(entity) {
entity_commands.insert(bundle);
entity_commands.try_insert(bundle);
}
}
}