| 1290 | } |
| 1291 | |
| 1292 | bool FBXReader::ReadFile(const StringImpl& fileName, bool loadAnims) |
| 1293 | { |
| 1294 | bool loadDefData = true; |
| 1295 | |
| 1296 | mModelDef->mLoadDir = GetFileDir(fileName); |
| 1297 | |
| 1298 | String bfModelFileName = fileName + ".bfmodel"; |
| 1299 | if (ReadBFFile(bfModelFileName)) |
| 1300 | return true; |
| 1301 | |
| 1302 | String checkFileName2; |
| 1303 | |
| 1304 | int atPos = (int)fileName.find('@'); |
| 1305 | if (atPos != -1) |
| 1306 | { |
| 1307 | loadDefData = false; |
| 1308 | checkFileName2 = fileName.substr(0, atPos) + ".fbx"; |
| 1309 | |
| 1310 | if (!ReadFile(checkFileName2, false)) |
| 1311 | return false; |
| 1312 | |
| 1313 | for (int jointIdx = 0; jointIdx < (int) mFBXJoints.size(); jointIdx++) |
| 1314 | { |
| 1315 | FBXJoint* fbxJoint = &mFBXJoints[jointIdx]; |
| 1316 | fbxJoint->pNode = NULL; |
| 1317 | } |
| 1318 | } |
| 1319 | |
| 1320 | FbxManager* sdkManager = NULL; |
| 1321 | FbxScene* scene = NULL; |
| 1322 | |
| 1323 | // Prepare the FBX SDK. |
| 1324 | InitializeSdkObjects(sdkManager, scene); |
| 1325 | |
| 1326 | mFBXManager = sdkManager; |
| 1327 | mFBXScene = scene; |
| 1328 | |
| 1329 | FbxImporter* lImporter = FbxImporter::Create(sdkManager, ""); |
| 1330 | |
| 1331 | if (!LoadScene(sdkManager, scene, fileName.c_str(), lImporter)) |
| 1332 | { |
| 1333 | lImporter->Destroy(); |
| 1334 | return false; |
| 1335 | } |
| 1336 | |
| 1337 | FbxGlobalSettings& globalSettings = scene->GetGlobalSettings(); |
| 1338 | |
| 1339 | FbxTime::EMode timeMode = globalSettings.GetTimeMode(); |
| 1340 | mFrameRate = (float) FbxTime::GetFrameRate(timeMode); |
| 1341 | |
| 1342 | if (!loadDefData) |
| 1343 | { |
| 1344 | // Hook joints back up |
| 1345 | FindJoints(scene->GetRootNode()); |
| 1346 | } |
| 1347 | |
| 1348 | /*clipInfo clip; |
| 1349 | clip.name = clipName; |
no test coverage detected