FBX SDKがファイル読み込んでくれない

# はじめに

この問題は未解決です
そのうちなんとかします

この記事は[IPFactory Advent Calendar 2020](https://qiita.com/advent-calendar/2020/ipfactory)最終日の記事です

# やりたかったこと

FBXファイルをFBX SDKで読み込んでVulkanに描画させたかった

ついでにその記事をアドカレで書きたかった

# コード書いた

とりあえずFBX SDKの[tutorial](https://help.autodesk.com/view/FBX/2020/ENU/?guid=FBX_Developer_Help_getting_started_your_first_fbx_sdk_program_html)写経してFBXファイル開いてみた

<details><summary>写経したコード</summary><div>

```c++

    #include <fbxsdk.h>

    /* Tab character ("\t") counter */
    int numTabs = 0;

    /**
     * Print the required number of tabs.
     */
    void PrintTabs() {
        for(int i = 0; i < numTabs; i++)
            printf("\t");
    }

    /**
     * Return a string-based representation based on the attribute type.
     */
    FbxString GetAttributeTypeName(FbxNodeAttribute::EType type) {
        switch(type) {
            case FbxNodeAttribute::eUnknown: return "unidentified";
            case FbxNodeAttribute::eNull: return "null";
            case FbxNodeAttribute::eMarker: return "marker";
            case FbxNodeAttribute::eSkeleton: return "skeleton";
            case FbxNodeAttribute::eMesh: return "mesh";
            case FbxNodeAttribute::eNurbs: return "nurbs";
            case FbxNodeAttribute::ePatch: return "patch";
            case FbxNodeAttribute::eCamera: return "camera";
            case FbxNodeAttribute::eCameraStereo: return "stereo";
            case FbxNodeAttribute::eCameraSwitcher: return "camera switcher";
            case FbxNodeAttribute::eLight: return "light";
            case FbxNodeAttribute::eOpticalReference: return "optical reference";
            case FbxNodeAttribute::eOpticalMarker: return "marker";
            case FbxNodeAttribute::eNurbsCurve: return "nurbs curve";
            case FbxNodeAttribute::eTrimNurbsSurface: return "trim nurbs surface";
            case FbxNodeAttribute::eBoundary: return "boundary";
            case FbxNodeAttribute::eNurbsSurface: return "nurbs surface";
            case FbxNodeAttribute::eShape: return "shape";
            case FbxNodeAttribute::eLODGroup: return "lodgroup";
            case FbxNodeAttribute::eSubDiv: return "subdiv";
            default: return "unknown";
        }
    }

    /**
     * Print an attribute.
     */
    void PrintAttribute(FbxNodeAttribute* pAttribute) {
        if(!pAttribute) return;

        FbxString typeName = GetAttributeTypeName(pAttribute->GetAttributeType());
        FbxString attrName = pAttribute->GetName();
        PrintTabs();
        // Note: to retrieve the character array of a FbxString, use its Buffer() method.
        printf("<attribute type='%s' name='%s'/>\n", typeName.Buffer(), attrName.Buffer());
    }

    /**
     * Print a node, its attributes, and all its children recursively.
     */
    void PrintNode(FbxNode* pNode) {
        PrintTabs();
        const char* nodeName = pNode->GetName();
        FbxDouble3 translation = pNode->LclTranslation.Get();
        FbxDouble3 rotation = pNode->LclRotation.Get();
        FbxDouble3 scaling = pNode->LclScaling.Get();

        // Print the contents of the node.
        printf("<node name='%s' translation='(%f, %f, %f)' rotation='(%f, %f, %f)' scaling='(%f, %f, %f)'>\n",
            nodeName,
            translation[0], translation[1], translation[2],
            rotation[0], rotation[1], rotation[2],
            scaling[0], scaling[1], scaling[2]
            );
        numTabs++;

        // Print the node's attributes.
        for(int i = 0; i < pNode->GetNodeAttributeCount(); i++)
            PrintAttribute(pNode->GetNodeAttributeByIndex(i));

        // Recursively print the children.
        for(int j = 0; j < pNode->GetChildCount(); j++)
            PrintNode(pNode->GetChild(j));

        numTabs--;
        PrintTabs();
        printf("</node>\n");
    }

    /**
     * Main function - loads the hard-coded fbx file,
     * and prints its contents in an xml format to stdout.
     */
    int main(int argc, char** argv) {

        // Change the following filename to a suitable filename value.
        const char* lFilename = "任意の文字列.fbx";

        // Initialize the SDK manager. This object handles all our memory management.
        FbxManager* lSdkManager = FbxManager::Create();

        // Create the IO settings object.
        FbxIOSettings *ios = FbxIOSettings::Create(lSdkManager, IOSROOT);
        lSdkManager->SetIOSettings(ios);

        // Create an importer using the SDK manager.
        FbxImporter* lImporter = FbxImporter::Create(lSdkManager,"");

        // Use the first argument as the filename for the importer.
        if(!lImporter->Initialize(lFilename, -1, lSdkManager->GetIOSettings())) {
            printf("Call to FbxImporter::Initialize() failed.\n");
            printf("Error returned: %s\n\n", lImporter->GetStatus().GetErrorString());
            exit(-1);
        }

        // Create a new scene so that it can be populated by the imported file.
        FbxScene* lScene = FbxScene::Create(lSdkManager,"myScene");

        // Import the contents of the file into the scene.
        lImporter->Import(lScene);

        // The file is imported; so get rid of the importer.
        lImporter->Destroy();

        // Print the nodes of the scene and their attributes recursively.
        // Note that we are not printing the root node because it should
        // not contain any attributes.
        FbxNode* lRootNode = lScene->GetRootNode();
        if(lRootNode) {
            for(int i = 0; i < lRootNode->GetChildCount(); i++)
                PrintNode(lRootNode->GetChild(i));
        }
        // Destroy the SDK manager and all the other objects it was handling.
        lSdkManager->Destroy();
        return 0;
    }
```
</div></details>

## 実行した

結果

```
Call to FbxImporter::Initialize() failed.
Error returned: Unexpected file type
```

why

## 複数の異なるfbxファイルに対して実行した

結果

```
Call to FbxImporter::Initialize() failed.
Error returned: Unexpected file type
```

なんで

## 原因調べた

どのfbxファイルを与えても同じエラーが発生するので、なんか間違ってる気がする

ググったら[ここ](https://stackoverflow.com/questions/31867142/fbxmanager-error-efailure-and-unexpected-file-type-error)にそれっぽいの書いてあった

version違うと互換性の問題が発生するらしい(binaryとASCIIどっちも読ませた上で失敗しているので上に書いてあるのは無視)

## 他のversionで試す

現在入手できるFBX®2013.3SDK ~ FBX®2020.0.1SDKを全部試してみようと思う

通信環境が劣悪なため、ここから先は来月以降書きます