Added suggested changes and fixed automated check errors

pull/4658/head
Bengt Rosenberger 2022-08-01 14:39:10 +02:00
parent f20071d740
commit abfe8ad413
3 changed files with 11 additions and 28 deletions

View File

@ -383,32 +383,7 @@ struct Extras {
std::vector<CustomExtension> 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<CustomExtension> mValues;
inline bool HasExtras() const {
return mValues.size() != 0;
}
Extras() = default;
~Extras() = default;
Extras(const Extras &other) :
mValues(other.mValues) {
// empty
return !mValues.empty();
}
};

View File

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

View File

@ -461,6 +461,10 @@ inline void ExportNodeExtras(const aiMetadataEntry &metadataEntry, aiString name
value.mUint64Value.value = *static_cast<uint64_t *>(metadataEntry.mData);
value.mUint64Value.isPresent = true;
break;
case AI_FLOAT:
value.mDoubleValue.value = *static_cast<float *>(metadataEntry.mData);
value.mDoubleValue.isPresent = true;
break;
case AI_DOUBLE:
value.mDoubleValue.value = *static_cast<double *>(metadataEntry.mData);
value.mDoubleValue.isPresent = true;
@ -469,7 +473,7 @@ inline void ExportNodeExtras(const aiMetadataEntry &metadataEntry, aiString name
value.mStringValue.value = static_cast<aiString *>(metadataEntry.mData)->C_Str();
value.mStringValue.isPresent = true;
break;
case AI_AIMETADATA:
case AI_AIMETADATA: {
const aiMetadata *subMetadata = static_cast<aiMetadata *>(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) {