mirror of
https://github.com/overte-org/overte.git
synced 2025-04-12 00:20:45 +02:00
cleaned up whitespace and removed debug prints
This commit is contained in:
parent
746c5ed621
commit
26fc53ef78
5 changed files with 27 additions and 55 deletions
|
@ -65,19 +65,14 @@ AnimSkeleton::AnimSkeleton(const std::vector<HFMJoint>& joints, const QMap<int,
|
|||
int AnimSkeleton::nameToJointIndex(const QString& jointName) const {
|
||||
|
||||
auto itr = _jointIndicesByName.find(jointName);
|
||||
|
||||
if (_fbxToHifiJointNameMapping.contains(jointName)) {
|
||||
//qCDebug(animation) << "failing joint name is " << jointName;
|
||||
// if the fbx joint name is different than the hifi standard then look up the
|
||||
// index from that name.
|
||||
itr = _jointIndicesByName.find(_fbxToHifiJointNameMapping[jointName]);
|
||||
//qCDebug(animation) << "the alternate name for the joint " << jointName << " is " <<
|
||||
//_fbxToHifiJointNameMapping[jointName] << " " << itr.value();
|
||||
}
|
||||
|
||||
if (_jointIndicesByName.end() != itr) {
|
||||
//qCDebug(animation) << "returning " << itr.value() << " for " << jointName;
|
||||
if (itr != _jointIndicesByName.end()) {
|
||||
return itr.value();
|
||||
}
|
||||
//qCDebug(animation) << "returning -1 " << " for " << jointName;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -136,7 +131,7 @@ std::vector<int> AnimSkeleton::getChildrenOfJoint(int jointIndex) const {
|
|||
}
|
||||
|
||||
const QString AnimSkeleton::getJointName(int jointIndex) const {
|
||||
|
||||
|
||||
QString jointName = _joints[jointIndex].name;
|
||||
QMapIterator<QString, QString> i(_fbxToHifiJointNameMapping);
|
||||
while (i.hasNext()) {
|
||||
|
@ -146,8 +141,7 @@ const QString AnimSkeleton::getJointName(int jointIndex) const {
|
|||
break;
|
||||
}
|
||||
}
|
||||
//qCDebug(animation) << "reverse lookup: returning " << jointName << " for " << jointIndex;
|
||||
return jointName; //;_joints[jointIndex].name;
|
||||
return jointName;
|
||||
}
|
||||
|
||||
AnimPose AnimSkeleton::getAbsolutePose(int jointIndex, const AnimPoseVec& relativePoses) const {
|
||||
|
@ -222,7 +216,6 @@ void AnimSkeleton::mirrorAbsolutePoses(AnimPoseVec& poses) const {
|
|||
|
||||
bool AnimSkeleton::checkNonMirrored(QString jointName) const {
|
||||
|
||||
//bool isNonMirrored = false;
|
||||
QMapIterator<QString, QString> i(_fbxToHifiJointNameMapping);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
|
@ -264,14 +257,15 @@ int AnimSkeleton::containsLeft(QString jointName) const {
|
|||
if (i.key().startsWith("Left")) {
|
||||
QString mirrorJointName = QString(i.key()).replace(0, 4, "Right");
|
||||
mirrorJointIndex = nameToJointIndex(mirrorJointName);
|
||||
//return true
|
||||
}
|
||||
}
|
||||
}
|
||||
if (jointName.startsWith("Left")) {
|
||||
QString mirrorJointName = QString(jointName).replace(0, 4, "Right");
|
||||
mirrorJointIndex = nameToJointIndex(mirrorJointName);
|
||||
}
|
||||
if (mirrorJointIndex < 0) {
|
||||
if (jointName.startsWith("Left")) {
|
||||
QString mirrorJointName = QString(jointName).replace(0, 4, "Right");
|
||||
mirrorJointIndex = nameToJointIndex(mirrorJointName);
|
||||
}
|
||||
}
|
||||
return mirrorJointIndex;
|
||||
}
|
||||
|
||||
|
@ -285,12 +279,14 @@ int AnimSkeleton::containsRight(QString jointName) const {
|
|||
if (i.key().startsWith("Right")) {
|
||||
QString mirrorJointName = QString(i.key()).replace(0, 5, "Left");
|
||||
mirrorJointIndex = nameToJointIndex(mirrorJointName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (jointName.startsWith("Right")) {
|
||||
QString mirrorJointName = QString(jointName).replace(0, 5, "Left");
|
||||
mirrorJointIndex = nameToJointIndex(mirrorJointName);
|
||||
if (mirrorJointIndex < 0) {
|
||||
if (jointName.startsWith("Right")) {
|
||||
QString mirrorJointName = QString(jointName).replace(0, 5, "Left");
|
||||
mirrorJointIndex = nameToJointIndex(mirrorJointName);
|
||||
}
|
||||
}
|
||||
return mirrorJointIndex;
|
||||
}
|
||||
|
@ -353,7 +349,7 @@ void AnimSkeleton::buildSkeletonFromJoints(const std::vector<HFMJoint>& joints,
|
|||
}
|
||||
int mirrorJointIndex = -1;
|
||||
mirrorJointIndex = containsLeft(_joints[i].name);
|
||||
if (!(mirrorJointIndex > -1)) {
|
||||
if (mirrorJointIndex < 0) {
|
||||
mirrorJointIndex = containsRight(_joints[i].name);
|
||||
}
|
||||
if (mirrorJointIndex >= 0) {
|
||||
|
|
|
@ -423,7 +423,6 @@ int Rig::indexOfJoint(const QString& jointName) const {
|
|||
|
||||
int result = _animSkeleton->nameToJointIndex(jointName);
|
||||
if (_animSkeleton->getFBXToHifiJointNameMapping().contains(jointName)) {
|
||||
//qCDebug(animation) << "the alternate name for the joint " << jointName << " is " << _animSkeleton->getFBXToHifiJointNameMapping()[jointName] << " " << _animSkeleton->nameToJointIndex(_animSkeleton->getFBXToHifiJointNameMapping()[jointName]);
|
||||
result = _animSkeleton->nameToJointIndex(jointName);
|
||||
}
|
||||
|
||||
|
|
|
@ -1437,21 +1437,11 @@ int Avatar::getJointIndex(const QString& name) const {
|
|||
withValidJointIndicesCache([&]() {
|
||||
if (_modelJointIndicesCache.contains(name)) {
|
||||
result = _modelJointIndicesCache[name] - 1;
|
||||
if (_skeletonModel && _skeletonModel->isActive()) {
|
||||
// qCDebug(avatars_renderer) << "the other head id is this" << _skeletonModel->getHFMModel().fbxToHifiJointNameMapping["Head"];
|
||||
// qCDebug(avatars_renderer) << "joint indices cache " << name << " " << _modelJointIndicesCache[name];
|
||||
if (_modelJointIndicesCache.contains(_skeletonModel->getHFMModel().fbxToHifiJointNameMapping["Head"])) {
|
||||
// qCDebug(avatars_renderer) << "joint alternate name " << _skeletonModel->getHFMModel().fbxToHifiJointNameMapping["Head"] << " " << _modelJointIndicesCache[_skeletonModel->getHFMModel().fbxToHifiJointNameMapping["Head"]];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// doesn't contain name.
|
||||
//qCDebug(avatars_renderer) << "name is not here";
|
||||
// doesn't contain name. check the fbx-to-hifi joint name mapping
|
||||
if (_skeletonModel && _skeletonModel->isActive()) {
|
||||
|
||||
if (_modelJointIndicesCache.contains(_skeletonModel->getHFMModel().fbxToHifiJointNameMapping[name])) {
|
||||
result = _modelJointIndicesCache[_skeletonModel->getHFMModel().fbxToHifiJointNameMapping[name]] - 1;
|
||||
// qCDebug(avatars_renderer) << "joint " << name << " remapped to " << _skeletonModel->getHFMModel().fbxToHifiJointNameMapping[name] << result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -317,7 +317,6 @@ bool SkeletonModel::getEyePositions(glm::vec3& firstEyePosition, glm::vec3& seco
|
|||
}
|
||||
|
||||
glm::vec3 SkeletonModel::getDefaultEyeModelPosition() const {
|
||||
//qCDebug(avatars_renderer) << "default eye model position " << _defaultEyeModelPosition;
|
||||
return _owningAvatar->getModelScale() * _defaultEyeModelPosition;
|
||||
}
|
||||
|
||||
|
|
|
@ -423,11 +423,9 @@ QMap<QString, QString> getJointNameMapping(const QVariantHash& mapping) {
|
|||
if (!mapping.isEmpty() && mapping.contains(JOINT_NAME_MAPPING_FIELD) && mapping[JOINT_NAME_MAPPING_FIELD].type() == QVariant::Hash) {
|
||||
auto jointNames = mapping[JOINT_NAME_MAPPING_FIELD].toHash();
|
||||
for (auto itr = jointNames.begin(); itr != jointNames.end(); itr++) {
|
||||
qCDebug(modelformat) << "found a joint mapping field key " << itr.key() << " value " << itr.value().toString();
|
||||
fbxToHifiJointNameMap.insert(itr.key(), itr.value().toString());
|
||||
qCDebug(modelformat) << "the mapped key " << itr.key() << " has a value of " << fbxToHifiJointNameMap[itr.key()];
|
||||
}
|
||||
|
||||
}
|
||||
return fbxToHifiJointNameMap;
|
||||
}
|
||||
|
@ -480,14 +478,14 @@ HFMModel* FBXReader::extractHFMModel(const QVariantHash& mapping, const QString&
|
|||
std::map<QString, HFMLight> lights;
|
||||
|
||||
QVariantHash joints = mapping.value("joint").toHash();
|
||||
QString jointEyeLeftName = "EyeLeft"; //processID(getString(joints.value("jointEyeLeft", "jointEyeLeft")));
|
||||
QString jointEyeRightName = "EyeRight"; // processID(getString(joints.value("jointEyeRight", "jointEyeRight")));
|
||||
QString jointNeckName = "Neck"; //processID(getString(joints.value("jointNeck", "jointNeck")));
|
||||
QString jointRootName = "Hips"; //processID(getString(joints.value("jointRoot", "jointRoot")));
|
||||
QString jointEyeLeftName = "EyeLeft";
|
||||
QString jointEyeRightName = "EyeRight";
|
||||
QString jointNeckName = "Neck";
|
||||
QString jointRootName = "Hips";
|
||||
QString jointLeanName = processID(getString(joints.value("jointLean", "jointLean")));
|
||||
QString jointHeadName = "Head";// processID(getString(joints.value("jointHead", "jointHead")));
|
||||
QString jointLeftHandName = "LeftHand"; //processID(getString(joints.value("jointLeftHand", "jointLeftHand")));
|
||||
QString jointRightHandName = "RightHand"; // processID(getString(joints.value("jointRightHand", "jointRightHand")));
|
||||
QString jointHeadName = "Head";
|
||||
QString jointLeftHandName = "LeftHand";
|
||||
QString jointRightHandName = "RightHand";
|
||||
QString jointEyeLeftID;
|
||||
QString jointEyeRightID;
|
||||
QString jointNeckID;
|
||||
|
@ -1845,21 +1843,11 @@ HFMModel* FBXReader::extractHFMModel(const QVariantHash& mapping, const QString&
|
|||
jointIndex = hfmModel.getJointIndex(hfmModel.fbxToHifiJointNameMapping[jointName]);
|
||||
}
|
||||
if (jointIndex != -1) {
|
||||
//if (jointIndex == 18) {
|
||||
// glm::quat spine3LocalOffset(0.94232035f, 0.000000014995882f, 0.33471236f, 0.000000058068572f);
|
||||
// glm::quat spine3AbsoluteOffset = spine3LocalOffset * hfmModel.jointRotationOffsets[16];
|
||||
// hfmModel.jointRotationOffsets.insert(jointIndex, spine3AbsoluteOffset);
|
||||
// qCDebug(modelformat) << "Joint Rotation Offset added for spine3 : " << spine3AbsoluteOffset;
|
||||
//} else {
|
||||
hfmModel.jointRotationOffsets.insert(jointIndex, rotationOffset);
|
||||
//}
|
||||
|
||||
hfmModel.jointRotationOffsets.insert(jointIndex, rotationOffset);
|
||||
}
|
||||
qCDebug(modelformat) << "Joint Rotation Offset added to Rig._jointRotationOffsets : " << " jointName: " << jointName << " jointIndex: " << jointIndex << " rotation offset: " << rotationOffset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return hfmModelPtr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue