From 5a7b0dd1adc8b673029f93c0dbcc43891ed53d85 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 24 Nov 2015 11:46:51 -0600 Subject: [PATCH] put the parsed model URL in ModelEntityItem --- .../src/RenderableModelEntityItem.cpp | 10 ++++------ .../entities-renderer/src/RenderableModelEntityItem.h | 1 - libraries/entities/src/ModelEntityItem.h | 4 +++- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 08de327fa7..782458894d 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -219,13 +219,11 @@ void RenderableModelEntityItem::render(RenderArgs* args) { if (hasModel()) { if (_model) { - // convert the QString from getModelURL to a URL - _url = getModelURL(); - // check if the URL has changed - if (_url != _model->getURL()) { - qDebug().noquote() << "Updating model URL: " << _url.toDisplayString(); - _model->setURL(_url); + auto& currentURL = getParsedModelURL(); + if (currentURL != _model->getURL()) { + qDebug().noquote() << "Updating model URL: " << currentURL.toDisplayString(); + _model->setURL(currentURL); } render::ScenePointer scene = AbstractViewStateInterface::instance()->getMain3DScene(); diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index 3fdad50c9e..c4e36c240a 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -79,7 +79,6 @@ private: bool _originalTexturesRead = false; QVector> _points; bool _dimensionsInitialized = true; - QUrl _url; render::ItemID _myMetaItem; diff --git a/libraries/entities/src/ModelEntityItem.h b/libraries/entities/src/ModelEntityItem.h index e8ffcab3e7..fb41ac4b77 100644 --- a/libraries/entities/src/ModelEntityItem.h +++ b/libraries/entities/src/ModelEntityItem.h @@ -63,6 +63,7 @@ public: static const QString DEFAULT_MODEL_URL; const QString& getModelURL() const { return _modelURL; } + const QUrl& getParsedModelURL() const { return _parsedModelURL; } static const QString DEFAULT_COMPOUND_SHAPE_URL; const QString& getCompoundShapeURL() const { return _compoundShapeURL; } @@ -75,7 +76,7 @@ public: } // model related properties - void setModelURL(const QString& url) { _modelURL = url; } + void setModelURL(const QString& url) { _modelURL = url; _parsedModelURL = QUrl(url); } virtual void setCompoundShapeURL(const QString& url); @@ -134,6 +135,7 @@ protected: rgbColor _color; QString _modelURL; + QUrl _parsedModelURL; QString _compoundShapeURL; AnimationPropertyGroup _animationProperties;