Hoi cocos2dx heads,
i found a small issue in the addSpriteFramesWithFile method when loading a plist file from the Zwoptex application.
The method tries to read the texture filename from the plist file like this:
CCDictionary<std::string, CCObject*>* metadataDict = (CCDictionary<std::string, CCObject*>*)dict~~>objectForKey);
texturePath = string);
// build texture path relative to plist file
texturePath = CCFileUtils::fullPathFromRelativeFile, pszPath);
which will result in an empty texturePath string.
The Zwoptex plist metadata is currently structured like this:
If we change the code to:
// try to read texture file name from meta data
CCDictionary<std::string, CCObject*>* targetDict = metadataDict~~>objectForKey(string(“target”));
texturePath = string(valueForKey(“textureFileName”, targetDict));
textureFileExtension = string(valueForKey(“textureFileExtension”, targetDict));
it will work.
I don’t know if this also happens with other file formats because i am only using Zwoptex but maybe you can fix this in the next build.
I also know that there is a backup check if a file with the name name exists but a png ending. this is a good workaround but more error prone than reading it directly from the plist. which ususally gets generated together with the png.
I think it would be very helpful if the method would return an autoreleased pointer to the metaDataDict. What do you think about this? It would be cool to be able to work immediately with the metadata without to load it again into memory.