Locale independent meter scale

`XmlParser::getRealAttribute(...)` will call `strtod` (or `wcstod`) which are both locale dependent. So on a German locale system a scale of 0.01 meter will be parsed to 0. In order to avoid that I use the `fast_atoreal_move<ai_real>()` method.
pull/4323/head
tanolino 2022-01-05 10:10:38 +01:00 committed by GitHub
parent 1d815fc23e
commit 04d2d13172
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -331,7 +331,16 @@ void ColladaParser::ReadAssetInfo(XmlNode &node) {
const std::string &currentName = currentNode.name();
if (currentName == "unit") {
mUnitSize = 1.f;
XmlParser::getRealAttribute(currentNode, "meter", mUnitSize);
std::string tUnitSizeString;
if (XmlParser::getStdStrAttribute(currentNode, "meter", tUnitSizeString)) {
try {
fast_atoreal_move<ai_real>(tUnitSizeString.data(), mUnitSize);
} catch (DeadlyImportError die) {
std::string warning("Collada: Failed to parse meter parameter to real number. Exception:\n");
warning.append(die.what());
ASSIMP_LOG_WARN(warning.data());
}
}
} else if (currentName == "up_axis") {
std::string v;
if (!XmlParser::getValueAsString(currentNode, v)) {