Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spritebuilder/CCBAnimationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ ActionInterval* CCBAnimationManager::getAction(CCBKeyframe *pKeyframe0, CCBKeyfr
return Sequence::createWithTwoActions(DelayTime::create(duration), Hide::create());
}
}
else if (propName == "displayFrame")
else if (propName == "displayFrame" || propName == "spriteFrame")
{
return Sequence::createWithTwoActions(DelayTime::create(duration),
CCBSetSpriteFrame::create(static_cast<SpriteFrame*>(pKeyframe1->getObject())));
Expand Down Expand Up @@ -503,7 +503,7 @@ void CCBAnimationManager::setAnimatedProperty(const std::string& propName, Node
unsigned char opacity = value.asFloat() * 255.0f;//value.asByte();
pNode->setOpacity(opacity);
}
else if (propName == "displayFrame")
else if (propName == "displayFrame" || propName == "spriteFrame")
{
static_cast<Sprite*>(pNode)->setSpriteFrame(static_cast<SpriteFrame*>(obj));
}
Expand Down
12 changes: 10 additions & 2 deletions spritebuilder/CCBReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,14 @@ float CCBReader::getPTMRatio() {
void CCBReader::setupSpriteBuilder(const char* resourcePath, float ptmRatio) {

_ptmRatio = ptmRatio;

std::vector<std::string> searchPath;
searchPath.push_back("Published-iOS");
FileUtils::getInstance()->setSearchPaths(searchPath);
// FileUtils::getInstance()->addSearchPath("Published-iOS")
char docPath[256] = {0};
sprintf(docPath, "%s/Published-iOS", FileUtils::getInstance()->getWritablePath().c_str());
FileUtils::getInstance()->addSearchPath(docPath, true);

FileUtils::getInstance()->addSearchResolutionsOrder(resourcePath);

FileUtils::getInstance()->loadFilenameLookupDictionaryFromFile("fileLookup.plist");
Expand Down Expand Up @@ -1409,8 +1413,9 @@ CCBKeyframe* CCBReader::readKeyframe(PropertyType type)
std::string spriteFile = readCachedString();
//std::string spriteSheet = readCachedString();

SpriteFrame* spriteFrame;
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFile);
//if (spriteSheet.length() == 0)
if (spriteFrame == nullptr)
{
spriteFile = _CCBRootPath + spriteFile;

Expand All @@ -1435,6 +1440,9 @@ CCBKeyframe* CCBReader::readKeyframe(PropertyType type)
spriteFrame = frameCache->getSpriteFrameByName(spriteFile.c_str());
}
*/

keyframe->setObject(spriteFrame);

} else {
CCASSERT(false, "Unknown keyframe type!");
}
Expand Down
Loading