|
| Re: 2005 to 2006 sdk and unexpeted results |
 |
Fri, 12 Oct 2007 16:20:17 +000 |
/*
* fbxFile.cpp
* Grapher
*
* Created by Nithin Tharakan on 08/10/2007.
* Copyright 2007. All rights reserved.
*
*/
#include "fbxFile.h"
fbxFile::fbxFile(const char* filename) {
bool loaded;
manager = NULL;
scene = NULL;
name = filename;
InitializeSdkObjects(manager, scene);
loaded = LoadScene(manager, scene, filename);
if (loaded) {
if (scene->GetRootNode()) copy(scene->GetRootNode());
}
}
fbxFile::~fbxFile() {
foreach (fbxObject* o, contents) {
delete o;
}
DestroySdkObjects(manager);
}
void fbxFile::copy(KFbxNode* root) {
KFbxTakeNode* currentTakeNode = root->GetCurrentTakeNode();
fbxObject* o = new fbxObject();
o->name = root->GetName();
if (currentTakeNode) {
copyCurve(o->xrotation, currentTakeNode->GetEulerRotationX());
copyCurve(o->xrotation, currentTakeNode->GetEulerRotationX());
copyCurve(o->xrotation, currentTakeNode->GetEulerRotationX());
contents.push_back(o);
}
else {
cout << "INVALID TAKE NODE..." << endl;
}
for (int i = 0; i < root->GetChildCount(); i++) {
if (valid(root->GetChild(i))) copy(root->GetChild(i));
}
}
void fbxFile::copyCurve(vector<double>& localCurve, KFCurve* curve)
{
//!!!!!!KEY COUNT HERE IS ALWAYS ZERO...!!!!!!
for (int i = 0; i < curve->KeyGetCount(); i++) {
localCurve.push_back(static_cast<double>
(curve->KeyGetValue(i)));
}
}
bool fbxFile::valid(KFbxNode* node) {
if ( node != NULL &&
node->GetCurrentTakeNode() != NULL &&
node->GetCurrentTakeNode()->GetEulerRotationX() != NULL
&&
node->GetCurrentTakeNode()->GetEulerRotationY() != NULL
&&
node->GetCurrentTakeNode()->GetEulerRotationZ() != NULL ) {
return true;
}
else {
cout << "CAME ACROSS AN INVALID NODE...IN FILE "
<< name << endl;
return false;
}
|
| Post Reply
|
|
|
|
|
|
|
|
|
|