cleaned up whitespace and removed debug prints

This commit is contained in:
amantley 2018-11-26 11:08:59 -08:00
parent 746c5ed621
commit 26fc53ef78
5 changed files with 27 additions and 55 deletions

View file

@ -65,19 +65,14 @@ AnimSkeleton::AnimSkeleton(const std::vector<HFMJoint>& joints, const QMap<int,
int AnimSkeleton::nameToJointIndex(const QString& jointName) const { int AnimSkeleton::nameToJointIndex(const QString& jointName) const {
auto itr = _jointIndicesByName.find(jointName); auto itr = _jointIndicesByName.find(jointName);
if (_fbxToHifiJointNameMapping.contains(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]); itr = _jointIndicesByName.find(_fbxToHifiJointNameMapping[jointName]);
//qCDebug(animation) << "the alternate name for the joint " << jointName << " is " <<
//_fbxToHifiJointNameMapping[jointName] << " " << itr.value();
} }
if (itr != _jointIndicesByName.end()) {
if (_jointIndicesByName.end() != itr) {
//qCDebug(animation) << "returning " << itr.value() << " for " << jointName;
return itr.value(); return itr.value();
} }
//qCDebug(animation) << "returning -1 " << " for " << jointName;
return -1; return -1;
} }
@ -136,7 +131,7 @@ std::vector<int> AnimSkeleton::getChildrenOfJoint(int jointIndex) const {
} }
const QString AnimSkeleton::getJointName(int jointIndex) const { const QString AnimSkeleton::getJointName(int jointIndex) const {
QString jointName = _joints[jointIndex].name; QString jointName = _joints[jointIndex].name;
QMapIterator<QString, QString> i(_fbxToHifiJointNameMapping); QMapIterator<QString, QString> i(_fbxToHifiJointNameMapping);
while (i.hasNext()) { while (i.hasNext()) {
@ -146,8 +141,7 @@ const QString AnimSkeleton::getJointName(int jointIndex) const {
break; break;
} }
} }
//qCDebug(animation) << "reverse lookup: returning " << jointName << " for " << jointIndex; return jointName;
return jointName; //;_joints[jointIndex].name;
} }
AnimPose AnimSkeleton::getAbsolutePose(int jointIndex, const AnimPoseVec& relativePoses) const { 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 AnimSkeleton::checkNonMirrored(QString jointName) const {
//bool isNonMirrored = false;
QMapIterator<QString, QString> i(_fbxToHifiJointNameMapping); QMapIterator<QString, QString> i(_fbxToHifiJointNameMapping);
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();
@ -264,14 +257,15 @@ int AnimSkeleton::containsLeft(QString jointName) const {
if (i.key().startsWith("Left")) { if (i.key().startsWith("Left")) {
QString mirrorJointName = QString(i.key()).replace(0, 4, "Right"); QString mirrorJointName = QString(i.key()).replace(0, 4, "Right");
mirrorJointIndex = nameToJointIndex(mirrorJointName); mirrorJointIndex = nameToJointIndex(mirrorJointName);
//return true
} }
} }
} }
if (jointName.startsWith("Left")) { if (mirrorJointIndex < 0) {
QString mirrorJointName = QString(jointName).replace(0, 4, "Right"); if (jointName.startsWith("Left")) {
mirrorJointIndex = nameToJointIndex(mirrorJointName); QString mirrorJointName = QString(jointName).replace(0, 4, "Right");
} mirrorJointIndex = nameToJointIndex(mirrorJointName);
}
}
return mirrorJointIndex; return mirrorJointIndex;
} }
@ -285,12 +279,14 @@ int AnimSkeleton::containsRight(QString jointName) const {
if (i.key().startsWith("Right")) { if (i.key().startsWith("Right")) {
QString mirrorJointName = QString(i.key()).replace(0, 5, "Left"); QString mirrorJointName = QString(i.key()).replace(0, 5, "Left");
mirrorJointIndex = nameToJointIndex(mirrorJointName); mirrorJointIndex = nameToJointIndex(mirrorJointName);
} }
} }
} }
if (jointName.startsWith("Right")) { if (mirrorJointIndex < 0) {
QString mirrorJointName = QString(jointName).replace(0, 5, "Left"); if (jointName.startsWith("Right")) {
mirrorJointIndex = nameToJointIndex(mirrorJointName); QString mirrorJointName = QString(jointName).replace(0, 5, "Left");
mirrorJointIndex = nameToJointIndex(mirrorJointName);
}
} }
return mirrorJointIndex; return mirrorJointIndex;
} }
@ -353,7 +349,7 @@ void AnimSkeleton::buildSkeletonFromJoints(const std::vector<HFMJoint>& joints,
} }
int mirrorJointIndex = -1; int mirrorJointIndex = -1;
mirrorJointIndex = containsLeft(_joints[i].name); mirrorJointIndex = containsLeft(_joints[i].name);
if (!(mirrorJointIndex > -1)) { if (mirrorJointIndex < 0) {
mirrorJointIndex = containsRight(_joints[i].name); mirrorJointIndex = containsRight(_joints[i].name);
} }
if (mirrorJointIndex >= 0) { if (mirrorJointIndex >= 0) {

View file

@ -423,7 +423,6 @@ int Rig::indexOfJoint(const QString& jointName) const {
int result = _animSkeleton->nameToJointIndex(jointName); int result = _animSkeleton->nameToJointIndex(jointName);
if (_animSkeleton->getFBXToHifiJointNameMapping().contains(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); result = _animSkeleton->nameToJointIndex(jointName);
} }

View file

@ -1437,21 +1437,11 @@ int Avatar::getJointIndex(const QString& name) const {
withValidJointIndicesCache([&]() { withValidJointIndicesCache([&]() {
if (_modelJointIndicesCache.contains(name)) { if (_modelJointIndicesCache.contains(name)) {
result = _modelJointIndicesCache[name] - 1; 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 { } else {
// doesn't contain name. // doesn't contain name. check the fbx-to-hifi joint name mapping
//qCDebug(avatars_renderer) << "name is not here";
if (_skeletonModel && _skeletonModel->isActive()) { if (_skeletonModel && _skeletonModel->isActive()) {
if (_modelJointIndicesCache.contains(_skeletonModel->getHFMModel().fbxToHifiJointNameMapping[name])) { if (_modelJointIndicesCache.contains(_skeletonModel->getHFMModel().fbxToHifiJointNameMapping[name])) {
result = _modelJointIndicesCache[_skeletonModel->getHFMModel().fbxToHifiJointNameMapping[name]] - 1; result = _modelJointIndicesCache[_skeletonModel->getHFMModel().fbxToHifiJointNameMapping[name]] - 1;
// qCDebug(avatars_renderer) << "joint " << name << " remapped to " << _skeletonModel->getHFMModel().fbxToHifiJointNameMapping[name] << result;
} }
} }
} }

View file

@ -317,7 +317,6 @@ bool SkeletonModel::getEyePositions(glm::vec3& firstEyePosition, glm::vec3& seco
} }
glm::vec3 SkeletonModel::getDefaultEyeModelPosition() const { glm::vec3 SkeletonModel::getDefaultEyeModelPosition() const {
//qCDebug(avatars_renderer) << "default eye model position " << _defaultEyeModelPosition;
return _owningAvatar->getModelScale() * _defaultEyeModelPosition; return _owningAvatar->getModelScale() * _defaultEyeModelPosition;
} }

View file

@ -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) { 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(); auto jointNames = mapping[JOINT_NAME_MAPPING_FIELD].toHash();
for (auto itr = jointNames.begin(); itr != jointNames.end(); itr++) { 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()); fbxToHifiJointNameMap.insert(itr.key(), itr.value().toString());
qCDebug(modelformat) << "the mapped key " << itr.key() << " has a value of " << fbxToHifiJointNameMap[itr.key()]; qCDebug(modelformat) << "the mapped key " << itr.key() << " has a value of " << fbxToHifiJointNameMap[itr.key()];
} }
} }
return fbxToHifiJointNameMap; return fbxToHifiJointNameMap;
} }
@ -480,14 +478,14 @@ HFMModel* FBXReader::extractHFMModel(const QVariantHash& mapping, const QString&
std::map<QString, HFMLight> lights; std::map<QString, HFMLight> lights;
QVariantHash joints = mapping.value("joint").toHash(); QVariantHash joints = mapping.value("joint").toHash();
QString jointEyeLeftName = "EyeLeft"; //processID(getString(joints.value("jointEyeLeft", "jointEyeLeft"))); QString jointEyeLeftName = "EyeLeft";
QString jointEyeRightName = "EyeRight"; // processID(getString(joints.value("jointEyeRight", "jointEyeRight"))); QString jointEyeRightName = "EyeRight";
QString jointNeckName = "Neck"; //processID(getString(joints.value("jointNeck", "jointNeck"))); QString jointNeckName = "Neck";
QString jointRootName = "Hips"; //processID(getString(joints.value("jointRoot", "jointRoot"))); QString jointRootName = "Hips";
QString jointLeanName = processID(getString(joints.value("jointLean", "jointLean"))); QString jointLeanName = processID(getString(joints.value("jointLean", "jointLean")));
QString jointHeadName = "Head";// processID(getString(joints.value("jointHead", "jointHead"))); QString jointHeadName = "Head";
QString jointLeftHandName = "LeftHand"; //processID(getString(joints.value("jointLeftHand", "jointLeftHand"))); QString jointLeftHandName = "LeftHand";
QString jointRightHandName = "RightHand"; // processID(getString(joints.value("jointRightHand", "jointRightHand"))); QString jointRightHandName = "RightHand";
QString jointEyeLeftID; QString jointEyeLeftID;
QString jointEyeRightID; QString jointEyeRightID;
QString jointNeckID; QString jointNeckID;
@ -1845,21 +1843,11 @@ HFMModel* FBXReader::extractHFMModel(const QVariantHash& mapping, const QString&
jointIndex = hfmModel.getJointIndex(hfmModel.fbxToHifiJointNameMapping[jointName]); jointIndex = hfmModel.getJointIndex(hfmModel.fbxToHifiJointNameMapping[jointName]);
} }
if (jointIndex != -1) { if (jointIndex != -1) {
//if (jointIndex == 18) { hfmModel.jointRotationOffsets.insert(jointIndex, rotationOffset);
// 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);
//}
} }
qCDebug(modelformat) << "Joint Rotation Offset added to Rig._jointRotationOffsets : " << " jointName: " << jointName << " jointIndex: " << jointIndex << " rotation offset: " << rotationOffset; qCDebug(modelformat) << "Joint Rotation Offset added to Rig._jointRotationOffsets : " << " jointName: " << jointName << " jointIndex: " << jointIndex << " rotation offset: " << rotationOffset;
} }
return hfmModelPtr; return hfmModelPtr;
} }