public static bool LoadScene(FBXManager pManager, FBXDocument pScene, string pFilename) { int sdkMajor = 0; int sdkMinor = 0; int sdkRevision = 0; // int lFileFormat = -1; string lPassword = new string(new char[1024]); // Get the file version number generate by the FBX SDK. FBXManager.GetFileFormatVersion(ref sdkMajor, ref sdkMinor, ref sdkRevision); // Create an importer. FBXImporter lImporter = FBXImporter.Create(pManager, string.Empty); // Initialize the importer by providing a filename. bool lImportStatus = lImporter.Initialize(pFilename, -1, pManager.GetIOSettings()); // lImporter.GetFileVersion(ref lFileMajor, ref lFileMinor, ref lFileRevision); if (!lImportStatus) { var error = lImporter.GetStatus().GetErrorString(); Debug.WriteLine("Call to FBXImporter::Initialize() failed"); Debug.WriteLine("Error returned: {0}", error); // if (lImporter.GetStatus().GetCode() == FBXStatus.eInvalidFileVersion) // { // Debug.WriteLine("FBX file format version for this FBX SDK is %d.%d.%d\n", lSDKMajor, lSDKMinor, lSDKRevision); // Debug.WriteLine("FBX file format version for file '%s' is %d.%d.%d\n\n", pFilename, lFileMajor, lFileMinor, lFileRevision); // } return(false); } Debug.WriteLine("FBX file format version for this FBX SDK is {0}.{1}.{2}", sdkMajor, sdkMinor, sdkRevision); if (lImporter.IsFBX()) { // Debug.WriteLine("FBX file format version for file '%s' is %d.%d.%d\n\n", pFilename, lFileMajor, lFileMinor, lFileRevision); // From this point, it is possible to access animation stack information without // the expense of loading the entire file. Debug.WriteLine("Animation Stack Information"); var lAnimStackCount = lImporter.GetAnimStackCount(); Debug.WriteLine(" Number of Animation Stacks: {0}", lAnimStackCount); Debug.WriteLine(" Current Animation Stack: {0}", lImporter.GetActiveAnimStackName()); int i; for (i = 0; i < lAnimStackCount; i++) { // FbxTakeInfo lTakeInfo = lImporter.GetTakeInfo(i); // Debug.WriteLine(" Animation Stack %d\n", i); // Debug.WriteLine(" Name: \"%s\"\n", lTakeInfo.mName.Buffer()); // Debug.WriteLine(" Description: \"%s\"\n", lTakeInfo.mDescription.Buffer()); //// Change the value of the import name if the animation stack should be imported //// under a different name. // Debug.WriteLine(" Import Name: \"%s\"\n", lTakeInfo.mImportName.Buffer()); //// Set the value of the import state to false if the animation stack should be not //// be imported. // Debug.WriteLine(" Import State: %s\n", lTakeInfo.mSelect ? "true" : "false"); // Debug.WriteLine("\n"); } //// Set the import states. By default, the import states are always set to //// true. The code below shows how to change these states. // (*(pManager.GetIOSettings())).SetBoolProp(IMP_FBX_MATERIAL, true); // (*(pManager.GetIOSettings())).SetBoolProp(IMP_FBX_TEXTURE, true); // (*(pManager.GetIOSettings())).SetBoolProp(IMP_FBX_LINK, true); // (*(pManager.GetIOSettings())).SetBoolProp(IMP_FBX_SHAPE, true); // (*(pManager.GetIOSettings())).SetBoolProp(IMP_FBX_GOBO, true); // (*(pManager.GetIOSettings())).SetBoolProp(IMP_FBX_ANIMATION, true); // (*(pManager.GetIOSettings())).SetBoolProp(IMP_FBX_GLOBAL_SETTINGS, true); } // Import the scene. var lStatus = lImporter.Import(pScene); // if (lStatus == false && lImporter.GetStatus().GetCode() == FbxStatus.ePasswordError) // { // Debug.WriteLine("Please enter password: "******"%s", lPassword); // FBXSDK_CRT_SECURE_NO_WARNING_END FbxString lString(lPassword); // (*(pManager.GetIOSettings())).SetStringProp(IMP_FBX_PASSWORD, lString); // (*(pManager.GetIOSettings())).SetBoolProp(IMP_FBX_PASSWORD_ENABLE, true); // lStatus = lImporter.Import(pScene); // if (lStatus == false && lImporter.GetStatus().GetCode() == FbxStatus.ePasswordError) // { // Debug.WriteLine("\nPassword is wrong, import aborted.\n"); // } // } return(lStatus); }