mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-08 06:32:35 +02:00
Merge pull request #15316 from amantley/bugSetRotation
Bug fixed for MyAvatar.getJointRotation(name, quat) and MyAvatar.setJointRotation(name, quat)
This commit is contained in:
commit
5e8e44f97b
2 changed files with 5 additions and 9 deletions
|
@ -1721,7 +1721,6 @@ glm::vec3 AvatarData::getJointTranslation(const QString& name) const {
|
|||
// on another thread in between the call to getJointIndex and getJointTranslation
|
||||
// return getJointTranslation(getJointIndex(name));
|
||||
return readLockWithNamedJointIndex<glm::vec3>(name, [this](int index) {
|
||||
return _jointData.at(index).translation;
|
||||
return getJointTranslation(index);
|
||||
});
|
||||
}
|
||||
|
@ -1809,8 +1808,8 @@ glm::quat AvatarData::getJointRotation(const QString& name) const {
|
|||
// Can't do this, not thread safe
|
||||
// return getJointRotation(getJointIndex(name));
|
||||
|
||||
return readLockWithNamedJointIndex<glm::quat>(name, [&](int index) {
|
||||
return _jointData.at(index).rotation;
|
||||
return readLockWithNamedJointIndex<glm::quat>(name, [this](int index) {
|
||||
return getJointRotation(index);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1751,14 +1751,11 @@ protected:
|
|||
|
||||
template <typename T, typename F>
|
||||
T readLockWithNamedJointIndex(const QString& name, const T& defaultValue, F f) const {
|
||||
int index = getFauxJointIndex(name);
|
||||
QReadLocker readLock(&_jointDataLock);
|
||||
|
||||
// The first conditional is superfluous, but illustrative
|
||||
if (index == -1 || index < _jointData.size()) {
|
||||
int index = getJointIndex(name);
|
||||
if (index == -1) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
return f(index);
|
||||
}
|
||||
|
||||
|
@ -1769,8 +1766,8 @@ protected:
|
|||
|
||||
template <typename F>
|
||||
void writeLockWithNamedJointIndex(const QString& name, F f) {
|
||||
int index = getFauxJointIndex(name);
|
||||
QWriteLocker writeLock(&_jointDataLock);
|
||||
int index = getJointIndex(name);
|
||||
if (index == -1) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue