Fix pose preview flicker

master
Jeremy Hu 2019-06-19 06:36:11 +09:30
parent e5f45eef83
commit 3e29528ee0
2 changed files with 8 additions and 3 deletions

View File

@ -170,7 +170,7 @@ void PoseDocument::updateOtherFramesParameters(const std::vector<std::map<QStrin
m_otherFramesParameters = otherFramesParameters; m_otherFramesParameters = otherFramesParameters;
} }
void PoseDocument::reset() void PoseDocument::resetWithoutNotifingParametersChanged()
{ {
nodeMap.clear(); nodeMap.clear();
edgeMap.clear(); edgeMap.clear();
@ -179,6 +179,11 @@ void PoseDocument::reset()
m_boneNameToIdsMap.clear(); m_boneNameToIdsMap.clear();
m_partIdMap.clear(); m_partIdMap.clear();
emit cleanup(); emit cleanup();
}
void PoseDocument::reset()
{
resetWithoutNotifingParametersChanged();
emit parametersChanged(); emit parametersChanged();
} }
@ -284,7 +289,7 @@ void PoseDocument::fromParameters(const std::vector<RiggerBone> *rigBones,
firstSpineBonePosition, firstSpineBonePosition,
neckJoint1BoneDirection); neckJoint1BoneDirection);
reset(); resetWithoutNotifingParametersChanged();
for (const auto &otherParameters: m_otherFramesParameters) { for (const auto &otherParameters: m_otherFramesParameters) {
std::vector<RiggerBone> otherBones = *rigBones; std::vector<RiggerBone> otherBones = *rigBones;
@ -328,7 +333,6 @@ void PoseDocument::parametersToNodes(const std::vector<RiggerBone> *rigBones,
auto &bonesPart = this->partMap[partId]; auto &bonesPart = this->partMap[partId];
bonesPart.id = partId; bonesPart.id = partId;
bonesPart.visible = this->m_hiddenSides.find(side) == this->m_hiddenSides.end(); bonesPart.visible = this->m_hiddenSides.find(side) == this->m_hiddenSides.end();
qDebug() << SkeletonSideToDispName(side) << "partId:" << partId << " visible:" << bonesPart.visible;
(*m_partIdMap)[side] = partId; (*m_partIdMap)[side] = partId;
}; };
addPartIdOfSide(SkeletonSide::Left); addPartIdOfSide(SkeletonSide::Left);

View File

@ -37,6 +37,7 @@ public:
void updateTurnaround(const QImage &image); void updateTurnaround(const QImage &image);
void updateOtherFramesParameters(const std::vector<std::map<QString, std::map<QString, QString>>> &otherFramesParameters); void updateOtherFramesParameters(const std::vector<std::map<QString, std::map<QString, QString>>> &otherFramesParameters);
void resetWithoutNotifingParametersChanged();
void reset(); void reset();
void toParameters(std::map<QString, std::map<QString, QString>> &parameters, const std::set<QUuid> &limitNodeIds=std::set<QUuid>()) const; void toParameters(std::map<QString, std::map<QString, QString>> &parameters, const std::set<QUuid> &limitNodeIds=std::set<QUuid>()) const;