From 84ee22c30dcec06b2290a5aacf551ff5a019fe56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 1 Apr 2022 15:15:02 +0200 Subject: [PATCH] sceneconverter: ah, yes, STL "usability" strikes again. --- src/Magnum/SceneTools/sceneconverter.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Magnum/SceneTools/sceneconverter.cpp b/src/Magnum/SceneTools/sceneconverter.cpp index 1b20084c8..104ff749c 100644 --- a/src/Magnum/SceneTools/sceneconverter.cpp +++ b/src/Magnum/SceneTools/sceneconverter.cpp @@ -456,7 +456,10 @@ is specified as well, the IDs reference attributes of the first mesh.)") passed and the file has at least one scene). Texture reference count is calculated when parsing materials. */ Containers::Array sceneInfos; - std::unordered_map sceneFieldNames; + /* Only the very latest GCC seems to support enum classes as keys and + I can't be bothered to write a std::hash specialization, so just + making the key typeless */ + std::unordered_map sceneFieldNames; Containers::Array materialReferenceCount; Containers::Array lightReferenceCount; Containers::Array meshReferenceCount; @@ -514,7 +517,7 @@ is specified as well, the IDs reference attributes of the first mesh.)") reused by object info as well. */ if(Trade::isSceneFieldCustom(name)) { /* Fetch the name only if it's not already there */ - const auto inserted = sceneFieldNames.emplace(name, Containers::String{}); + const auto inserted = sceneFieldNames.emplace(UnsignedInt(name), Containers::String{}); if(inserted.second) inserted.first->second = importer->sceneFieldName(name); } @@ -826,7 +829,8 @@ is specified as well, the IDs reference attributes of the first mesh.)") d << Debug::newline << " " << Debug::packed << Debug::boldColor(Debug::Color::White) << field.name << Debug::resetColor; if(Trade::isSceneFieldCustom(field.name)) { d << Debug::color(Debug::Color::Yellow) - << sceneFieldNames[field.name] << Debug::resetColor; + << sceneFieldNames[UnsignedInt(field.name)] + << Debug::resetColor; } d << Debug::color(Debug::Color::Blue) << "@" << Debug::packed << Debug::color(Debug::Color::Cyan) << field.type; if(field.arraySize) @@ -866,7 +870,8 @@ is specified as well, the IDs reference attributes of the first mesh.)") d << Debug::resetColor; if(Trade::isSceneFieldCustom(nameCount.first())) { d << Debug::color(Debug::Color::Yellow) - << sceneFieldNames[nameCount.first()] << Debug::resetColor; + << sceneFieldNames[UnsignedInt(nameCount.first())] + << Debug::resetColor; } } }