MCPcopy Create free account
hub / github.com/beefytech/Beef / LoadScene

Function LoadScene

BeefySysLib/fbx/FBXReader.cpp:91–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91static bool LoadScene(FbxManager* pManager, FbxDocument* pScene, const char* pFilename, FbxImporter* pImporter)
92{
93 int lFileMajor, lFileMinor, lFileRevision;
94 int lSDKMajor, lSDKMinor, lSDKRevision;
95 //int lFileFormat = -1;
96 int i, lAnimStackCount;
97 bool lStatus;
98 char lPassword[1024];
99
100 // Get the file version number generate by the FBX SDK.
101 FbxManager::GetFileFormatVersion(lSDKMajor, lSDKMinor, lSDKRevision);
102
103 // Create an importer.
104 //FbxImporter* pImporter = FbxImporter::Create(pManager, "");
105
106 // Initialize the importer by providing a filename.
107 const bool lImportStatus = pImporter->Initialize(pFilename, -1, pManager->GetIOSettings());
108 pImporter->GetFileVersion(lFileMajor, lFileMinor, lFileRevision);
109
110 if (!lImportStatus)
111 {
112 FbxString error = pImporter->GetStatus().GetErrorString();
113 FBXSDK_printf("Call to FbxImporter::Initialize() failed.\n");
114 FBXSDK_printf("Error returned: %s\n\n", error.Buffer());
115
116 if (pImporter->GetStatus().GetCode() == FbxStatus::eInvalidFileVersion)
117 {
118 FBXSDK_printf("FBX file format version for this FBX SDK is %d.%d.%d\n", lSDKMajor, lSDKMinor, lSDKRevision);
119 FBXSDK_printf("FBX file format version for file '%s' is %d.%d.%d\n\n", pFilename, lFileMajor, lFileMinor, lFileRevision);
120 }
121
122 return false;
123 }
124
125 FBXSDK_printf("FBX file format version for this FBX SDK is %d.%d.%d\n", lSDKMajor, lSDKMinor, lSDKRevision);
126
127 if (pImporter->IsFBX())
128 {
129 FBXSDK_printf("FBX file format version for file '%s' is %d.%d.%d\n\n", pFilename, lFileMajor, lFileMinor, lFileRevision);
130
131 // From this point, it is possible to access animation stack information without
132 // the expense of loading the entire file.
133
134 FBXSDK_printf("Animation Stack Information\n");
135
136 lAnimStackCount = pImporter->GetAnimStackCount();
137
138 FBXSDK_printf(" Number of Animation Stacks: %d\n", lAnimStackCount);
139 FBXSDK_printf(" Current Animation Stack: \"%s\"\n", pImporter->GetActiveAnimStackName().Buffer());
140 FBXSDK_printf("\n");
141
142 for (i = 0; i < lAnimStackCount; i++)
143 {
144 FbxTakeInfo* lTakeInfo = pImporter->GetTakeInfo(i);
145
146 FBXSDK_printf(" Animation Stack %d\n", i);
147 FBXSDK_printf(" Name: \"%s\"\n", lTakeInfo->mName.Buffer());
148 FBXSDK_printf(" Description: \"%s\"\n", lTakeInfo->mDescription.Buffer());

Callers 1

ReadFileMethod · 0.85

Calls 2

BufferMethod · 0.80
InitializeMethod · 0.45

Tested by

no test coverage detected