mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-14 11:46:34 +02:00
add a way to query Rig to see if a joint has been overridden by a script
This commit is contained in:
parent
b64ff70d6c
commit
7fa24efca0
2 changed files with 18 additions and 2 deletions
|
@ -715,7 +715,7 @@ void Rig::reset(const HFMModel& hfmModel) {
|
|||
}
|
||||
}
|
||||
|
||||
bool Rig::jointStatesEmpty() {
|
||||
bool Rig::jointStatesEmpty() const {
|
||||
return _internalPoseSet._relativePoses.empty();
|
||||
}
|
||||
|
||||
|
@ -878,6 +878,20 @@ void Rig::setJointRotation(int index, bool valid, const glm::quat& rotation, flo
|
|||
}
|
||||
}
|
||||
|
||||
bool Rig::getIsJointOverridden(int jointIndex) const {
|
||||
if (QThread::currentThread() == thread()) {
|
||||
if (isIndexValid(jointIndex)) {
|
||||
return _internalPoseSet._overrideFlags[jointIndex];
|
||||
}
|
||||
} else {
|
||||
QReadLocker readLock(&_externalPoseSetLock);
|
||||
if (jointIndex >= 0 && jointIndex < (int)_externalPoseSet._overrideFlags.size()) {
|
||||
return _externalPoseSet._overrideFlags[jointIndex];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Rig::getJointPositionInWorldFrame(int jointIndex, glm::vec3& position, glm::vec3 translation, glm::quat rotation) const {
|
||||
bool success { false };
|
||||
glm::vec3 originalPosition = position;
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
|
||||
void initJointStates(const HFMModel& hfmModel, const glm::mat4& modelOffset);
|
||||
void reset(const HFMModel& hfmModel);
|
||||
bool jointStatesEmpty();
|
||||
bool jointStatesEmpty() const;
|
||||
int getJointStateCount() const;
|
||||
int indexOfJoint(const QString& jointName) const;
|
||||
QString nameOfJoint(int jointIndex) const;
|
||||
|
@ -163,6 +163,8 @@ public:
|
|||
void setJointTranslation(int index, bool valid, const glm::vec3& translation, float priority);
|
||||
void setJointRotation(int index, bool valid, const glm::quat& rotation, float priority);
|
||||
|
||||
bool getIsJointOverridden(int jointIndex) const;
|
||||
|
||||
// if translation and rotation is identity, position will be in rig space
|
||||
bool getJointPositionInWorldFrame(int jointIndex, glm::vec3& position,
|
||||
glm::vec3 translation, glm::quat rotation) const;
|
||||
|
|
Loading…
Reference in a new issue