Giter Site home page Giter Site logo

bevy_aseprite's People

Contributors

cmorrison82z avatar eduardorodriguesf avatar jarkonik avatar lemunozm avatar mdenchev avatar noahshomette avatar phigamedevelopment avatar rcornall avatar theneikos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bevy_aseprite's Issues

Independent Scaling

There are situations (for example Rapier collider) where other components scale based off of the Transform scale. This makes it impossible to match the image scale with the collider scale.

Does there exist a "scale_factor", and if not, can we add one?

Blank frames cause panic

If an animation has any empty frames on any visible layer, the game will crash. It's common to have empty frames separating animations in Aseprite to prevent ugly tag-stacking that can occur in bigger files. Here is an example of a timeline that would cause a crash. I also tested with a minimal example that also had the same issue :

cffb38724488d731630ebcb982312781

Release latest changes to bevy_aseprite_derive

Hey, could you make a new release of bevy_aseprite_derive in crates.io with the changes in #4?
I'm using another crate that depends on bevy_aseprite_derive and I'm having the same issue as the description of that PR.
The changes are merged but they're not released. Since it's another repo using it and not bevy_aseprite with path="...", I don't get the changes.

Thanks for this repo, I've been using it a bunch in my pet projects.

How to change to an animation from a different aseprite file?

I have these 2 aseprite files imported:

mod sprites {
    use bevy_aseprite::aseprite;

    aseprite!(pub KnightIdle, "Heroes/Knight/Idle/Idle.aseprite");
    aseprite!(pub KnightRun, "Heroes/Knight/Run/Run.aseprite");
}

And I tried changing the animation in a system like this:

fn change_animation(
    mut query: Query<&mut Handle<Aseprite>, With<Knight>>,
    keyboard_input: Res<Input<KeyCode>>,
    asset_server: Res<AssetServer>,
) {
    for mut aseprite in &mut query {
        if keyboard_input.just_pressed(KeyCode::Space) {
            *aseprite = asset_server.load(sprites::KnightRun::PATH);
        }
    }
}

but when the animation changes i get a crash:

thread '<unnamed>' panicked
Sprite index 4 does not exist for texture atlas handle AssetId<bevy_sprite::texture_atlas::TextureAtlas>{ index: 0, generation: 1}.
Encountered a panic in system `bevy_sprite::render::extract_sprites`!

Cannot work with aseprite files where sprite's Canvas is resized

Description

Panics when spawning a Component that utilizes an .aseprite file where a sprite's Canvas was resized (under certain conditions).

Sample Backtrace

bevy_aseprite_reader-0.1.1/src/computed.rs:765:26:
Image index (1, 9) out of bounds (11, 9)

Steps to reproduce:

  1. in examples folder, open crow.aseprite
  2. Enter canvas resize mode, Sprite (C) -> Canvas Size...
  3. Draw a bounding box starting from the top left, leave default settings, confirm, save
  4. run example
    Should see similar panic as above

Discussion

If you select

-[X] Trim content outside the canvas

the panic will not occur and behave as one would expect.

I imagine the ImageCel's untrimmed bounds are still parsed and present when the above option is not selected. Currently getting familiar with the codebase.

Is there any scenario where we are still interested in using a pixel that is out-of-bounds of the canvas?

"Overlay" layer import issue

Basically, overlay layer is imported into Bevy app as a solid opaque color, instead of being applied as an "additive" value on top as in Aseprite. Maybe alpha is not preserved correctly?

E.g.
image

Results in:
image
(ignore game background)

I've tried changing Sprite -> Color Mode -> RGB Color / Indexed with same results.

Any suggestions how to export / import this layer properly?

Unknown panic

thread 'Compute Task Pool (3)' panicked at 'Image index (32, 7) out of bounds (32,
 16)', /home/myfirstname/.cargo/registry/src/index.crates.io-6/bevy_asepr
ite_reader-0.1.1/src/computed.rs:765:26

Bug: Empty Cels not handled quite correctly

Hi, I appreciate this project, really good work!

I found a bug when parsing an aseprite file w/ the following Frame/Cel/Layer setups:
Screenshot 2024-01-19 at 19 56 44
Screenshot 2024-01-19 at 20 35 59

Diagonally staggered keyframes like this causes resulting frame image to be broken.

I hooked into the AsepriteFrameRange::get_images(&self) fn and wrote all the images to file and they end up looking like this:
Screenshot 2024-01-19 at 19 57 01

Expected frame images:
Screenshot 2024-01-19 at 19 57 05

Thanks again for this cool project :)

EDITED: Simplified scenario and elaborated a bit.

Reader: Layers and Frames are not properly linked

From reading the spec frames and layers should be linked together. Looking at the code this is kind of the case via the image_for_frame but if you want to get a specific layer's frame data its not possible. Suggested API:

impl<'a> AsepriteFrameRange<'a> {
    pub fn get_image_for_layer<N: AsRef<str>>(&self, layer_name: N) {
        ...
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.