Fix set avatar rotations from scripts (different tread)

This commit is contained in:
Thijs Wenker 2015-10-11 14:51:12 +02:00
parent 1906905cb4
commit 7d3b300037

View file

@ -1154,32 +1154,41 @@ void MyAvatar::setJointTranslations(QVector<glm::vec3> jointTranslations) {
}
void MyAvatar::setJointData(int index, const glm::quat& rotation, const glm::vec3& translation) {
if (QThread::currentThread() == thread()) {
// HACK: ATM only JS scripts call setJointData() on MyAvatar so we hardcode the priority
_rig->setJointState(index, true, rotation, translation, SCRIPT_PRIORITY);
if (QThread::currentThread() != thread()) {
QMetaObject::invokeMethod(this, "setJointData", Q_ARG(int, index), Q_ARG(const glm::quat&, rotation),
Q_ARG(const glm::vec3&, translation));
return;
}
// HACK: ATM only JS scripts call setJointData() on MyAvatar so we hardcode the priority
_rig->setJointState(index, true, rotation, translation, SCRIPT_PRIORITY);
}
void MyAvatar::setJointRotation(int index, const glm::quat& rotation) {
if (QThread::currentThread() == thread()) {
// HACK: ATM only JS scripts call setJointData() on MyAvatar so we hardcode the priority
_rig->setJointRotation(index, true, rotation, SCRIPT_PRIORITY);
if (QThread::currentThread() != thread()) {
QMetaObject::invokeMethod(this, "setJointRotation", Q_ARG(int, index), Q_ARG(const glm::quat&, rotation));
return;
}
// HACK: ATM only JS scripts call setJointData() on MyAvatar so we hardcode the priority
_rig->setJointRotation(index, true, rotation, SCRIPT_PRIORITY);
}
void MyAvatar::setJointTranslation(int index, const glm::vec3& translation) {
if (QThread::currentThread() == thread()) {
// HACK: ATM only JS scripts call setJointData() on MyAvatar so we hardcode the priority
_rig->setJointTranslation(index, true, translation, SCRIPT_PRIORITY);
if (QThread::currentThread() != thread()) {
QMetaObject::invokeMethod(this, "setJointTranslation", Q_ARG(int, index), Q_ARG(const glm::vec3&, translation));
return;
}
// HACK: ATM only JS scripts call setJointData() on MyAvatar so we hardcode the priority
_rig->setJointTranslation(index, true, translation, SCRIPT_PRIORITY);
}
void MyAvatar::clearJointData(int index) {
if (QThread::currentThread() == thread()) {
// HACK: ATM only JS scripts call clearJointData() on MyAvatar so we hardcode the priority
_rig->setJointState(index, false, glm::quat(), glm::vec3(), 0.0f);
_rig->clearJointAnimationPriority(index);
if (QThread::currentThread() != thread()) {
QMetaObject::invokeMethod(this, "clearJointData", Q_ARG(int, index));
return;
}
// HACK: ATM only JS scripts call clearJointData() on MyAvatar so we hardcode the priority
_rig->setJointState(index, false, glm::quat(), glm::vec3(), 0.0f);
_rig->clearJointAnimationPriority(index);
}
void MyAvatar::clearJointsData() {