2018-10-25 00:19:38 +00:00
|
|
|
#ifndef DUST3D_POSE_EDIT_WIDGET_H
|
|
|
|
#define DUST3D_POSE_EDIT_WIDGET_H
|
2018-09-21 07:10:18 +00:00
|
|
|
#include <QDialog>
|
|
|
|
#include <map>
|
|
|
|
#include <QCloseEvent>
|
|
|
|
#include <QLineEdit>
|
2018-11-09 03:20:48 +00:00
|
|
|
#include <QSlider>
|
2019-03-03 00:05:13 +00:00
|
|
|
#include <QDoubleSpinBox>
|
2018-09-21 07:10:18 +00:00
|
|
|
#include "posepreviewmanager.h"
|
2018-10-25 00:19:38 +00:00
|
|
|
#include "document.h"
|
2018-09-21 07:10:18 +00:00
|
|
|
#include "modelwidget.h"
|
2018-11-01 15:24:06 +00:00
|
|
|
#include "rigger.h"
|
2018-11-05 15:47:21 +00:00
|
|
|
#include "skeletongraphicswidget.h"
|
|
|
|
#include "posedocument.h"
|
2018-11-09 03:20:48 +00:00
|
|
|
#include "floatnumberwidget.h"
|
2019-06-17 12:49:08 +00:00
|
|
|
#include "skeletonside.h"
|
2018-09-21 07:10:18 +00:00
|
|
|
|
|
|
|
class PoseEditWidget : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
signals:
|
2018-11-09 15:07:26 +00:00
|
|
|
void addPose(QUuid poseId, QString name, std::vector<std::pair<std::map<QString, QString>, std::map<QString, std::map<QString, QString>>>> frames, QUuid turnaroundImageId);
|
2018-09-21 07:10:18 +00:00
|
|
|
void removePose(QUuid poseId);
|
2018-11-09 03:20:48 +00:00
|
|
|
void setPoseFrames(QUuid poseId, std::vector<std::pair<std::map<QString, QString>, std::map<QString, std::map<QString, QString>>>> frames);
|
|
|
|
void setPoseTurnaroundImageId(QUuid poseId, QUuid imageId);
|
2018-09-21 07:10:18 +00:00
|
|
|
void renamePose(QUuid poseId, QString name);
|
|
|
|
void parametersAdjusted();
|
|
|
|
public:
|
2018-10-25 00:19:38 +00:00
|
|
|
PoseEditWidget(const Document *document, QWidget *parent=nullptr);
|
2018-09-21 07:10:18 +00:00
|
|
|
~PoseEditWidget();
|
2018-11-09 03:20:48 +00:00
|
|
|
|
2019-03-03 00:05:13 +00:00
|
|
|
float m_duration = 1.0;
|
2018-09-21 07:10:18 +00:00
|
|
|
public slots:
|
2018-11-05 15:47:21 +00:00
|
|
|
void updatePoseDocument();
|
2018-09-21 07:10:18 +00:00
|
|
|
void updatePreview();
|
2018-11-09 03:20:48 +00:00
|
|
|
void syncFrameFromCurrent();
|
2018-09-21 07:10:18 +00:00
|
|
|
void setEditPoseId(QUuid poseId);
|
|
|
|
void setEditPoseName(QString name);
|
2018-11-09 03:20:48 +00:00
|
|
|
void setEditPoseFrames(std::vector<std::pair<std::map<QString, QString>, std::map<QString, std::map<QString, QString>>>> frames);
|
|
|
|
void setEditPoseTurnaroundImageId(QUuid imageId);
|
|
|
|
void setCurrentFrame(int frame);
|
2019-03-03 00:05:13 +00:00
|
|
|
void insertFrameAfterCurrentFrame();
|
|
|
|
void removeCurrentFrame();
|
2018-11-09 03:20:48 +00:00
|
|
|
void setFrameCount(int count);
|
2019-03-03 00:05:13 +00:00
|
|
|
void setDuration(float duration);
|
2018-09-21 07:10:18 +00:00
|
|
|
void updateTitle();
|
|
|
|
void save();
|
|
|
|
void clearUnsaveState();
|
2018-11-09 03:20:48 +00:00
|
|
|
void setUnsaveState();
|
2018-11-05 15:47:21 +00:00
|
|
|
void changeTurnaround();
|
2018-11-09 03:20:48 +00:00
|
|
|
private slots:
|
|
|
|
void updateFramesSettingButton();
|
|
|
|
void showFramesSettingPopup(const QPoint &pos);
|
2019-03-03 00:05:13 +00:00
|
|
|
void updateFramesDurations();
|
2018-09-21 07:10:18 +00:00
|
|
|
protected:
|
|
|
|
QSize sizeHint() const override;
|
|
|
|
void closeEvent(QCloseEvent *event) override;
|
|
|
|
void reject() override;
|
|
|
|
private:
|
2018-11-09 03:20:48 +00:00
|
|
|
void ensureEnoughFrames();
|
2018-10-25 00:19:38 +00:00
|
|
|
const Document *m_document = nullptr;
|
2018-09-21 07:10:18 +00:00
|
|
|
PosePreviewManager *m_posePreviewManager = nullptr;
|
|
|
|
ModelWidget *m_previewWidget = nullptr;
|
|
|
|
bool m_isPreviewDirty = false;
|
|
|
|
bool m_closed = false;
|
2018-11-09 03:20:48 +00:00
|
|
|
std::vector<std::pair<std::map<QString, QString>, std::map<QString, std::map<QString, QString>>>> m_frames;
|
|
|
|
std::map<QString, QString> m_currentAttributes;
|
|
|
|
std::map<QString, std::map<QString, QString>> m_currentParameters;
|
2019-03-03 00:05:13 +00:00
|
|
|
std::vector<std::map<QString, std::map<QString, QString>>> m_otherFramesParameters;
|
2018-11-09 03:20:48 +00:00
|
|
|
int m_currentFrame = 0;
|
2018-09-21 07:10:18 +00:00
|
|
|
QUuid m_poseId;
|
|
|
|
bool m_unsaved = false;
|
2018-11-05 15:47:21 +00:00
|
|
|
QUuid m_imageId;
|
2018-09-21 07:10:18 +00:00
|
|
|
QLineEdit *m_nameEdit = nullptr;
|
2019-03-03 00:05:13 +00:00
|
|
|
QDoubleSpinBox *m_durationEdit = nullptr;
|
2018-11-05 15:47:21 +00:00
|
|
|
PoseDocument *m_poseDocument = nullptr;
|
|
|
|
SkeletonGraphicsWidget *m_poseGraphicsWidget = nullptr;
|
2018-11-09 03:20:48 +00:00
|
|
|
QPushButton *m_framesSettingButton = nullptr;
|
|
|
|
QSlider *m_currentFrameSlider = nullptr;
|
2019-06-16 08:45:03 +00:00
|
|
|
static float m_defaultBlur;
|
2019-06-17 12:49:08 +00:00
|
|
|
void initSideButton(QPushButton *button);
|
|
|
|
void updateSideButtonState(QPushButton *button, bool visible);
|
2018-09-21 07:10:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|