Fix motion generator

master
Jeremy Hu 2019-06-10 23:31:06 +09:30
parent e145793af0
commit 307965e3e8
2 changed files with 12 additions and 2 deletions

View File

@ -4,6 +4,7 @@
#include "motionsgenerator.h"
#include "posemeshcreator.h"
#include "poserconstruct.h"
#include "posedocument.h"
MotionsGenerator::MotionsGenerator(RigType rigType,
const std::vector<RiggerBone> *rigBones,
@ -234,7 +235,11 @@ const JointNodeTree &MotionsGenerator::poseJointNodeTree(const QUuid &poseId, in
m_poser->reset();
if (frame < (int)frames.size()) {
const auto &parameters = frames[frame].second;
m_poser->parameters() = parameters;
PoseDocument postDocument;
postDocument.fromParameters(&m_rigBones, parameters);
std::map<QString, std::map<QString, QString>> translatedParameters;
postDocument.toParameters(translatedParameters);
m_poser->parameters() = translatedParameters;
}
m_poser->commit();
auto insertResult = m_poseJointNodeTreeMap.insert({{poseId, frame}, m_poser->resultJointNodeTree()});

View File

@ -3,6 +3,7 @@
#include "posepreviewsgenerator.h"
#include "posemeshcreator.h"
#include "poserconstruct.h"
#include "posedocument.h"
PosePreviewsGenerator::PosePreviewsGenerator(RigType rigType,
const std::vector<RiggerBone> *rigBones,
@ -47,7 +48,11 @@ void PosePreviewsGenerator::process()
Poser *poser = newPoser(m_rigType, m_rigBones);
for (const auto &pose: m_poses) {
poser->parameters() = pose.second;
PoseDocument poseDocument;
poseDocument.fromParameters(&m_rigBones, pose.second);
std::map<QString, std::map<QString, QString>> translatedParameters;
poseDocument.toParameters(translatedParameters);
poser->parameters() = translatedParameters;
poser->commit();
PoseMeshCreator *poseMeshCreator = new PoseMeshCreator(poser->resultNodes(), *m_outcome, m_rigWeights);