Skip to content

Commit 8c7f1b3

Browse files
authored
Fix text-2d. (#17674)
# Objective Fix text 2d. Fixes #17670 ## Solution Evidently there's a 1:N extraction going on here that requires using the render entity rather than main entity. ## Testing Text 2d example
1 parent 18c4050 commit 8c7f1b3

File tree

1 file changed

+5
-5
lines changed
  • crates/bevy_sprite/src/render

1 file changed

+5
-5
lines changed

crates/bevy_sprite/src/render/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,9 @@ pub struct SpriteViewBindGroup {
485485
}
486486

487487
#[derive(Resource, Deref, DerefMut, Default)]
488-
pub struct SpriteBatches(HashMap<(RetainedViewEntity, MainEntity), SpriteBatch>);
488+
pub struct SpriteBatches(HashMap<(RetainedViewEntity, Entity), SpriteBatch>);
489489

490-
#[derive(PartialEq, Eq, Clone)]
490+
#[derive(PartialEq, Eq, Clone, Debug)]
491491
pub struct SpriteBatch {
492492
image_handle_id: AssetId<Image>,
493493
range: Range<u32>,
@@ -694,7 +694,7 @@ pub fn prepare_sprite_image_bind_groups(
694694
});
695695

696696
batch_item_index = item_index;
697-
current_batch = Some(batches.entry((*retained_view, item.main_entity())).insert(
697+
current_batch = Some(batches.entry((*retained_view, item.entity())).insert(
698698
SpriteBatch {
699699
image_handle_id: batch_image_handle,
700700
range: index..index,
@@ -846,7 +846,7 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetSpriteTextureBindGrou
846846
pass: &mut TrackedRenderPass<'w>,
847847
) -> RenderCommandResult {
848848
let image_bind_groups = image_bind_groups.into_inner();
849-
let Some(batch) = batches.get(&(view.retained_view_entity, item.main_entity())) else {
849+
let Some(batch) = batches.get(&(view.retained_view_entity, item.entity())) else {
850850
return RenderCommandResult::Skip;
851851
};
852852

@@ -876,7 +876,7 @@ impl<P: PhaseItem> RenderCommand<P> for DrawSpriteBatch {
876876
pass: &mut TrackedRenderPass<'w>,
877877
) -> RenderCommandResult {
878878
let sprite_meta = sprite_meta.into_inner();
879-
let Some(batch) = batches.get(&(view.retained_view_entity, item.main_entity())) else {
879+
let Some(batch) = batches.get(&(view.retained_view_entity, item.entity())) else {
880880
return RenderCommandResult::Skip;
881881
};
882882

0 commit comments

Comments
 (0)