mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
try again to make this thread safe
This commit is contained in:
parent
a515d6debe
commit
edea0320e6
4 changed files with 30 additions and 16 deletions
|
@ -774,11 +774,6 @@ int RenderableModelEntityItem::getJointIndex(const QString& name) const {
|
|||
|
||||
QStringList RenderableModelEntityItem::getJointNames() const {
|
||||
QStringList result;
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(const_cast<RenderableModelEntityItem*>(this), "getJointNames", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(QStringList, result));
|
||||
return result;
|
||||
}
|
||||
if (_model && _model->isActive()) {
|
||||
RigPointer rig = _model->getRig();
|
||||
int jointCount = rig->getJointStateCount();
|
||||
|
|
|
@ -977,20 +977,18 @@ int EntityScriptingInterface::getJointIndex(const QUuid& entityID, const QString
|
|||
if (!_entityTree) {
|
||||
return -1;
|
||||
}
|
||||
EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID);
|
||||
if (!entity) {
|
||||
return -1;
|
||||
}
|
||||
return entity->getJointIndex(name);
|
||||
int result;
|
||||
QMetaObject::invokeMethod(_entityTree.get(), "getJointIndex", Qt::BlockingQueuedConnection,
|
||||
Q_ARG(QUuid, entityID), Q_ARG(QString, name), Q_RETURN_ARG(int, result));
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList EntityScriptingInterface::getJointNames(const QUuid& entityID) {
|
||||
if (!_entityTree) {
|
||||
return QStringList();
|
||||
}
|
||||
EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID);
|
||||
if (!entity) {
|
||||
return QStringList();
|
||||
}
|
||||
return entity->getJointNames();
|
||||
QStringList result;
|
||||
QMetaObject::invokeMethod(_entityTree.get(), "getJointNames", Qt::BlockingQueuedConnection,
|
||||
Q_ARG(QUuid, entityID), Q_RETURN_ARG(QStringList, result));
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1358,7 +1358,6 @@ void EntityTree::trackIncomingEntityLastEdited(quint64 lastEditedTime, int bytes
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void EntityTree::callLoader(EntityItemID entityID) {
|
||||
// this is used to bounce from the networking thread to the main thread
|
||||
EntityItemPointer entity = findEntityByEntityItemID(entityID);
|
||||
|
@ -1366,3 +1365,21 @@ void EntityTree::callLoader(EntityItemID entityID) {
|
|||
entity->loader();
|
||||
}
|
||||
}
|
||||
|
||||
int EntityTree::getJointIndex(const QUuid& entityID, const QString& name) const {
|
||||
EntityTree* nonConstThis = const_cast<EntityTree*>(this);
|
||||
EntityItemPointer entity = nonConstThis->findEntityByEntityItemID(entityID);
|
||||
if (!entity) {
|
||||
return -1;
|
||||
}
|
||||
return entity->getJointIndex(name);
|
||||
}
|
||||
|
||||
QStringList EntityTree::getJointNames(const QUuid& entityID) const {
|
||||
EntityTree* nonConstThis = const_cast<EntityTree*>(this);
|
||||
EntityItemPointer entity = nonConstThis->findEntityByEntityItemID(entityID);
|
||||
if (!entity) {
|
||||
return QStringList();
|
||||
}
|
||||
return entity->getJointNames();
|
||||
}
|
||||
|
|
|
@ -236,6 +236,10 @@ public:
|
|||
return _deletedEntityItemIDs.contains(id);
|
||||
}
|
||||
|
||||
// these are used to call through to EntityItems
|
||||
int getJointIndex(const QUuid& entityID, const QString& name) const;
|
||||
QStringList getJointNames(const QUuid& entityID) const;
|
||||
|
||||
public slots:
|
||||
void callLoader(EntityItemID entityID);
|
||||
|
||||
|
|
Loading…
Reference in a new issue