mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 19:50:38 +02:00
Remove checking of empty model url and add sanity for checking modelUrl field existing
This commit is contained in:
parent
3ef9ce0af6
commit
6685b74c2a
2 changed files with 6 additions and 4 deletions
|
@ -2223,11 +2223,13 @@ glm::vec3 variantToVec3(const QVariant& var) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttachmentData::fromVariant(const QVariant& variant) {
|
bool AttachmentData::fromVariant(const QVariant& variant) {
|
||||||
|
bool isValid = false;
|
||||||
auto map = variant.toMap();
|
auto map = variant.toMap();
|
||||||
if (map.contains("modelUrl")) {
|
if (map.contains("modelUrl")) {
|
||||||
auto urlString = map["modelUrl"].toString();
|
auto urlString = map["modelUrl"].toString();
|
||||||
modelURL = urlString;
|
modelURL = urlString;
|
||||||
|
isValid = true;
|
||||||
}
|
}
|
||||||
if (map.contains("jointName")) {
|
if (map.contains("jointName")) {
|
||||||
jointName = map["jointName"].toString();
|
jointName = map["jointName"].toString();
|
||||||
|
@ -2244,6 +2246,7 @@ void AttachmentData::fromVariant(const QVariant& variant) {
|
||||||
if (map.contains("soft")) {
|
if (map.contains("soft")) {
|
||||||
isSoft = map["soft"].toBool();
|
isSoft = map["soft"].toBool();
|
||||||
}
|
}
|
||||||
|
return isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantList AvatarData::getAttachmentsVariant() const {
|
QVariantList AvatarData::getAttachmentsVariant() const {
|
||||||
|
@ -2259,8 +2262,7 @@ void AvatarData::setAttachmentsVariant(const QVariantList& variant) {
|
||||||
newAttachments.reserve(variant.size());
|
newAttachments.reserve(variant.size());
|
||||||
for (const auto& attachmentVar : variant) {
|
for (const auto& attachmentVar : variant) {
|
||||||
AttachmentData attachment;
|
AttachmentData attachment;
|
||||||
attachment.fromVariant(attachmentVar);
|
if (attachment.fromVariant(attachmentVar)) {
|
||||||
if (!attachment.modelURL.isEmpty()) {
|
|
||||||
newAttachments.append(attachment);
|
newAttachments.append(attachment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -903,7 +903,7 @@ public:
|
||||||
void fromJson(const QJsonObject& json);
|
void fromJson(const QJsonObject& json);
|
||||||
|
|
||||||
QVariant toVariant() const;
|
QVariant toVariant() const;
|
||||||
void fromVariant(const QVariant& variant);
|
bool fromVariant(const QVariant& variant);
|
||||||
};
|
};
|
||||||
|
|
||||||
QDataStream& operator<<(QDataStream& out, const AttachmentData& attachment);
|
QDataStream& operator<<(QDataStream& out, const AttachmentData& attachment);
|
||||||
|
|
Loading…
Reference in a new issue