mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 17:03:58 +02:00
use InvokeMethod so that texture change happens on the right thread
This commit is contained in:
parent
e079ec4363
commit
e97aef581a
2 changed files with 6 additions and 2 deletions
|
@ -183,7 +183,7 @@ public:
|
|||
|
||||
void inverseKinematics(int jointIndex, glm::vec3 position, const glm::quat& rotation, float priority);
|
||||
|
||||
void setTextureWithNameToURL(const QString& name, const QUrl& url)
|
||||
Q_INVOKABLE void setTextureWithNameToURL(const QString& name, const QUrl& url)
|
||||
{ _geometry->setTextureWithNameToURL(name, url); }
|
||||
|
||||
protected:
|
||||
|
|
|
@ -107,9 +107,13 @@ void ModelOverlay::setProperties(const QScriptValue &properties) {
|
|||
if (texturesValue.isValid()) {
|
||||
QVariantMap textureMap = texturesValue.toVariant().toMap();
|
||||
foreach(const QString& key, textureMap.keys()) {
|
||||
|
||||
QUrl newTextureURL = textureMap[key].toUrl();
|
||||
qDebug() << "Updating texture named" << key << "to texture at URL" << newTextureURL;
|
||||
_model.setTextureWithNameToURL(key, newTextureURL);
|
||||
|
||||
QMetaObject::invokeMethod(&_model, "setTextureWithNameToURL", Qt::AutoConnection,
|
||||
Q_ARG(const QString&, key),
|
||||
Q_ARG(const QUrl&, newTextureURL));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue