diff --git a/code/AssetLib/glTF2/glTF2Asset.h b/code/AssetLib/glTF2/glTF2Asset.h index 1a44b8377..754d6b593 100644 --- a/code/AssetLib/glTF2/glTF2Asset.h +++ b/code/AssetLib/glTF2/glTF2Asset.h @@ -383,32 +383,7 @@ struct Extras { std::vector mValues; inline bool HasExtras() const { - return mValues.size() != 0; - } - - Extras() = default; - ~Extras() = default; - - Extras(const Extras &other) : - mValues(other.mValues) { - // empty - } -}; - -//! Represents metadata in an glTF2 object -struct Extras { - std::vector mValues; - - inline bool HasExtras() const { - return mValues.size() != 0; - } - - Extras() = default; - ~Extras() = default; - - Extras(const Extras &other) : - mValues(other.mValues) { - // empty + return !mValues.empty(); } }; diff --git a/code/AssetLib/glTF2/glTF2Asset.inl b/code/AssetLib/glTF2/glTF2Asset.inl index 3a7d127d3..891fa27b5 100644 --- a/code/AssetLib/glTF2/glTF2Asset.inl +++ b/code/AssetLib/glTF2/glTF2Asset.inl @@ -145,7 +145,7 @@ inline Extras ReadExtras(Value &obj) { ret.mValues.reserve(obj.MemberCount()); for (auto it = obj.MemberBegin(); it != obj.MemberEnd(); ++it) { auto &val = it->value; - ret.mValues.push_back(ReadExtensions(it->name.GetString(), val)); + ret.mValues.emplace_back(ReadExtensions(it->name.GetString(), val)); } return ret; diff --git a/code/AssetLib/glTF2/glTF2Exporter.cpp b/code/AssetLib/glTF2/glTF2Exporter.cpp index 028ab5c17..2996a8805 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.cpp +++ b/code/AssetLib/glTF2/glTF2Exporter.cpp @@ -461,6 +461,10 @@ inline void ExportNodeExtras(const aiMetadataEntry &metadataEntry, aiString name value.mUint64Value.value = *static_cast(metadataEntry.mData); value.mUint64Value.isPresent = true; break; + case AI_FLOAT: + value.mDoubleValue.value = *static_cast(metadataEntry.mData); + value.mDoubleValue.isPresent = true; + break; case AI_DOUBLE: value.mDoubleValue.value = *static_cast(metadataEntry.mData); value.mDoubleValue.isPresent = true; @@ -469,7 +473,7 @@ inline void ExportNodeExtras(const aiMetadataEntry &metadataEntry, aiString name value.mStringValue.value = static_cast(metadataEntry.mData)->C_Str(); value.mStringValue.isPresent = true; break; - case AI_AIMETADATA: + case AI_AIMETADATA: { const aiMetadata *subMetadata = static_cast(metadataEntry.mData); value.mValues.value.resize(subMetadata->mNumProperties); value.mValues.isPresent = true; @@ -479,6 +483,10 @@ inline void ExportNodeExtras(const aiMetadataEntry &metadataEntry, aiString name } break; } + default: + // AI_AIVECTOR3D not handled + break; + } } inline void ExportNodeExtras(const aiMetadata *metadata, Extras &extras) {