Message 1 of 4

Not applicable
03-12-2018
08:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Using the same piece of code to export the same piece of geometry as both .fbx and .obj, I encountered a problem where the geometry name (UTF-8 encoded, partially in Russian: "Basicстена") does not get exported properly and all non-ASCII characters become '_'. All documentation points to FBX supporting UTF-8 encoded strings (link). What I'm uncertain about is whether this applies to exporting a .obj file. Has anyone encountered the same problem and am I missing something here?
Very modified code snippet below:
#include <string> #include <sstream> #include <codecvt> #include <fbxsdk.h> void main() { std::string zFilename = "test.obj"; std::wstring wzNodeName = L"Basicстена"; std::stringstream oss; std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> convert; oss << convert.to_bytes( wzNodeName ); std::string zNodeName = oss.str(); fbxsdk::FbxManager fbxManager = fbxsdk::FbxManager::Create(); if ( !fbxManager ) return; fbxsdk::FbxIOSettings* pIOSettings = fbxsdk::FbxIOSettings::Create( fbxManager, IOSROOT ); if ( !pIOSettings ) return; fbxManager->SetIOSettings( pIOSettings ); fbxsdk::FbxExporter* pExporterTest = fbxsdk::FbxExporter::Create( fbxManager, "" ); pExporterTest->SetFileExportVersion( FBX_2016_00_COMPATIBLE ); // Create dummy scene with geometry to export fbxsdk::FbxScene* pSceneTest = fbxsdk::FbxScene::Create( fbxManager, "testscene" ); fbxsdk::FbxNode * pNodeTest = fbxsdk::FbxNode::Create( pSceneTest, zNodeName.c_str() ); fbxsdk::FbxMesh* pMeshTest = fbxsdk::FbxMesh::Create( pSceneTest, "testmesh" ); pNodeTest->SetNodeAttribute( pMeshTest ); fbxsdk::FbxNode* pRootNodeTest = pSceneTest->GetRootNode(); pRootNodeTest->AddChild( pNodeTest ); // Initialize to export as .fbx file: pExporterTest->Initialize( zFilename.c_str(), 1, fbxManager->GetIOSettings() ); pExporterTest->Export( pSceneTest ); // Initialize to export based on detected extension (.obj file): pExporterTest->Initialize( zFilename.c_str(), -1, fbxManager->GetIOSettings() ); pExporterTest->Export( pSceneTest ); // Clean-up pSceneTest->Destroy( true ); pExporterTest->Destroy( true ); fbxManager->Destroy(); return; }
In the .fbx file I see this near the bottom of the file:
Objects: { Geometry: 2212458999648, "Geometry::testmesh", "Mesh" { } Model: 2212447434112, "Model::Basicстена", "Mesh" { Version: 232 Properties70: { P: "ScalingMax", "Vector3D", "Vector", "",0,0,0 P: "DefaultAttributeIndex", "int", "Integer", "",0 } Shading: Y Culling: "CullingOff" } } ; Object connections
and in the .obj file I see:
# # Wavefront OBJ file # Created with Kaydara FBX # g Basic__________
Solved! Go to Solution.