#ifndef DUST3D_MOTIONS_GENERATOR_H #define DUST3D_MOTIONS_GENERATOR_H #include #include #include #include #include "model.h" #include "rigger.h" #include "jointnodetree.h" #include "document.h" #include "poser.h" #define ENABLE_PROCEDURAL_DEBUG 1 class MotionsGenerator : public QObject { Q_OBJECT public: MotionsGenerator(RigType rigType, const std::vector *rigBones, const std::map *rigWeights, const Outcome &outcome); ~MotionsGenerator(); void addPoseToLibrary(const QUuid &poseId, const std::vector, std::map>>> &frames, float yTranslationScale); void addMotionToLibrary(const QUuid &motionId, const std::vector &clips); void addRequirement(const QUuid &motionId); std::vector> takeResultPreviewMeshs(const QUuid &motionId); std::vector> takeResultJointNodeTrees(const QUuid &motionId); const std::set &requiredMotionIds(); const std::set &generatedMotionIds(); void generate(); signals: void finished(); public slots: void process(); private: void generateMotion(const QUuid &motionId, std::set &visited, std::vector> &outcomes, std::vector *previews=nullptr); const JointNodeTree &poseJointNodeTree(const QUuid &poseId, int frame); JointNodeTree generateInterpolation(InterpolationType interpolationType, const JointNodeTree &first, const JointNodeTree &second, float progress); const JointNodeTree *findClipBeginJointNodeTree(const MotionClip &clip); const JointNodeTree *findClipEndJointNodeTree(const MotionClip &clip); std::vector *findMotionClips(const QUuid &motionId); std::vector, std::map>>> *findPoseFrames(const QUuid &poseId); void generatePreviewsForOutcomes(const std::vector> &outcomes, std::vector> &previews); float calculateMotionDuration(const QUuid &motionId, std::set &visited); float calculatePoseDuration(const QUuid &poseId); RigType m_rigType = RigType::None; std::vector m_rigBones; std::map m_rigWeights; std::map>> m_proceduralAnimations; #if ENABLE_PROCEDURAL_DEBUG std::map> m_proceduralDebugPreviews; #endif Outcome m_outcome; std::map, std::map>>>> m_poses; std::map m_posesYtranslationScales; std::map> m_motions; std::set m_requiredMotionIds; std::set m_generatedMotionIds; std::map>> m_resultPreviewMeshs; std::map>> m_resultJointNodeTrees; std::map, JointNodeTree> m_poseJointNodeTreeMap; Poser *m_poser = nullptr; int m_fps = 30; }; #endif