fereria
2/16/2020 - 7:37 AM

FbxArray

// 参照渡しで指定ノード以下のTreeをnodeArrayに取得
void Test(FbxNode *pNode, FbxArray<FbxNode *> &nodeArray)
{
    nodeArray.Add(pNode);
    printNode(pNode);
    int childNodeNum = pNode->GetChildCount();
    for (int i = 0; i < childNodeNum; i++)
    {
        FbxNode *pChild = pNode->GetChild(i);
        Test(pChild,nodeArray);
    }
}

void fbxTest_03()
{
    /*
    FbxArrayの使い方
    */
    char *fbxFile = "D:/work/data_sample/xbot.fbx";

    FbxManager *manager = FbxManager::Create();
    FbxIOSettings *ioSettings = FbxIOSettings::Create(manager, IOSROOT);
    FbxImporter *importer = FbxImporter::Create(manager, "");
    importer->Initialize(fbxFile, -1, manager->GetIOSettings());

    // Fbxにシーンをロード
    FbxScene *scene = FbxScene::Create(manager, "scene");
    importer->Import(scene);
    importer->Destroy();

    FbxNode *rootNode = scene->GetRootNode();

    auto *fbxArray = new FbxArray<FbxNode*>();
    Test(rootNode, *fbxArray);
    cout << fbxArray->Size() << endl;
}