diff --git a/src/animalposer.cpp b/src/animalposer.cpp index 53fbfbb4..b6a5fb8c 100644 --- a/src/animalposer.cpp +++ b/src/animalposer.cpp @@ -38,15 +38,15 @@ void AnimalPoser::resolveTranslation() if (match.hasMatch()) { QString name = match.captured(1); chains[name].push_back(item.first); - qDebug() << "chains[" << name << "]:" << item.first; + //qDebug() << "chains[" << name << "]:" << item.first; } else { match = reSpine.match(item.first); if (match.hasMatch()) { QString name = match.captured(1); chains[name].push_back(item.first); - qDebug() << "chains[" << name << "]:" << item.first; + //qDebug() << "chains[" << name << "]:" << item.first; } else if (item.first.startsWith("Virtual_")) { - qDebug() << "Ignore connector:" << item.first; + //qDebug() << "Ignore connector:" << item.first; } else { qDebug() << "Unrecognized bone name:" << item.first; } @@ -56,10 +56,10 @@ void AnimalPoser::resolveTranslation() std::sort(chain.second.begin(), chain.second.end(), [](const QString &first, const QString &second) { return first < second; }); - qDebug() << "Chain:"; - for (const auto &chainJoint: chain.second) { - qDebug() << chainJoint; - } + //qDebug() << "Chain:"; + //for (const auto &chainJoint: chain.second) { + // qDebug() << chainJoint; + //} resolveChainRotation(chain.second); } } @@ -172,7 +172,7 @@ void AnimalPoser::resolveChainRotation(const std::vector &limbBoneNames QVector3D targetMiddleBoneStartPosition; { - qDebug() << beginBoneName << "Angle:" << angleBetweenDistanceAndMiddleBones; + //qDebug() << beginBoneName << "Angle:" << angleBetweenDistanceAndMiddleBones; auto rotation = QQuaternion::fromAxisAndAngle(matchRotatePlaneNormal, angleBetweenDistanceAndMiddleBones); targetMiddleBoneStartPosition = targetEndBoneStartPosition + rotation.rotatedVector(-matchDirectionBetweenBeginAndEndPones).normalized() * targetMiddleBoneLength; } diff --git a/src/animalrigger.cpp b/src/animalrigger.cpp index 993739a2..bf311878 100644 --- a/src/animalrigger.cpp +++ b/src/animalrigger.cpp @@ -407,6 +407,14 @@ bool AnimalRigger::rig() } QVector3D spineBoneHeadPosition = spineNode.position; + QVector3D averagePoint = averagePosition(spineBoneVertices); + if (isMainBodyVerticalAligned) { + //qDebug() << "Update spine position's z from:" << spineBoneHeadPosition.z() << "to:" << averagePoint.z(); + spineBoneHeadPosition.setZ(averagePoint.z()); + } else { + //qDebug() << "Update spine position's y from:" << spineBoneHeadPosition.y() << "to:" << averagePoint.y(); + spineBoneHeadPosition.setY(averagePoint.y()); + } QString spineName = namingSpine(spineGenerateOrder); @@ -420,7 +428,7 @@ bool AnimalRigger::rig() addVerticesToWeights(spineBoneVertices, spineBone.index); boneIndexMap[spineBone.name] = spineBone.index; - qDebug() << "Added spine:" << spineBone.name << "head:" << spineBone.headPosition << "tail:" << spineBone.tailPosition; + //qDebug() << "Added spine:" << spineBone.name << "head:" << spineBone.headPosition << "tail:" << spineBone.tailPosition; if (1 == spineGenerateOrder) { m_resultBones[boneIndexMap[Rigger::rootBoneName]].tailPosition = spineBone.headPosition; @@ -442,7 +450,7 @@ bool AnimalRigger::rig() ribBone.index = m_resultBones.size() - 1; ribBone.name = namingConnector(spineName, chainName); ribBone.headPosition = spineBoneHeadPosition; - qDebug() << "Added connector:" << ribBone.name; + //qDebug() << "Added connector:" << ribBone.name; boneIndexMap[ribBone.name] = ribBone.index; if (1 == spineGenerateOrder) { m_resultBones[boneIndexMap[Rigger::rootBoneName]].children.push_back(ribBone.index); @@ -455,7 +463,7 @@ bool AnimalRigger::rig() m_jointErrorItems.push_back(chainName); } - qDebug() << "Adding chain:" << chainName << " joints:" << jointMarkIndicies.size(); + //qDebug() << "Adding chain:" << chainName << " joints:" << jointMarkIndicies.size(); int jointGenerateOrder = 1; diff --git a/src/posedocument.cpp b/src/posedocument.cpp index ea963627..9e605ccb 100644 --- a/src/posedocument.cpp +++ b/src/posedocument.cpp @@ -178,13 +178,13 @@ void PoseDocument::updateRigBones(const std::vector *rigBones, const auto &bonesPart = partMap[m_bonesPartId]; bonesPart.id = m_bonesPartId; - qDebug() << "rigBones size:" << rigBones->size(); + //qDebug() << "rigBones size:" << rigBones->size(); std::vector> edgePairs; for (size_t i = m_hideRootAndVirtual ? 1 : 0; i < rigBones->size(); ++i) { const auto &bone = (*rigBones)[i]; for (const auto &child: bone.children) { - qDebug() << "Add pair:" << bone.name << "->" << (*rigBones)[child].name; + //qDebug() << "Add pair:" << bone.name << "->" << (*rigBones)[child].name; edgePairs.push_back({i, child}); } } @@ -272,7 +272,7 @@ void PoseDocument::updateRigBones(const std::vector *rigBones, const nodeMap[firstNodeId].edgeIds.push_back(edge.id); nodeMap[node.id].edgeIds.push_back(edge.id); - qDebug() << "Add pair:" << bone.name << "->" << "~"; + //qDebug() << "Add pair:" << bone.name << "->" << "~"; continue; } for (const auto &child: bone.children) {