Skip to content

Commit 05da273

Browse files
committed
Merge branch 'fix/ios9_downloader_bug' of github.com:cezheng/cocos2d-x into v3.10
2 parents 4c8fdc7 + 6d58fc0 commit 05da273

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

cocos/2d/CCFontFNT.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ void FontFNT::reloadBMFontResource(const std::string& fntFilePath)
821821
if (ret)
822822
{
823823
s_configurations->insert(fntFilePath, ret);
824-
TextureCache::getInstance()->reloadTexture(ret->getAtlasName());
824+
Director::getInstance()->getTextureCache()->reloadTexture(ret->getAtlasName());
825825

826826
}
827827
}

cocos/3d/CCSprite3D.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,13 @@ Sprite3D* Sprite3D::createSprite3DNode(NodeData* nodedata,ModelData* modeldata,c
364364
{
365365
sprite->setName(nodedata->id);
366366
auto mesh = Mesh::create(nodedata->id, getMeshIndexData(modeldata->subMeshId));
367+
368+
if (_skeleton && modeldata->bones.size())
369+
{
370+
auto skin = MeshSkin::create(_skeleton, modeldata->bones, modeldata->invBindPose);
371+
mesh->setSkin(skin);
372+
}
373+
367374
if (modeldata->matrialId == "" && materialdatas.materials.size())
368375
{
369376
const NTextureData* textureData = materialdatas.materials[0].getTextureData(NTextureData::Usage::Diffuse);
@@ -748,7 +755,7 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
748755
{
749756
#if CC_USE_CULLING
750757
// camera clipping
751-
if(Camera::getVisitingCamera() && !Camera::getVisitingCamera()->isVisibleInFrustum(&this->getAABB()))
758+
if(_children.size() == 0 && Camera::getVisitingCamera() && !Camera::getVisitingCamera()->isVisibleInFrustum(&getAABB()))
752759
return;
753760
#endif
754761

cocos/network/CCDownloader-apple.mm

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,18 @@ - (void)URLSession:(NSURLSession *)session downloadTask :(NSURLSessionDownloadTa
515515
NSString *destPath = [NSString stringWithUTF8String:storagePath];
516516
NSFileManager *fileManager = [NSFileManager defaultManager];
517517
NSURL *destURL = nil;
518-
518+
519+
// On iOS 9 a response with status code 4xx(Client Error) or 5xx(Server Error)
520+
// might end up calling this delegate method, saving the error message to the storage path
521+
// and treating this download task as a successful one, so we need to check the status code here
522+
NSInteger statusCode = ((NSHTTPURLResponse*)downloadTask.response).statusCode;
523+
if (statusCode >= 400) {
524+
std::vector<unsigned char> buf; // just a placeholder
525+
std::string response = [[NSString stringWithContentsOfURL:location] UTF8String] ?: "";
526+
_outer->onTaskFinish(*[wrapper get], cocos2d::network::DownloadTask::ERROR_IMPL_INTERNAL, noErr, response, buf);
527+
return;
528+
}
529+
519530
do
520531
{
521532
if ([destPath hasPrefix:@"file://"])

0 commit comments

Comments
 (0)