mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
Fix setting textures in model overlays
This commit is contained in:
parent
4974c88880
commit
c683c82817
2 changed files with 14 additions and 12 deletions
|
@ -123,17 +123,19 @@ void ModelOverlay::setProperties(const QVariantMap& properties) {
|
|||
auto texturesValue = properties["textures"];
|
||||
if (texturesValue.isValid() && texturesValue.canConvert(QVariant::Map)) {
|
||||
QVariantMap textureMap = texturesValue.toMap();
|
||||
foreach(const QString& key, textureMap.keys()) {
|
||||
|
||||
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()
|
||||
}
|
||||
QMetaObject::invokeMethod(_model.get(), "setTextures", Qt::AutoConnection,
|
||||
Q_ARG(const QVariantMap&, textureMap));
|
||||
// foreach(const QString& key, textureMap.keys()) {
|
||||
//
|
||||
// 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 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()
|
||||
// And so that getGeometry() isn't chained everywhere
|
||||
|
|
Loading…
Reference in a new issue