osgAnimation::Channel* readFbxChannels( KFbxTypedProperty<fbxDouble3>& fbxProp, KFbxAnimLayer* pAnimLayer, const char* targetName, const char* channelName) { if (!fbxProp.IsValid()) return 0; return readFbxChannels( fbxProp.GetCurve<KFbxAnimCurve>(pAnimLayer, "X"), fbxProp.GetCurve<KFbxAnimCurve>(pAnimLayer, "Y"), fbxProp.GetCurve<KFbxAnimCurve>(pAnimLayer, "Z"), fbxProp.Get(), targetName, channelName); }
osgAnimation::Animation* readFbxAnimation(KFbxNode* pNode, KFbxAnimLayer* pAnimLayer, const char* pTakeName, const char* targetName, osg::ref_ptr<osgAnimation::AnimationManagerBase>& pAnimManager) { ERotationOrder rotOrder = pNode->RotationOrder.IsValid() ? pNode->RotationOrder.Get() : eEULER_XYZ; osgAnimation::Channel* pTranslationChannel = 0; osgAnimation::Channel* pRotationChannel = 0; if (pNode->LclRotation.IsValid()) { fbxDouble3 fbxBaseValue = pNode->LclRotation.Get(); pRotationChannel = readFbxChannelsQuat( pNode->LclRotation.GetCurve<KFbxAnimCurve>(pAnimLayer, KFCURVENODE_R_X), pNode->LclRotation.GetCurve<KFbxAnimCurve>(pAnimLayer, KFCURVENODE_R_Y), pNode->LclRotation.GetCurve<KFbxAnimCurve>(pAnimLayer, KFCURVENODE_R_Z), pNode->LclRotation.Get(), targetName, rotOrder); } if (pNode->LclTranslation.IsValid()) { pTranslationChannel = readFbxChannels( pNode->LclTranslation.GetCurve<KFbxAnimCurve>(pAnimLayer, KFCURVENODE_T_X), pNode->LclTranslation.GetCurve<KFbxAnimCurve>(pAnimLayer, KFCURVENODE_T_Y), pNode->LclTranslation.GetCurve<KFbxAnimCurve>(pAnimLayer, KFCURVENODE_T_Z), pNode->LclTranslation.Get(), targetName, "translate"); } osgAnimation::Channel* pScaleChannel = readFbxChannels( pNode->LclScaling, pAnimLayer, targetName, "scale"); return addChannels(pTranslationChannel, pRotationChannel, pScaleChannel, pAnimManager, pTakeName); }
osgAnimation::Animation* readFbxAnimation(FbxNode* pNode, FbxAnimLayer* pAnimLayer, const char* pTakeName, const char* targetName, osg::ref_ptr<osgAnimation::AnimationManagerBase>& pAnimManager) { osgAnimation::Channel* pTranslationChannel = 0; osgAnimation::Channel* pRotationChannels[3] = {0}; readFbxRotationAnimation(pRotationChannels, pNode, pAnimLayer, targetName); if (pNode->LclTranslation.IsValid()) { pTranslationChannel = readFbxChannels( pNode->LclTranslation.GetCurve(pAnimLayer, FBXSDK_CURVENODE_COMPONENT_X), pNode->LclTranslation.GetCurve(pAnimLayer, FBXSDK_CURVENODE_COMPONENT_Y), pNode->LclTranslation.GetCurve(pAnimLayer, FBXSDK_CURVENODE_COMPONENT_Z), pNode->LclTranslation.Get(), targetName, "translate"); } osgAnimation::Channel* pScaleChannel = readFbxChannels( pNode->LclScaling, pAnimLayer, targetName, "scale"); return addChannels(pTranslationChannel, pRotationChannels, pScaleChannel, pAnimManager, pTakeName); }