mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 00:13:29 +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 RenderableModelEntityItem::getJointNames() const {
|
||||||
QStringList result;
|
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()) {
|
if (_model && _model->isActive()) {
|
||||||
RigPointer rig = _model->getRig();
|
RigPointer rig = _model->getRig();
|
||||||
int jointCount = rig->getJointStateCount();
|
int jointCount = rig->getJointStateCount();
|
||||||
|
|
|
@ -977,20 +977,18 @@ int EntityScriptingInterface::getJointIndex(const QUuid& entityID, const QString
|
||||||
if (!_entityTree) {
|
if (!_entityTree) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID);
|
int result;
|
||||||
if (!entity) {
|
QMetaObject::invokeMethod(_entityTree.get(), "getJointIndex", Qt::BlockingQueuedConnection,
|
||||||
return -1;
|
Q_ARG(QUuid, entityID), Q_ARG(QString, name), Q_RETURN_ARG(int, result));
|
||||||
}
|
return result;
|
||||||
return entity->getJointIndex(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList EntityScriptingInterface::getJointNames(const QUuid& entityID) {
|
QStringList EntityScriptingInterface::getJointNames(const QUuid& entityID) {
|
||||||
if (!_entityTree) {
|
if (!_entityTree) {
|
||||||
return QStringList();
|
return QStringList();
|
||||||
}
|
}
|
||||||
EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID);
|
QStringList result;
|
||||||
if (!entity) {
|
QMetaObject::invokeMethod(_entityTree.get(), "getJointNames", Qt::BlockingQueuedConnection,
|
||||||
return QStringList();
|
Q_ARG(QUuid, entityID), Q_RETURN_ARG(QStringList, result));
|
||||||
}
|
return result;
|
||||||
return entity->getJointNames();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1358,7 +1358,6 @@ void EntityTree::trackIncomingEntityLastEdited(quint64 lastEditedTime, int bytes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EntityTree::callLoader(EntityItemID entityID) {
|
void EntityTree::callLoader(EntityItemID entityID) {
|
||||||
// this is used to bounce from the networking thread to the main thread
|
// this is used to bounce from the networking thread to the main thread
|
||||||
EntityItemPointer entity = findEntityByEntityItemID(entityID);
|
EntityItemPointer entity = findEntityByEntityItemID(entityID);
|
||||||
|
@ -1366,3 +1365,21 @@ void EntityTree::callLoader(EntityItemID entityID) {
|
||||||
entity->loader();
|
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);
|
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:
|
public slots:
|
||||||
void callLoader(EntityItemID entityID);
|
void callLoader(EntityItemID entityID);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue