Fixing wrong comparison in 'if' clause

This commit is contained in:
bernatx 2020-02-03 10:05:03 +01:00 committed by Marc Garcia Puig
parent b83721c6e0
commit 5a904579af
2 changed files with 5 additions and 30 deletions

View File

@ -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.

View File

@ -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; lFormatIndex<lFormatCount; lFormatIndex++)
// {
// // if (pSdkManager->GetIOPluginRegistry()->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");