金庆的专栏

  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  418 随笔 :: 0 文章 :: 454 评论 :: 0 Trackbacks
# Fbx File Format Identifier

(金庆的专栏 2021.5)

Print the list of FBX file format identifiers.

FBX SDK FbxExporter can set the file format identifier which is an int parameter.
The commnet says: User does not need to specify it by default.
If not specified, plugin will detect the file format according to file suffix automatically.

FBX SDK 2020 automatically set it to the latest binary format, which can not be parsed by "Autodesk FBX Converter 2013".
We need to specify the format identifier for FBX Converter 2013.
But there is no specification of this parameter.
We use the following code to display all the valid format identifiers and their descriptions.

```
#include <fbxsdk.h>
#include <cassert>

int main()
{
    FbxManager* myManager = FbxManager::Create();
    assert(myManager);

    FbxIOSettings* ios = FbxIOSettings::Create(myManager, IOSROOT);
    myManager->SetIOSettings(ios);

    int lFormatCount = myManager->GetIOPluginRegistry()->GetWriterFormatCount();
    for (int lFormatIndex = 0; lFormatIndex < lFormatCount; lFormatIndex++)
    {
        FbxString lDesc = myManager->GetIOPluginRegistry()->GetWriterFormatDescription(lFormatIndex);
        printf("Format index %d: %s\n", lFormatIndex, (const char*)lDesc);
    }
    return 0;
}
```

Output:
```
Format index 0: FBX binary (*.fbx)
Format index 1: FBX ascii (*.fbx)
Format index 2: FBX encrypted (*.fbx)
Format index 3: FBX 6.0 binary (*.fbx)
Format index 4: FBX 6.0 ascii (*.fbx)
Format index 5: FBX 6.0 encrypted (*.fbx)
Format index 6: AutoCAD DXF (*.dxf)
Format index 7: Alias OBJ (*.obj)
Format index 8: Collada DAE (*.dae)
Format index 9: Biovision BVH (*.bvh)
Format index 10: Motion Analysis HTR (*.htr)
Format index 11: Motion Analysis TRC (*.trc)
Format index 12: Acclaim ASF (*.asf)
Format index 13: Acclaim AMC (*.amc)
Format index 14: Vicon C3D (*.c3d)
Format index 15: Adaptive Optics AOA (*.aoa)
Format index 16: Superfluo MCD (*.mcd)
```

FBX Converter 2013 will error "File is corrupted" for files exported as *.fbx file format: -1, 0, 2, 5.
Ascii format (1, 4) and FBX 6.0 binary (3) are OK.
posted on 2021-05-30 09:55 金庆 阅读(127) 评论(0)  编辑 收藏 引用 所属分类: 1. C/C++

只有注册用户登录后才能发表评论。
【推荐】超50万行VC++源码: 大型组态工控、电力仿真CAD与GIS源码库
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理