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

View File

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