mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 02:16:51 +02:00
Use default texs for empty json
This commit is contained in:
parent
984bacdae3
commit
377a20e983
1 changed files with 7 additions and 0 deletions
|
@ -116,11 +116,18 @@ QVariantMap RenderableModelEntityItem::parseTexturesToMap(QString textures) {
|
||||||
|
|
||||||
QJsonParseError error;
|
QJsonParseError error;
|
||||||
QJsonDocument texturesJson = QJsonDocument::fromJson(textures.toUtf8(), &error);
|
QJsonDocument texturesJson = QJsonDocument::fromJson(textures.toUtf8(), &error);
|
||||||
|
// If textures are invalid, revert to original textures
|
||||||
if (error.error != QJsonParseError::NoError) {
|
if (error.error != QJsonParseError::NoError) {
|
||||||
qCWarning(entitiesrenderer) << "Could not evaluate textures property value:" << textures;
|
qCWarning(entitiesrenderer) << "Could not evaluate textures property value:" << textures;
|
||||||
return _originalTextures;
|
return _originalTextures;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantMap texturesMap = texturesJson.toVariant().toMap();
|
||||||
|
// If textures are unset, revert to original textures
|
||||||
|
if (texturesMap.isEmpty()) {
|
||||||
|
return _originalTextures;
|
||||||
|
}
|
||||||
|
|
||||||
return texturesJson.toVariant().toMap();
|
return texturesJson.toVariant().toMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue