Skip to content
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

Master atlas #281

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

muralisaripalli
Copy link

Requirement:
Skeletons to be able to use assets from multiple atlas files
Avoid duplication of assets by allowing skeletons that will be loaded at later stages to use assets from already loaded atlas files.

Solution:
Main a master store of data from all atlas files. Use this with createSkeletonWithRawAtlas when enabled/configured.

Implementation:
The function masterAtlasParser updates the namespace variable masterAtlasData by appending data of files with the extension .atlas
The implementation can be enabled globally by setting PIXI.spine.useMasterAtlasData to true. If this is set to true, atlasParser uses masterAtlasData with createSkeletonWithRawAtlas. Specific skeleton files then can be targeted not to use the masterAtlasData by setting a useMasterAtlasData property to false on their metadata.
If not required globally, this can be enabled on a specific skeleton(s) by setting a useMasterAtlasData property to true on their metadata.

@muralisaripalli
Copy link
Author

@ivanpopelyshev The build failed on Node 7.10 and 8.4 while resolving packages. I did not add any new modules. Should the node versions be updated in travis config or is there an other way to fix this. Thanks in advance

@ivanpopelyshev
Copy link
Collaborator

ivanpopelyshev commented Dec 5, 2018

7.10, 9.4, We'll fix that later, I asked @cursedcoder to look at all failing builds of my pixi plugins.

That's new approach, I have to think if this can be done better.

It looks like you create a full set of Textures for every spine model. I don't know if BaseTextures are cached in this case,

@muralisaripalli
Copy link
Author

Implemented caching of BaseTextures when using master atlas data.

To avoid creation of the full set of Textures for every spine model, do you think we should pass customized atlas data (extracted from master atlas) specific to the current model?

@ivanpopelyshev
Copy link
Collaborator

Hey @muralisaripalli , I remember your solution. Spine loader needs rewrite and when I do it, I will take care of that PR too. I added temp solution for single atlas-multiple models here: https://github.com/pixijs/pixi-spine/blob/master/examples/single_atlas_multiple_models.md

Thank you for that PR once more!

@miltoncandelero
Copy link
Contributor

@muralisaripalli I am looking into migrating the code to the new assets way and for what I see, you merged all .atlas file into one.

That can cause errors if two atlas have the same name for the png file, wouldn't it? 🤔
I do believe that having to manually tell the spine you load that you want to override the automagically detected atlas with a specific one (this method https://github.com/pixijs/pixi-spine/blob/master/examples/single_atlas_multiple_models.md ) is a bit better, but I want to know what you think 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants