fix skeleton

This commit is contained in:
yangxiao 2014-08-16 18:18:15 +08:00
parent 7159914248
commit fb1b7ca3bb
3 changed files with 2 additions and 12 deletions

View File

@ -300,20 +300,11 @@ Skeleton3D* Skeleton3D::create(const std::vector<NodeData*>& skeletondata)
for (const auto& it : skeletondata) {
auto bone = skeleton->createBone3D(*it);
skeleton->_rootBones.pushBack(bone);
skeleton->printBone(bone);
}
skeleton->autorelease();
return skeleton;
}
void Skeleton3D::printBone(Bone3D* bone)
{
CCLOG("%s", bone->getName().c_str());
for (auto it : bone->_children) {
printBone(it);
}
}
bool Skeleton3D::initFromSkeletonData(const Skeleton3DData& skeletondata)
{
ssize_t i = 0;
@ -425,9 +416,9 @@ Bone3D* Skeleton3D::createBone3D(const NodeData& nodedata)
auto child = createBone3D(*it);
bone->addChildBone(child);
child->_parent = bone;
child->release();
}
_bones.pushBack(bone);
bone->_oriPose = nodedata.transform;
return bone;
}

View File

@ -229,8 +229,6 @@ CC_CONSTRUCTOR_ACCESS:
/** create Bone3D from NodeData */
Bone3D* createBone3D(const NodeData& nodedata);
void printBone(Bone3D* bone);
protected:
Vector<Bone3D*> _bones; // bones

View File

@ -138,6 +138,7 @@ bool Sprite3D::loadFromObj(const std::string& path)
texname = dir + (*it).material.diffuse_texname;
matnames.push_back(texname);
}
_mesh = Mesh::create(shapes.positions, shapes.normals, shapes.texcoords, submeshIndices);
_mesh->retain();
if (_mesh == nullptr)