|
|
@@ -309,8 +309,8 @@ void FBXSceneEncoder::loadScene(FbxScene* fbxScene)
|
|
|
void FBXSceneEncoder::loadAnimationChannels(FbxAnimLayer* animLayer, FbxNode* fbxNode, Animation* animation)
|
|
|
{
|
|
|
const char* name = fbxNode->GetName();
|
|
|
- Node* node = _gamePlayFile.getNode(name);
|
|
|
-
|
|
|
+ //Node* node = _gamePlayFile.getNode(name);
|
|
|
+
|
|
|
// Determine which properties are animated on this node
|
|
|
// Find the transform at each key frame
|
|
|
// TODO: Ignore properties that are not animated (scale, rotation, translation)
|
|
|
@@ -466,6 +466,7 @@ void FBXSceneEncoder::loadAnimationChannels(FbxAnimLayer* animLayer, FbxNode* fb
|
|
|
assert(channelCount > 0);
|
|
|
|
|
|
// Allocate channel list
|
|
|
+ int channelStart = animation->getAnimationChannelCount();
|
|
|
for (unsigned int i = 0; i < channelCount; ++i)
|
|
|
{
|
|
|
AnimationChannel* channel = new AnimationChannel();
|
|
|
@@ -499,7 +500,7 @@ void FBXSceneEncoder::loadAnimationChannels(FbxAnimLayer* animLayer, FbxNode* fb
|
|
|
rotation.normalize();
|
|
|
|
|
|
// Append keyframe data to all channels
|
|
|
- for (unsigned int i = 0; i < channelCount; ++i)
|
|
|
+ for (unsigned int i = channelStart, channelEnd = channelStart + channelCount; i < channelEnd; ++i)
|
|
|
{
|
|
|
appendKeyFrame(fbxNode, animation->getAnimationChannel(i), time, scale, rotation, translation);
|
|
|
}
|
|
|
@@ -517,18 +518,14 @@ void FBXSceneEncoder::loadAnimationLayer(FbxAnimLayer* fbxAnimLayer, FbxNode* fb
|
|
|
bool animationGroupId = false;
|
|
|
const char* name = fbxNode->GetName();
|
|
|
// Check if this node's animations are supposed to be grouped
|
|
|
- if (name)
|
|
|
+ if (name && arguments.containsGroupNodeId(name))
|
|
|
{
|
|
|
- std::string str = name;
|
|
|
- if (arguments.containsGroupNodeId(str))
|
|
|
- {
|
|
|
- animationGroupId = true;
|
|
|
- _groupAnimation = new Animation();
|
|
|
- _groupAnimation->setId(arguments.getAnimationId(str));
|
|
|
- }
|
|
|
+ animationGroupId = true;
|
|
|
+ _groupAnimation = new Animation();
|
|
|
+ _groupAnimation->setId(arguments.getAnimationId(name));
|
|
|
}
|
|
|
Animation* animation = _groupAnimation;
|
|
|
- if (!_groupAnimation)
|
|
|
+ if (!animation)
|
|
|
{
|
|
|
animation = new Animation();
|
|
|
animation->setId(name);
|
|
|
@@ -857,8 +854,7 @@ void FBXSceneEncoder::loadSkin(FbxMesh* fbxMesh, Model* model)
|
|
|
FbxCluster* cluster = fbxSkin->GetCluster(j);
|
|
|
assert(cluster);
|
|
|
FbxNode* linkedNode = cluster->GetLink();
|
|
|
- assert(linkedNode);
|
|
|
- if (linkedNode->GetSkeleton())
|
|
|
+ if (linkedNode && linkedNode->GetSkeleton())
|
|
|
{
|
|
|
const char* jointName = linkedNode->GetName();
|
|
|
assert(jointName);
|
|
|
@@ -1398,9 +1394,6 @@ bool loadBlendWeights(FbxMesh* fbxMesh, std::vector<std::vector<Vector2> >& weig
|
|
|
{
|
|
|
FbxCluster* cluster = fbxSkin->GetCluster(j);
|
|
|
assert(cluster);
|
|
|
- FbxNode* linkedNode = cluster->GetLink();
|
|
|
- assert(linkedNode);
|
|
|
-
|
|
|
const int vertexIndexCount = cluster->GetControlPointIndicesCount();
|
|
|
for (int k = 0; k < vertexIndexCount; ++k)
|
|
|
{
|