mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:49:34 +02:00
Merge branch 'calvin' of github.com:samcake/hifi into faster-getters-on-avatar-for-scripts
This commit is contained in:
commit
e9bdbd7715
2 changed files with 22 additions and 13 deletions
|
@ -404,8 +404,10 @@ void Rig::setJointRotation(int index, bool valid, const glm::quat& rotation, flo
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Rig::getJointPositionInWorldFrame(int jointIndex, glm::vec3& position, glm::vec3 translation, glm::quat rotation) const {
|
bool Rig::getJointPositionInWorldFrame(int jointIndex, glm::vec3& position, glm::vec3 translation, glm::quat rotation) const {
|
||||||
if (isIndexValid(jointIndex)) {
|
// if (isIndexValid(jointIndex)) {
|
||||||
position = (rotation * _internalPoseSet._absolutePoses[jointIndex].trans()) + translation;
|
QReadLocker readLock(&_externalPoseSetLock);
|
||||||
|
if (jointIndex >= 0 && jointIndex < (int)_externalPoseSet._absolutePoses.size()) {
|
||||||
|
position = (rotation * _externalPoseSet._absolutePoses[jointIndex].trans()) + translation;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -413,17 +415,24 @@ bool Rig::getJointPositionInWorldFrame(int jointIndex, glm::vec3& position, glm:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Rig::getJointPosition(int jointIndex, glm::vec3& position) const {
|
bool Rig::getJointPosition(int jointIndex, glm::vec3& position) const {
|
||||||
|
/*
|
||||||
if (isIndexValid(jointIndex)) {
|
if (isIndexValid(jointIndex)) {
|
||||||
position = _internalPoseSet._absolutePoses[jointIndex].trans();
|
position = _internalPoseSet._absolutePoses[jointIndex].trans();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
return getAbsoluteJointTranslationInRigFrame(jointIndex, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Rig::getJointRotationInWorldFrame(int jointIndex, glm::quat& result, const glm::quat& rotation) const {
|
bool Rig::getJointRotationInWorldFrame(int jointIndex, glm::quat& result, const glm::quat& rotation) const {
|
||||||
if (isIndexValid(jointIndex)) {
|
// if (isIndexValid(jointIndex)) {
|
||||||
result = rotation * _internalPoseSet._absolutePoses[jointIndex].rot();
|
// result = rotation * _internalPoseSet._absolutePoses[jointIndex].rot();
|
||||||
|
// return true;
|
||||||
|
|
||||||
|
QReadLocker readLock(&_externalPoseSetLock);
|
||||||
|
if (jointIndex >= 0 && jointIndex < (int)_externalPoseSet._absolutePoses.size()) {
|
||||||
|
result = rotation * _externalPoseSet._absolutePoses[jointIndex].rot();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1009,12 +1009,12 @@ glm::vec3 Avatar::getAbsoluteJointTranslationInObjectFrame(int index) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int Avatar::getJointIndex(const QString& name) const {
|
int Avatar::getJointIndex(const QString& name) const {
|
||||||
if (QThread::currentThread() != thread()) {
|
/* if (QThread::currentThread() != thread()) {
|
||||||
int result;
|
int result;
|
||||||
BLOCKING_INVOKE_METHOD(const_cast<Avatar*>(this), "getJointIndex",
|
BLOCKING_INVOKE_METHOD(const_cast<Avatar*>(this), "getJointIndex",
|
||||||
Q_RETURN_ARG(int, result), Q_ARG(const QString&, name));
|
Q_RETURN_ARG(int, result), Q_ARG(const QString&, name));
|
||||||
return result;
|
return result;
|
||||||
}
|
} */
|
||||||
int result = getFauxJointIndex(name);
|
int result = getFauxJointIndex(name);
|
||||||
if (result != -1) {
|
if (result != -1) {
|
||||||
return result;
|
return result;
|
||||||
|
@ -1023,34 +1023,34 @@ int Avatar::getJointIndex(const QString& name) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Avatar::getJointNames() const {
|
QStringList Avatar::getJointNames() const {
|
||||||
if (QThread::currentThread() != thread()) {
|
/* if (QThread::currentThread() != thread()) {
|
||||||
QStringList result;
|
QStringList result;
|
||||||
BLOCKING_INVOKE_METHOD(const_cast<Avatar*>(this), "getJointNames",
|
BLOCKING_INVOKE_METHOD(const_cast<Avatar*>(this), "getJointNames",
|
||||||
Q_RETURN_ARG(QStringList, result));
|
Q_RETURN_ARG(QStringList, result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}*/
|
||||||
return _skeletonModel->isActive() ? _skeletonModel->getFBXGeometry().getJointNames() : QStringList();
|
return _skeletonModel->isActive() ? _skeletonModel->getFBXGeometry().getJointNames() : QStringList();
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 Avatar::getJointPosition(int index) const {
|
glm::vec3 Avatar::getJointPosition(int index) const {
|
||||||
if (QThread::currentThread() != thread()) {
|
/* if (QThread::currentThread() != thread()) {
|
||||||
glm::vec3 position;
|
glm::vec3 position;
|
||||||
BLOCKING_INVOKE_METHOD(const_cast<Avatar*>(this), "getJointPosition",
|
BLOCKING_INVOKE_METHOD(const_cast<Avatar*>(this), "getJointPosition",
|
||||||
Q_RETURN_ARG(glm::vec3, position), Q_ARG(const int, index));
|
Q_RETURN_ARG(glm::vec3, position), Q_ARG(const int, index));
|
||||||
return position;
|
return position;
|
||||||
}
|
}*/
|
||||||
glm::vec3 position;
|
glm::vec3 position;
|
||||||
_skeletonModel->getJointPositionInWorldFrame(index, position);
|
_skeletonModel->getJointPositionInWorldFrame(index, position);
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 Avatar::getJointPosition(const QString& name) const {
|
glm::vec3 Avatar::getJointPosition(const QString& name) const {
|
||||||
if (QThread::currentThread() != thread()) {
|
/* if (QThread::currentThread() != thread()) {
|
||||||
glm::vec3 position;
|
glm::vec3 position;
|
||||||
BLOCKING_INVOKE_METHOD(const_cast<Avatar*>(this), "getJointPosition",
|
BLOCKING_INVOKE_METHOD(const_cast<Avatar*>(this), "getJointPosition",
|
||||||
Q_RETURN_ARG(glm::vec3, position), Q_ARG(const QString&, name));
|
Q_RETURN_ARG(glm::vec3, position), Q_ARG(const QString&, name));
|
||||||
return position;
|
return position;
|
||||||
}
|
}*/
|
||||||
glm::vec3 position;
|
glm::vec3 position;
|
||||||
_skeletonModel->getJointPositionInWorldFrame(getJointIndex(name), position);
|
_skeletonModel->getJointPositionInWorldFrame(getJointIndex(name), position);
|
||||||
return position;
|
return position;
|
||||||
|
|
Loading…
Reference in a new issue