From 5a904579af895b6b69591481c596cb79d1690a6f Mon Sep 17 00:00:00 2001 From: bernatx Date: Mon, 3 Feb 2020 10:05:03 +0100 Subject: [PATCH] Fixing wrong comparison in 'if' clause --- CHANGELOG.md | 1 + Util/DockerUtils/fbx/src/FBX2OBJ.cpp | 34 ++++------------------------ 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b07c6a2f7..3b82b51b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Added 3 new parameters for the `carla.Weather`: `fog_density`, `fog_distance`, and (ground) `wetness` * New python clients: - `weather.py`: allows weather changes using the new weather parameters + * Fixed docker build of .BIN for pedestrian navigation * Fixed typos * Fixed agent failures due to API changes in is_within_distance_ahead() * Fixed incorrect doppler velocity for RADAR sensors. diff --git a/Util/DockerUtils/fbx/src/FBX2OBJ.cpp b/Util/DockerUtils/fbx/src/FBX2OBJ.cpp index 4ba9c631c..9d7321a0e 100644 --- a/Util/DockerUtils/fbx/src/FBX2OBJ.cpp +++ b/Util/DockerUtils/fbx/src/FBX2OBJ.cpp @@ -40,7 +40,7 @@ bool StartsWith(const char *name, const char *str) size_t lenName = strlen(name); size_t lenStr = strlen(str); - if (lenName == 0 || lenStr == 0 || lenStr != lenName) return false; + if (lenName == 0 || lenStr == 0 || lenStr > lenName) return false; return (memcmp(name, str, lenStr) == 0); } @@ -96,9 +96,7 @@ bool LoadScene( { int lFileMajor, lFileMinor, lFileRevision; int lSDKMajor, lSDKMinor, lSDKRevision; - //int i, lAnimStackCount; bool lStatus; - //char lPassword[1024]; // Get the version number of the FBX files generated by the // version of FBX SDK that you are using. @@ -106,7 +104,7 @@ bool LoadScene( // Create an importer. FbxImporter* lImporter = FbxImporter::Create(pSdkManager,""); - + // Initialize the importer by providing a filename. const bool lImportStatus = lImporter->Initialize(pFilename, -1, pSdkManager->GetIOSettings() ); @@ -130,8 +128,6 @@ bool LoadScene( return false; } - // printf("FBX version number for this FBX SDK is %d.%d.%d",lSDKMajor, lSDKMinor, lSDKRevision); - if (lImporter->IsFBX()) { IOS_REF.SetBoolProp(IMP_FBX_MATERIAL, false); @@ -161,30 +157,13 @@ bool SaveScene( bool pEmbedMedia ) { - //int lMajor, lMinor, lRevision; bool lStatus = true; // Create an exporter. FbxExporter* lExporter = FbxExporter::Create(pSdkManager, ""); - // show file formats available - // { - // //Try to export in ASCII if possible - // int lFormatIndex, lFormatCount = pSdkManager->GetIOPluginRegistry()->GetWriterFormatCount(); - - // for (lFormatIndex=0; lFormatIndexGetIOPluginRegistry()->WriterIsFBX(lFormatIndex)) - // { - // FbxString lDesc = pSdkManager->GetIOPluginRegistry()->GetWriterFormatDescription(lFormatIndex); - // printf("\n%d) %s", lFormatIndex, lDesc); - // } - // } - // printf("\n"); - // } - pFileFormat = pSdkManager->GetIOPluginRegistry()->FindWriterIDByDescription("Alias OBJ (*.obj)"); - + // Initialize the exporter by providing a filename. if(lExporter->Initialize(pFilename, pFileFormat, pSdkManager->GetIOSettings()) == false) { @@ -193,9 +172,6 @@ bool SaveScene( return false; } - // FbxManager::GetFileFormatVersion(lMajor, lMinor, lRevision); - // printf("FBX version number for this FBX SDK is %d.%d.%d",lMajor, lMinor, lRevision); - if (pSdkManager->GetIOPluginRegistry()->WriterIsFBX(pFileFormat)) { // Export options determine what kind of data is to be imported. @@ -237,13 +213,12 @@ int main(int argc, char **argv) FbxIOSettings * ios = FbxIOSettings::Create(gSdkManager, IOSROOT ); gSdkManager->SetIOSettings(ios); - // ImportExport(argv[1], argv[2], -1); // Create a scene FbxScene* lScene = FbxScene::Create(gSdkManager,""); // import bool r = LoadScene(gSdkManager, lScene, argv[1]); - if(!r) + if(!r) { printf("------- Import failed ----------------------------"); // Destroy the scene @@ -251,7 +226,6 @@ int main(int argc, char **argv) return 0; } - gMatRoad = CreateMaterial(lScene, "road"); gMatSidewalk = CreateMaterial(lScene, "sidewalk"); gMatCross = CreateMaterial(lScene, "crosswalk");