mirror of https://github.com/axmolengine/axmol.git
fix skeleton
This commit is contained in:
parent
7159914248
commit
fb1b7ca3bb
|
@ -300,20 +300,11 @@ Skeleton3D* Skeleton3D::create(const std::vector<NodeData*>& skeletondata)
|
||||||
for (const auto& it : skeletondata) {
|
for (const auto& it : skeletondata) {
|
||||||
auto bone = skeleton->createBone3D(*it);
|
auto bone = skeleton->createBone3D(*it);
|
||||||
skeleton->_rootBones.pushBack(bone);
|
skeleton->_rootBones.pushBack(bone);
|
||||||
skeleton->printBone(bone);
|
|
||||||
}
|
}
|
||||||
skeleton->autorelease();
|
skeleton->autorelease();
|
||||||
return skeleton;
|
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)
|
bool Skeleton3D::initFromSkeletonData(const Skeleton3DData& skeletondata)
|
||||||
{
|
{
|
||||||
ssize_t i = 0;
|
ssize_t i = 0;
|
||||||
|
@ -425,9 +416,9 @@ Bone3D* Skeleton3D::createBone3D(const NodeData& nodedata)
|
||||||
auto child = createBone3D(*it);
|
auto child = createBone3D(*it);
|
||||||
bone->addChildBone(child);
|
bone->addChildBone(child);
|
||||||
child->_parent = bone;
|
child->_parent = bone;
|
||||||
child->release();
|
|
||||||
}
|
}
|
||||||
_bones.pushBack(bone);
|
_bones.pushBack(bone);
|
||||||
|
bone->_oriPose = nodedata.transform;
|
||||||
return bone;
|
return bone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -229,8 +229,6 @@ CC_CONSTRUCTOR_ACCESS:
|
||||||
/** create Bone3D from NodeData */
|
/** create Bone3D from NodeData */
|
||||||
Bone3D* createBone3D(const NodeData& nodedata);
|
Bone3D* createBone3D(const NodeData& nodedata);
|
||||||
|
|
||||||
void printBone(Bone3D* bone);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Vector<Bone3D*> _bones; // bones
|
Vector<Bone3D*> _bones; // bones
|
||||||
|
|
|
@ -138,6 +138,7 @@ bool Sprite3D::loadFromObj(const std::string& path)
|
||||||
texname = dir + (*it).material.diffuse_texname;
|
texname = dir + (*it).material.diffuse_texname;
|
||||||
matnames.push_back(texname);
|
matnames.push_back(texname);
|
||||||
}
|
}
|
||||||
|
|
||||||
_mesh = Mesh::create(shapes.positions, shapes.normals, shapes.texcoords, submeshIndices);
|
_mesh = Mesh::create(shapes.positions, shapes.normals, shapes.texcoords, submeshIndices);
|
||||||
_mesh->retain();
|
_mesh->retain();
|
||||||
if (_mesh == nullptr)
|
if (_mesh == nullptr)
|
||||||
|
|
Loading…
Reference in New Issue