From fdc5aa1da54fd6580796d8efec36c151c29fbe0c Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 7 Nov 2014 09:54:13 -0800 Subject: [PATCH] include urls with texture names, make sure to wait till default textures loaded before setting new textures --- examples/libraries/entityPropertyDialogBox.js | 2 +- interface/src/entities/RenderableModelEntityItem.cpp | 5 ++++- interface/src/renderer/GeometryCache.cpp | 9 ++++++--- libraries/entities/src/EntityItemProperties.cpp | 2 +- libraries/networking/src/ResourceCache.h | 2 ++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/examples/libraries/entityPropertyDialogBox.js b/examples/libraries/entityPropertyDialogBox.js index cf9cec8d24..584d7a38d0 100644 --- a/examples/libraries/entityPropertyDialogBox.js +++ b/examples/libraries/entityPropertyDialogBox.js @@ -54,7 +54,7 @@ EntityPropertyDialogBox = (function () { index++; array.push({ label: "Textures:", value: properties.textures }); index++; - array.push({ label: "Texture Names:" + properties.textureNames, type: "header" }); + array.push({ label: "Texture Names:\n" + properties.textureNames, type: "header" }); index++; } array.push({ label: "Position:", type: "header" }); diff --git a/interface/src/entities/RenderableModelEntityItem.cpp b/interface/src/entities/RenderableModelEntityItem.cpp index 1900b3facd..b9d67bf619 100644 --- a/interface/src/entities/RenderableModelEntityItem.cpp +++ b/interface/src/entities/RenderableModelEntityItem.cpp @@ -62,10 +62,13 @@ void RenderableModelEntityItem::remapTextures() { return; // nothing to do if we don't have a model } + if (!_model->isLoadedWithTextures()) { + return; // nothing to do if the model has not yet loaded it's default textures + } + if (_currentTextures == _textures) { return; // nothing to do if our recently mapped textures match our desired textures } - qDebug() << "void RenderableModelEntityItem::remapTextures()...."; // since we're changing here, we need to run through our current texture map // and any textures in the recently mapped texture, that is not in our desired diff --git a/interface/src/renderer/GeometryCache.cpp b/interface/src/renderer/GeometryCache.cpp index 6d9c53f42c..1742afba05 100644 --- a/interface/src/renderer/GeometryCache.cpp +++ b/interface/src/renderer/GeometryCache.cpp @@ -742,15 +742,18 @@ QStringList NetworkGeometry::getTextureNames() const { const NetworkMeshPart& part = mesh.parts[j]; if (!part.diffuseTextureName.isEmpty()) { - result << part.diffuseTextureName; + QString textureURL = part.diffuseTexture->getURL().toString(); + result << part.diffuseTextureName + ":" + textureURL; } if (!part.normalTextureName.isEmpty()) { - result << part.normalTextureName; + QString textureURL = part.normalTexture->getURL().toString(); + result << part.normalTextureName + ":" + textureURL; } if (!part.specularTextureName.isEmpty()) { - result << part.specularTextureName; + QString textureURL = part.specularTexture->getURL().toString(); + result << part.specularTextureName + ":" + textureURL; } } } diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 451fffec80..27dbe35a6d 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -243,7 +243,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine) cons boundingBox.setProperty("dimensions", boundingBoxDimensions); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(boundingBox, boundingBox); // gettable, but not settable - QString textureNamesList = _textureNames.join(","); + QString textureNamesList = _textureNames.join(",\n"); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(textureNames, textureNamesList); // gettable, but not settable return properties; diff --git a/libraries/networking/src/ResourceCache.h b/libraries/networking/src/ResourceCache.h index d9520a4e68..496839fdcd 100644 --- a/libraries/networking/src/ResourceCache.h +++ b/libraries/networking/src/ResourceCache.h @@ -123,6 +123,8 @@ public: void setCache(ResourceCache* cache) { _cache = cache; } Q_INVOKABLE void allReferencesCleared(); + + const QUrl& getURL() const { return _url; } signals: