Merge branch 'master' into fix-vector-out-of-bound-access

This commit is contained in:
Kim Kulling
2018-05-26 13:25:57 +02:00
committed by GitHub
15 changed files with 521 additions and 195 deletions

View File

@@ -71,7 +71,7 @@ static const aiImporterDesc desc = {
0,
0,
0,
"3ds prj 3DS PRJ"
"3ds prj"
};
@@ -127,7 +127,7 @@ Discreet3DSImporter::~Discreet3DSImporter() {
// Returns whether the class can handle the format of the given file.
bool Discreet3DSImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const {
std::string extension = GetExtension(pFile);
if(extension == "3ds" || extension == "3DS" || extension == "prj"|| extension == "PRJ" ) {
if(extension == "3ds" || extension == "prj") {
return true;
}

View File

@@ -222,7 +222,7 @@ void D3MFExporter::writeMetaData() {
return;
}
const aiString *key;
const aiString *key = nullptr;
const aiMetadataEntry *entry(nullptr);
for ( size_t i = 0; i < numMetaEntries; ++i ) {
mScene->mMetaData->Get( i, key, entry );

View File

@@ -970,15 +970,18 @@ void Importer::GetExtensionList(aiString& szOut) const
(*i)->GetExtensionList(str);
}
for (std::set<std::string>::const_iterator it = str.begin();; ) {
szOut.Append("*.");
szOut.Append((*it).c_str());
// List can be empty
if( !str.empty() ) {
for (std::set<std::string>::const_iterator it = str.begin();; ) {
szOut.Append("*.");
szOut.Append((*it).c_str());
if (++it == str.end()) {
break;
}
szOut.Append(";");
}
if (++it == str.end()) {
break;
}
szOut.Append(";");
}
}
ASSIMP_END_EXCEPTION_REGION(void);
}

View File

@@ -1216,12 +1216,15 @@ inline void Asset::Load(const std::string& pFile, bool isBinary)
// Read the "scene" property, which specifies which scene to load
// and recursively load everything referenced by it
unsigned int sceneIndex = 0;
if (Value* scene = FindUInt(doc, "scene")) {
unsigned int sceneIndex = scene->GetUint();
sceneIndex = scene->GetUint();
}
Ref<Scene> s = scenes.Retrieve(sceneIndex);
this->scene = s;
if (Value* scenesArray = FindArray(doc, "scenes")) {
if (sceneIndex < scenesArray->Size()) {
this->scene = scenes.Retrieve(sceneIndex);
}
}
// Clean up

View File

@@ -514,9 +514,9 @@ void glTF2Exporter::ExportMaterials()
GetMatColor(mat, pbrSG.specularFactor, AI_MATKEY_COLOR_SPECULAR);
if (mat->Get(AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS_GLOSSINESS_FACTOR, pbrSG.glossinessFactor) != AI_SUCCESS) {
float shininess;
float shininess;
if (mat->Get(AI_MATKEY_SHININESS, shininess)) {
if (mat->Get(AI_MATKEY_SHININESS, shininess) == AI_SUCCESS) {
pbrSG.glossinessFactor = shininess / 1000;
}
}