spritebuilder / SpriteBuilder

Objective-C Game Development Suite
http://www.spritebuilder.com/
Other
740 stars 292 forks source link

Publishing fixes. #1574

Closed slembcke closed 9 years ago

slembcke commented 9 years ago

Two fixes so far:

  1. Added an argument to FCFormatConverter to request mipmap generation when exporting PVR files.
  2. Spritesheets were being generated incorrectly. (Ex: Foo.plist would contain references to Bar-1x.png, Bar-2x.png and Bar-4x.png) I'm not very certain that my fix for this is correct. It seems like there are a lot of dead paths through the code here that never actually happen.

Will see how far I can get with the metadata generation tomorrow. It's preventing PVR and JPEG files from loading since there is no filename aliasing data exported yet.

@rkachowski and/or @vlidholt If you can review ASAP, that would be helpful. I'm don't know the publishing code very well.

slembcke commented 9 years ago

Bah. Spritesheets no longer pack at exactly the same sizes. Seems as though there were some tests with hardcoded sizes in them. Will look into it more tomorrow morning.

rkachowski commented 9 years ago

I'll look through this, but I'm also not totally familiar with the publishing code.

It seems like there are a lot of dead paths through the code here that never actually happen.

You are almost certainly right, feel free to remove as much as you can

slembcke commented 9 years ago

A little more information about what I changed for the spritesheet fix. Say you were making a spritesheet out of this directory:

Sprites/
  foo.png
  bar.png

It would first rescale the images and output them into the old directory structure in a temporary location:

SomeTempFolder/
  Sprites/ (Not sure what this dir was for...)
  Sprites-phone/
    foor.png
    bar.png
  Sprites-... (same for the -tablet, -tablethd directories)

Then it would make spritesheets out of the -phone, -tablet, etc directories and output them to their final location. Because of the change from directories to suffixes, this was happening:

SomeTempFolder/
  Sprites/
    foor-1x.png
    bar-1x.png
    foor-2x.png
    bar-2x.png
    foor-4x.png
    bar-4x.png
  Sprites-1x/ (these were all empty)
  Sprites-2x/
  Sprites-4x/

The weird thing is that before, spritesheets would be made from both the files in Sprites and Sprites-phone (or -tablet, etc). AFAIK, the untagged directory would be empty. So it would generate sprite sheets with all of the resolutions in a single sprite sheet. The names were also added to the .plist file with the suffixes on them, so Cocos2D couldn't find them.

What I changed was to make it grab all of the (for example) -4x images, strip their resolution tags and build a spritesheet out of them. That's why I'm not terribly happy with the change, it's a little roundabout. Most of the filesystem work the conversion and spritesheet methods are doing seems unnecessary now. This could all be vastly simplified for v2, but it would probably be a lot of work.

slembcke commented 9 years ago

Added a temporary fix that outputs a partial metadata file with just the filename aliases in in when outputting fileLookup.plist. Cocos2D no longer needs the fileLookup.plist file. There are a bunch of SB tests around it though. That needs to get cleaned up at some point.