Merge pull request #6455 from samcake/controllers

Recording playback the skeleton animation correctly for agents
This commit is contained in:
Brad Davis 2015-11-20 15:35:53 -08:00
commit f45eff3df9
2 changed files with 16 additions and 9 deletions

View file

@ -801,6 +801,14 @@ void AvatarData::changeReferential(Referential* ref) {
_referential = ref; _referential = ref;
} }
void AvatarData::setRawJointData(QVector<JointData> data) {
if (QThread::currentThread() != thread()) {
QMetaObject::invokeMethod(this, "setRawJointData", Q_ARG(QVector<JointData>, data));
return;
}
_jointData = data;
}
void AvatarData::setJointData(int index, const glm::quat& rotation, const glm::vec3& translation) { void AvatarData::setJointData(int index, const glm::quat& rotation, const glm::vec3& translation) {
if (index == -1) { if (index == -1) {
return; return;
@ -1538,16 +1546,15 @@ void AvatarData::fromFrame(const QByteArray& frameData, AvatarData& result) {
QVector<JointData> jointArray; QVector<JointData> jointArray;
QJsonArray jointArrayJson = root[JSON_AVATAR_JOINT_ARRAY].toArray(); QJsonArray jointArrayJson = root[JSON_AVATAR_JOINT_ARRAY].toArray();
jointArray.reserve(jointArrayJson.size()); jointArray.reserve(jointArrayJson.size());
int i = 0;
for (const auto& jointJson : jointArrayJson) { for (const auto& jointJson : jointArrayJson) {
jointArray.push_back(jointDataFromJsonValue(jointJson)); auto joint = jointDataFromJsonValue(jointJson);
jointArray.push_back(joint);
result.setJointData(i, joint.rotation, joint.translation);
result._jointData[i].rotationSet = true; // Have to do that to broadcast the avatar new pose
i++;
} }
result.setRawJointData(jointArray);
QVector<glm::quat> jointRotations;
jointRotations.reserve(jointArray.size());
for (const auto& joint : jointArray) {
jointRotations.push_back(joint.rotation);
}
result.setJointRotations(jointRotations);
} }
#if 0 #if 0

View file

@ -247,7 +247,7 @@ public:
Q_INVOKABLE char getHandState() const { return _handState; } Q_INVOKABLE char getHandState() const { return _handState; }
const QVector<JointData>& getRawJointData() const { return _jointData; } const QVector<JointData>& getRawJointData() const { return _jointData; }
void setRawJointData(QVector<JointData> data) { _jointData = data; } Q_INVOKABLE void setRawJointData(QVector<JointData> data);
Q_INVOKABLE virtual void setJointData(int index, const glm::quat& rotation, const glm::vec3& translation); Q_INVOKABLE virtual void setJointData(int index, const glm::quat& rotation, const glm::vec3& translation);
Q_INVOKABLE virtual void setJointRotation(int index, const glm::quat& rotation); Q_INVOKABLE virtual void setJointRotation(int index, const glm::quat& rotation);