-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parse images on each layer individually for native parser, add toggleLayer() #243
base: main
Are you sure you want to change the base?
Conversation
add toggleLayer(name, visible) function to resource
@mattjennings This is an awesome idea! 🎉 100% down |
I'll run the pixel tests locally to see if I get the same diff |
@mattjennings I checked this locally, AFAIK it looks like a platform rendering difference. I went ahead and switched the image diff to playwright on main too. |
I'm okay with this, I don't think anything can be done with the JSON since the export is already flattened. Perhaps a warning here and a no-op? |
Sorry for spamming your inbox lol, I see you have an error on JSON type, that's probably okay... |
I'm poking around and I think linked cells were just broken in main prior to your change :O |
…o feat/toggle-layers
@eonarheim I was working on resolving the conflicts with latest I'm not really sure what the best solution is here. For fun, I tried making a GraphicGroup and using that as the sprite in the Spritesheet() constructor and it seemed to work but I imagine that'll cause other issues. I wonder if we might need a concept of layering within a Spritesheet. |
I was noodling on this, I wonder if we flatten all the layers into 1 image for the purpose of SpriteSheet? Although that does thwart your desire to toggle layers. Layering a sprite sheet could be interesting... I'll noodle. We could at minimum make a SpriteSheet per layer? |
Yeah unfortunately flattening would kill the layering. The layering is really just done by spitting out a GraphicGroup as the exFrame for the animation. 1 Spritesheet per layer might make sense... then .getSprite() would take an optional layer name. But some people may not want this, so maybe you could opt-in to layering as a resource option? I feel like it's getting pretty icky any way we cut it though. |
===:clipboard: PR Checklist :clipboard:===
==================
This is a very rough initial implementation to toggle layers during runtime (only for native parser, not sure yet how it would be done for JSON). Personally I only need it for the native parser.
Notable changes are each frame on each layer is parsed on their own canvas ctx in order to be drawn individually.
Linked cells need to be tested, not sure if I broke those. The integration test failed for me with minor(?) pixel diffs, so may just be from running on a macbook.
Closes #242
Changes: