Example #1
0
bool
id::FBX::Model::initRec(FbxNode* node, int parentIndex)
{
	FbxNodeAttribute*	attrib;
	size_t				numChild;
	int					me = -1;

	if (node == nullptr)
		return true;
	attrib = node->GetNodeAttribute();
	if (attrib != nullptr && attrib->GetAttributeType() == FbxNodeAttribute::eMesh)
	{
		try
		{
			_meshes.push_back(id::FBX::Mesh());
		}
		catch (std::bad_alloc ba)
		{
			ba.what();
			return false;
		}
		me = _meshes.size() - 1;
		if (_meshes[me].init(node->GetMesh()) == false)
			return false;
		if (_hasTexture)
			_hasTexture = _meshes[me].getHasUV();
	}
	else if (attrib != nullptr && attrib->GetAttributeType() == FbxNodeAttribute::eSkeleton) 
	{
		if (!initBone(node, parentIndex))
			return false;
		me = _bones.size() - 1;
	}
	numChild = node->GetChildCount();
	for (size_t i = 0 ; i < numChild ; ++i)
		if (!initRec(node->GetChild(i), me))
			return false;
	return true;
}
Example #2
0
void Skeleton::initBones() {
    for (int i = 0; i < _numJoints; i++) {
        initBone(i);
    }
}