mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
add getJointTranslations() methods
This commit is contained in:
parent
50456f71ed
commit
28b3eef7aa
6 changed files with 37 additions and 0 deletions
|
@ -929,6 +929,17 @@ QVector<glm::quat> Avatar::getJointRotations() const {
|
|||
return jointRotations;
|
||||
}
|
||||
|
||||
QVector<glm::vec3> Avatar::getJointTranslations() const {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
return AvatarData::getJointTranslations();
|
||||
}
|
||||
QVector<glm::vec3> jointTranslations(_skeletonModel->getJointStateCount());
|
||||
for (int i = 0; i < _skeletonModel->getJointStateCount(); ++i) {
|
||||
_skeletonModel->getJointTranslation(i, jointTranslations[i]);
|
||||
}
|
||||
return jointTranslations;
|
||||
}
|
||||
|
||||
glm::quat Avatar::getJointRotation(int index) const {
|
||||
glm::quat rotation;
|
||||
_skeletonModel->getJointRotation(index, rotation);
|
||||
|
|
|
@ -112,6 +112,7 @@ public:
|
|||
|
||||
virtual QVector<glm::quat> getJointRotations() const override;
|
||||
virtual glm::quat getJointRotation(int index) const override;
|
||||
virtual QVector<glm::vec3> getJointTranslations() const override;
|
||||
virtual glm::vec3 getJointTranslation(int index) const override;
|
||||
virtual int getJointIndex(const QString& name) const override;
|
||||
virtual QStringList getJointNames() const override;
|
||||
|
|
|
@ -1391,6 +1391,22 @@ void AvatarData::setJointRotations(QVector<glm::quat> jointRotations) {
|
|||
}
|
||||
}
|
||||
|
||||
QVector<glm::vec3> AvatarData::getJointTranslations() const {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QVector<glm::vec3> result;
|
||||
QMetaObject::invokeMethod(const_cast<AvatarData*>(this),
|
||||
"getJointTranslations", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(QVector<glm::vec3>, result));
|
||||
return result;
|
||||
}
|
||||
QReadLocker readLock(&_jointDataLock);
|
||||
QVector<glm::vec3> jointTranslations(_jointData.size());
|
||||
for (int i = 0; i < _jointData.size(); ++i) {
|
||||
jointTranslations[i] = _jointData[i].translation;
|
||||
}
|
||||
return jointTranslations;
|
||||
}
|
||||
|
||||
void AvatarData::setJointTranslations(QVector<glm::vec3> jointTranslations) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QVector<glm::quat> result;
|
||||
|
|
|
@ -497,6 +497,7 @@ public:
|
|||
Q_INVOKABLE glm::vec3 getJointTranslation(const QString& name) const;
|
||||
|
||||
Q_INVOKABLE virtual QVector<glm::quat> getJointRotations() const;
|
||||
Q_INVOKABLE virtual QVector<glm::vec3> getJointTranslations() const;
|
||||
Q_INVOKABLE virtual void setJointRotations(QVector<glm::quat> jointRotations);
|
||||
Q_INVOKABLE virtual void setJointTranslations(QVector<glm::vec3> jointTranslations);
|
||||
|
||||
|
|
|
@ -210,6 +210,13 @@ QVector<glm::quat> ScriptAvatarData::getJointRotations() const {
|
|||
return QVector<glm::quat>();
|
||||
}
|
||||
}
|
||||
QVector<glm::vec3> ScriptAvatarData::getJointTranslations() const {
|
||||
if (AvatarSharedPointer sharedAvatarData = _avatarData.lock()) {
|
||||
return sharedAvatarData->getJointTranslations();
|
||||
} else {
|
||||
return QVector<glm::vec3>();
|
||||
}
|
||||
}
|
||||
bool ScriptAvatarData::isJointDataValid(const QString& name) const {
|
||||
if (AvatarSharedPointer sharedAvatarData = _avatarData.lock()) {
|
||||
return sharedAvatarData->isJointDataValid(name);
|
||||
|
|
|
@ -106,6 +106,7 @@ public:
|
|||
Q_INVOKABLE glm::quat getJointRotation(const QString& name) const;
|
||||
Q_INVOKABLE glm::vec3 getJointTranslation(const QString& name) const;
|
||||
Q_INVOKABLE QVector<glm::quat> getJointRotations() const;
|
||||
Q_INVOKABLE QVector<glm::vec3> getJointTranslations() const;
|
||||
Q_INVOKABLE bool isJointDataValid(const QString& name) const;
|
||||
Q_INVOKABLE int getJointIndex(const QString& name) const;
|
||||
Q_INVOKABLE QStringList getJointNames() const;
|
||||
|
|
Loading…
Reference in a new issue