steve3d Posted June 25, 2013 Posted June 25, 2013 we are using visual sudio 2012, before fbx-2014.1, there is no usable version for VS2012, and now FBX2014.1 has been released, so, here is is the little modification to the fbx plugin in unigine. Hope this can be integrated into next engine version. diff -u Autodesk/AutodeskImport.cpp Autodesk.new/AutodeskImport.cpp --- Autodesk/AutodeskImport.cpp 2013-06-19 16:04:22 +0800 +++ Autodesk.new/AutodeskImport.cpp 2013-06-25 11:06:40 +0800 @@ -172,11 +172,10 @@ // initialize importer AutodeskStream stream(file); FbxImporter *importer = FbxImporter::Create(manager,""); - int status = importer->Initialize(&stream,NULL,format,manager->GetIOSettings()); - if(status == 0) { - int error = importer->GetLastErrorID(); - Log::error("AutodeskImport::load(): can't initialize \"%s\" file\n%s\n",name,importer->GetLastErrorString()); - if(error == FbxIOBase::eFileVersionNotSupportedYet || error == FbxIOBase::eFileVersionNotSupportedAnymore) { + if(!importer->Initialize(&stream,NULL,format,manager->GetIOSettings())) { + FbxStatus &status = importer->GetStatus(); + Log::error("AutodeskImport::load(): can't initialize \"%s\" file\n%s\n",name, status.GetErrorString()); + if(status.GetCode() == FbxStatus::eInvalidFileVersion) { int sdk_major,sdk_minor,sdk_version; int file_major,file_minor,file_version; FbxManager::GetFileFormatVersion(sdk_major,sdk_minor,sdk_version); @@ -188,8 +187,9 @@ } // import scene - if(importer->Import(scene) == 0) { - Log::error("AutodeskImport::load(): can't import \"%s\" file\n%s",name,importer->GetLastErrorString()); + if(!importer->Import(scene)) { + FbxStatus &status = importer->GetStatus(); + Log::error("AutodeskImport::load(): can't import \"%s\" file\n%s",name,status.GetErrorString()); importer->Destroy(); return 0; } @@ -974,6 +974,8 @@ FbxStringList uv_names; FbxString first_uv_name; FbxString second_uv_name; + bool unmapped; + vec2 uv; mesh->GetUVSetNames(uv_names); for(int i = 0; i < uv_names.GetCount(); i++) { if(first_uv_name == uv_names[i]) continue; @@ -983,8 +985,15 @@ for(int j = 0; j < mesh->GetPolygonCount(); j++) { int size = mesh->GetPolygonSize(j); for(int k = 0; k < size; k++) { - if(mesh->GetPolygonVertexUV(j,k,first_uv_name,texcoord)) m.texcoords_0.append(vec2(dvec2(texcoord))); - else m.texcoords_0.append(vec2(0.0f)); + if(mesh->GetPolygonVertexUV(j,k,first_uv_name,texcoord,unmapped)) + { + if(unmapped) uv.x = uv.y = 0.0f; + else uv.x = (float)texcoord[0], uv.y = (float)texcoord[1]; + } + else + uv.x = uv.y = 0.0f; + + m.texcoords_0.append(uv); } } } else if(m.texcoords_1.empty()) { @@ -992,8 +1001,15 @@ for(int j = 0; j < mesh->GetPolygonCount(); j++) { int size = mesh->GetPolygonSize(j); for(int k = 0; k < size; k++) { - if(mesh->GetPolygonVertexUV(j,k,second_uv_name,texcoord)) m.texcoords_1.append(vec2(dvec2(texcoord))); - else m.texcoords_1.append(vec2(0.0f)); + if(mesh->GetPolygonVertexUV(j,k,second_uv_name,texcoord,unmapped)) + { + if(unmapped) uv.x = uv.y = 0.0f; + else uv.x = (float)texcoord[0], uv.y = (float)texcoord[1]; + } + else + uv.x = uv.y = 0.0f; + + m.texcoords_1.append(vec2(0.0f)); } } } else { attached file is rar compressed patch file Autodesk-fbx-2014.1.rar
frustum Posted June 25, 2013 Posted June 25, 2013 Thanks. It will be integrated into the next SDK with additional bone transformation fixes.
Recommended Posts