Merge pull request #6471 from birarda/url-cmp

fix unnecessary model URL updating thanks to URL encoding
This commit is contained in:
Brad Hefta-Gaub 2015-11-24 10:56:21 -08:00
commit fd7a704753
2 changed files with 8 additions and 4 deletions

View file

@ -219,9 +219,11 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
if (hasModel()) {
if (_model) {
if (getModelURL() != _model->getURL().toString()) {
qDebug() << "Updating model URL: " << getModelURL();
_model->setURL(getModelURL());
// check if the URL has changed
auto& currentURL = getParsedModelURL();
if (currentURL != _model->getURL()) {
qDebug().noquote() << "Updating model URL: " << currentURL.toDisplayString();
_model->setURL(currentURL);
}
render::ScenePointer scene = AbstractViewStateInterface::instance()->getMain3DScene();

View file

@ -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;