-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy path3dsReaderFbx.cpp
executable file
·68 lines (45 loc) · 1.45 KB
/
3dsReaderFbx.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright(c) 2005-2006. All Rights Reserved
// By Jean-René Bédard (https://github.com/jrbedard/3d-converter)
#include "StdAfx.h"
#include "fbxSdk.h" // FBX SDK
#include "fbxFile.h"
#include "3dsReaderFbx.h"
using namespace FBXSDK_NAMESPACE;
// Read 3DS file format using the FBX SDK
C3dsReaderFbx::C3dsReaderFbx(CFile* pFile, const fs::path& fileName)
{
CFbxFile* pFbxFile = static_cast<CFbxFile*>(pFile);
m_pFbxFile = pFbxFile;
m_fileName = fileName;
}
bool C3dsReaderFbx::Read()
{
OBJ_ASSERT(m_pFbxFile);
if(!m_pFbxFile)
return false;
std::string fileName(m_fileName.string()); // Extract native file path string
KString lCurrentTakeName;
bool lStatus;
MSG_INFO("Parsing .3DS file '" << fileName << "'.");
// Create an importer.
KFbxImporter* lImporter = m_pFbxFile->GetFbxSdkManager()->CreateKFbxImporter();
lImporter->SetFileFormat(KFbxImporter::e3D_STUDIO_3DS);
// Initialize the importer by providing a filename.
if(lImporter->Initialize(fileName.c_str()) == false)
{
MSG_ERROR("Call to KFbxImporter::Initialize() failed. Error returned: " << lImporter->GetLastErrorString());
return false;
}
// Import the scene.
lStatus = lImporter->Import(*m_pFbxFile->GetFbxScene());
if(!lStatus)
{
MSG_ERROR("Error importing the 3DS scene: " << lImporter->GetLastErrorString());
return false;
}
return true;
}
bool C3dsReaderFbx::ReadDebug()
{
return true;
}