get names of bones and skeleton to osg nodes

This commit is contained in:
Nelsson Huotari 2020-07-01 12:42:03 +03:00
parent 46505f66d3
commit 508cf89f9c

View File

@ -252,11 +252,19 @@ void daeReader::processSkeletonSkins(domNode* skeletonRoot, const domInstance_co
{ {
osgAnimation::Bone* pOsgBone = getOrCreateBone(jointsAndInverseBindMatrices[j].first); osgAnimation::Bone* pOsgBone = getOrCreateBone(jointsAndInverseBindMatrices[j].first);
pOsgBone->setInvBindMatrixInSkeletonSpace(jointsAndInverseBindMatrices[j].second); pOsgBone->setInvBindMatrixInSkeletonSpace(jointsAndInverseBindMatrices[j].second);
unsigned int numAttrs = jointsAndInverseBindMatrices[j].first->getAttributeCount();
for ( unsigned int currAttr = 0; currAttr < numAttrs; ++currAttr )
if (jointsAndInverseBindMatrices[j].first->getAttributeName(currAttr) == "name")
pOsgBone->setName(jointsAndInverseBindMatrices[j].first->getAttribute( currAttr ));
} }
} }
osgAnimation::Skeleton* skeleton = getOrCreateSkeleton(skeletonRoot); osgAnimation::Skeleton* skeleton = getOrCreateSkeleton(skeletonRoot);
unsigned int numAttrs = skeletonRoot->getAttributeCount();
for ( unsigned int currAttr = 0; currAttr < numAttrs; ++currAttr )
if (skeletonRoot->getAttributeName(currAttr) == "name") skeleton->setName(skeletonRoot->getAttribute( currAttr ));
for (size_t i = 0; i < instanceControllers.size(); ++i) for (size_t i = 0; i < instanceControllers.size(); ++i)
{ {
domInstance_controller *pDomInstanceController = instanceControllers[i]; domInstance_controller *pDomInstanceController = instanceControllers[i];