BSN-spawned Sprite with TextureAtlas from custom-loaded layout renders full texture until a visual field is mutated

Aperta
#26,398 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

Start from the reproduction: a bsn! Sprite with texture_atlas whose layout is a HandleTemplate::Path to a custom-loaded TextureAtlasLayout (menu.atlas.ron#layout). Trace how the template resolves that handle and when the sprite's atlas is applied, since only a real field change fixes it. Add a test that spawns the scene and checks the rendered crop without any mutation. Done when the atlas region applies on the first frame and set_changed() is no longer needed.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

A-Assets A-Rendering C-Bug S-Needs-Investigation

Description:

When spawning a Sprite via bsn! with a TextureAtlas whose layout is provided through HandleTemplate::Path, the sprite renders the entire texture instead of the atlas sub-region specified by index. The correct cropped region only appears after manually assigning a different value to a visual field (e.g., index, flip_x, color).

Waiting for frames to pass, calling set_changed(), or reassigning a field to its current value has no effect.

Note: A custom AssetLoader for TextureAtlasLayout is implemented and used to load the layout from menu.atlas.ron#layout. The layout asset itself loads successfully — after the manual visual mutation, the correct region is displayed.

Reproduction:

fn menu() -> impl Scene {
    bsn! {
        Sprite {
            image: "menu.atlas.ron#texture",
            texture_atlas: {
                TextureAtlasTemplate {
                    layout: HandleTemplate::Path("menu.atlas.ron#layout".into()),
                    index: 0,
                }
            }
        }
    }
}

Expected: The sprite renders only the region defined by the TextureAtlasLayout at index 0.

Actual:

  • The sprite renders the full texture, as if texture_atlas were None.
  • sprite.set_changed() and assigning the same value do not fix it.
  • Only a real visual change (different index, flipped boolean, changed color) triggers correct atlas cropping.
Lingua principale
Rust
Stelle
49.7k
Fork
5k
Merge medio
3g 19h
PR unite (30g)
134

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bevyengine/bevy

Tutte le issue di bevyengine/bevy

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.