mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #8726 from huffman/feat/model-overlay-hide-change-textures
Fix model overlay visibility and texture properties
This commit is contained in:
commit
3f64847888
2 changed files with 6 additions and 16 deletions
|
@ -79,11 +79,10 @@ void ModelOverlay::render(RenderArgs* args) {
|
||||||
_model->removeFromScene(scene, pendingChanges);
|
_model->removeFromScene(scene, pendingChanges);
|
||||||
_model->addToScene(scene, pendingChanges);
|
_model->addToScene(scene, pendingChanges);
|
||||||
}
|
}
|
||||||
scene->enqueuePendingChanges(pendingChanges);
|
|
||||||
|
|
||||||
if (!_visible) {
|
_model->setVisibleInScene(_visible, scene);
|
||||||
return;
|
|
||||||
}
|
scene->enqueuePendingChanges(pendingChanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelOverlay::setProperties(const QVariantMap& properties) {
|
void ModelOverlay::setProperties(const QVariantMap& properties) {
|
||||||
|
@ -123,17 +122,8 @@ void ModelOverlay::setProperties(const QVariantMap& properties) {
|
||||||
auto texturesValue = properties["textures"];
|
auto texturesValue = properties["textures"];
|
||||||
if (texturesValue.isValid() && texturesValue.canConvert(QVariant::Map)) {
|
if (texturesValue.isValid() && texturesValue.canConvert(QVariant::Map)) {
|
||||||
QVariantMap textureMap = texturesValue.toMap();
|
QVariantMap textureMap = texturesValue.toMap();
|
||||||
foreach(const QString& key, textureMap.keys()) {
|
QMetaObject::invokeMethod(_model.get(), "setTextures", Qt::AutoConnection,
|
||||||
|
Q_ARG(const QVariantMap&, textureMap));
|
||||||
QUrl newTextureURL = textureMap[key].toUrl();
|
|
||||||
qDebug() << "Updating texture named" << key << "to texture at URL" << newTextureURL;
|
|
||||||
|
|
||||||
QMetaObject::invokeMethod(_model.get(), "setTextureWithNameToURL", Qt::AutoConnection,
|
|
||||||
Q_ARG(const QString&, key),
|
|
||||||
Q_ARG(const QUrl&, newTextureURL));
|
|
||||||
|
|
||||||
_modelTextures[key] = newTextureURL; // Keep local track of textures for getProperty()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ public:
|
||||||
const Geometry::Pointer& getCollisionGeometry() const { return _collisionGeometry; }
|
const Geometry::Pointer& getCollisionGeometry() const { return _collisionGeometry; }
|
||||||
|
|
||||||
const QVariantMap getTextures() const { assert(isLoaded()); return _renderGeometry->getTextures(); }
|
const QVariantMap getTextures() const { assert(isLoaded()); return _renderGeometry->getTextures(); }
|
||||||
void setTextures(const QVariantMap& textures);
|
Q_INVOKABLE void setTextures(const QVariantMap& textures);
|
||||||
|
|
||||||
/// Provided as a convenience, will crash if !isLoaded()
|
/// Provided as a convenience, will crash if !isLoaded()
|
||||||
// And so that getGeometry() isn't chained everywhere
|
// And so that getGeometry() isn't chained everywhere
|
||||||
|
|
Loading…
Reference in a new issue