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>
|
|
|
|
#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-09-21 07:10:18 +00:00
|
|
|
|
|
|
|
class PoseEditWidget : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
signals:
|
|
|
|
void addPose(QString name, std::map<QString, std::map<QString, QString>> parameters);
|
|
|
|
void removePose(QUuid poseId);
|
|
|
|
void setPoseParameters(QUuid poseId, std::map<QString, std::map<QString, QString>> parameters);
|
2018-11-05 15:47:21 +00:00
|
|
|
void setPoseAttributes(QUuid poseId, std::map<QString, QString> attributes);
|
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();
|
|
|
|
public slots:
|
2018-11-05 15:47:21 +00:00
|
|
|
void updatePoseDocument();
|
2018-09-21 07:10:18 +00:00
|
|
|
void updatePreview();
|
|
|
|
void setEditPoseId(QUuid poseId);
|
|
|
|
void setEditPoseName(QString name);
|
|
|
|
void setEditParameters(std::map<QString, std::map<QString, QString>> parameters);
|
2018-11-05 15:47:21 +00:00
|
|
|
void setEditAttributes(std::map<QString, QString> attributes);
|
2018-09-21 07:10:18 +00:00
|
|
|
void updateTitle();
|
|
|
|
void save();
|
|
|
|
void clearUnsaveState();
|
2018-11-05 15:47:21 +00:00
|
|
|
void changeTurnaround();
|
2018-09-21 07:10:18 +00:00
|
|
|
protected:
|
|
|
|
QSize sizeHint() const override;
|
|
|
|
void closeEvent(QCloseEvent *event) override;
|
|
|
|
void reject() override;
|
|
|
|
private:
|
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;
|
|
|
|
std::map<QString, std::map<QString, QString>> m_parameters;
|
2018-11-05 15:47:21 +00:00
|
|
|
std::map<QString, QString> m_attributes;
|
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;
|
2018-11-05 15:47:21 +00:00
|
|
|
PoseDocument *m_poseDocument = nullptr;
|
|
|
|
SkeletonGraphicsWidget *m_poseGraphicsWidget = nullptr;
|
|
|
|
QUuid findImageIdFromAttributes(const std::map<QString, QString> &attributes);
|
2018-09-21 07:10:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|