mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-10 01:36:26 +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 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); }
|
{ _geometry->setTextureWithNameToURL(name, url); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -107,9 +107,13 @@ void ModelOverlay::setProperties(const QScriptValue &properties) {
|
||||||
if (texturesValue.isValid()) {
|
if (texturesValue.isValid()) {
|
||||||
QVariantMap textureMap = texturesValue.toVariant().toMap();
|
QVariantMap textureMap = texturesValue.toVariant().toMap();
|
||||||
foreach(const QString& key, textureMap.keys()) {
|
foreach(const QString& key, textureMap.keys()) {
|
||||||
|
|
||||||
QUrl newTextureURL = textureMap[key].toUrl();
|
QUrl newTextureURL = textureMap[key].toUrl();
|
||||||
qDebug() << "Updating texture named" << key << "to texture at URL" << newTextureURL;
|
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