mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 12:04:18 +02:00
Accept textures as list or json
This commit is contained in:
parent
caf2595e13
commit
413c3b88cf
1 changed files with 8 additions and 4 deletions
|
@ -113,14 +113,18 @@ QVariantMap RenderableModelEntityItem::parseTexturesToMap(QString textures) {
|
|||
return _originalTexturesMap;
|
||||
}
|
||||
|
||||
QString jsonTextures = "{\"" + textures.replace(":\"", "\":\"").replace(",\n", ",\"") + "}";
|
||||
// Legacy: a ,\n-delimited list of filename:"texturepath"
|
||||
if (*textures.cbegin() != '{') {
|
||||
textures = "{\"" + textures.replace(":\"", "\":\"").replace(",\n", ",\"") + "}";
|
||||
}
|
||||
|
||||
QJsonParseError error;
|
||||
QJsonDocument texturesAsJson = QJsonDocument::fromJson(jsonTextures.toUtf8(), &error);
|
||||
QJsonDocument texturesJson = QJsonDocument::fromJson(textures.toUtf8(), &error);
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCWarning(entitiesrenderer) << "Could not evaluate textures property value:" << _textures;
|
||||
return _originalTexturesMap;
|
||||
}
|
||||
QJsonObject texturesAsJsonObject = texturesAsJson.object();
|
||||
return texturesAsJsonObject.toVariantMap();
|
||||
return texturesJson.object().toVariantMap();
|
||||
}
|
||||
|
||||
void RenderableModelEntityItem::remapTextures() {
|
||||
|
|
Loading…
Reference in a new issue