dust3d/src/documentwindow.h

234 lines
7.1 KiB
C
Raw Normal View History

#ifndef DUST3D_DOCUMENT_WINDOW_H
#define DUST3D_DOCUMENT_WINDOW_H
#include <QMainWindow>
#include <QShowEvent>
2018-04-08 08:05:12 +00:00
#include <QPushButton>
#include <QString>
#include <QMenu>
#include <QAction>
#include <QTextBrowser>
#include <map>
#include <QStringList>
2019-12-14 13:28:14 +00:00
#include <QLabel>
#include "document.h"
#include "modelwidget.h"
#include "exportpreviewwidget.h"
#include "rigwidget.h"
#include "bonemark.h"
#include "posemanagewidget.h"
#include "preferenceswidget.h"
2019-12-14 13:28:14 +00:00
#include "graphicscontainerwidget.h"
#include "normalanddepthmapsgenerator.h"
#include "autosaver.h"
class SkeletonGraphicsWidget;
class DocumentWindow : public QMainWindow
{
Q_OBJECT
signals:
void initialized();
void uninialized();
void waitingExportFinished(const QString &filename, bool isSuccessful);
2019-08-08 11:24:33 +00:00
void mouseTargetVertexPositionChanged(const QVector3D &position);
public:
DocumentWindow();
~DocumentWindow();
2019-03-17 14:04:12 +00:00
Document *document();
static DocumentWindow *createDocumentWindow();
static const std::map<DocumentWindow *, QUuid> &documentWindows();
static void showAcknowlegements();
static void showContributors();
static void showAbout();
static size_t total();
protected:
void showEvent(QShowEvent *event);
void closeEvent(QCloseEvent *event);
2018-04-13 01:42:19 +00:00
void mousePressEvent(QMouseEvent *event);
public slots:
void changeTurnaround();
void save();
void saveTo(const QString &saveAsFilename);
void open();
2019-06-10 22:47:12 +00:00
void openExample(const QString &modelName);
void openPathAs(const QString &path, const QString &asName);
void exportRenderedResult();
2018-09-05 03:14:36 +00:00
void exportObjResult();
void exportGlbResult();
void exportFbxResult();
void showExportPreview();
void newWindow();
void newDocument();
void saveAs();
void saveAll();
2019-03-10 01:56:54 +00:00
void gotoHomepage();
void viewSource();
void about();
2019-07-24 12:41:55 +00:00
void checkForUpdates();
void reportIssues();
void seeAcknowlegements();
void seeContributors();
2018-04-18 13:18:10 +00:00
void seeReferenceGuide();
void documentChanged();
2019-10-19 13:14:36 +00:00
void updateRotationButtonState();
2018-04-16 22:54:41 +00:00
void updateXlockButtonState();
void updateYlockButtonState();
void updateZlockButtonState();
2018-09-08 04:20:31 +00:00
void updateRadiusLockButtonState();
void updateRigWeightRenderWidget();
void registerDialog(QWidget *widget);
void unregisterDialog(QWidget *widget);
void showPreferences();
void showCutFaceSettingPopup(const QPoint &globalPos, std::set<QUuid> nodeIds);
void setExportWaitingList(const QStringList &filenames);
void checkExportWaitingList();
void exportImageToFilename(const QString &filename);
void exportObjToFilename(const QString &filename);
void exportFbxToFilename(const QString &filename);
void exportGlbToFilename(const QString &filename);
2019-10-19 13:14:36 +00:00
void toggleRotation();
2019-12-14 13:28:14 +00:00
//void updateInfoWidgetPosition();
void generateNormalAndDepthMaps();
void delayedGenerateNormalAndDepthMaps();
void normalAndDepthMapsReady();
void autoRecover();
void import();
void importPath(const QString &filename);
2018-04-08 08:05:12 +00:00
private:
2018-04-16 22:54:41 +00:00
void initLockButton(QPushButton *button);
void setCurrentFilename(const QString &filename);
void updateTitle();
void createPartSnapshotForFillMesh(const QUuid &fillMeshFileId, Snapshot *snapshot);
private:
Document *m_document;
bool m_firstShow;
2018-04-16 22:54:41 +00:00
bool m_documentSaved;
ExportPreviewWidget *m_exportPreviewWidget;
PreferencesWidget *m_preferencesWidget;
std::vector<QWidget *> m_dialogs;
bool m_isLastMeshGenerationSucceed;
quint64 m_currentUpdatedMeshId;
QStringList m_waitingForExportToFilenames;
2018-04-16 22:54:41 +00:00
private:
QString m_currentFilename;
ModelWidget *m_modelRenderWidget;
SkeletonGraphicsWidget *m_graphicsWidget;
RigWidget *m_rigWidget;
2019-12-14 13:28:14 +00:00
//QLabel *m_infoWidget;
GraphicsContainerWidget *m_graphicsContainerWidget;
QMenu *m_fileMenu;
QAction *m_newWindowAction;
QAction *m_newDocumentAction;
QAction *m_openAction;
2019-06-10 22:47:12 +00:00
QMenu *m_openExampleMenu;
//QAction *m_openExampleAction;
QAction *m_saveAction;
QAction *m_saveAsAction;
QAction *m_saveAllAction;
QAction *m_showPreferencesAction;
QMenu *m_exportMenu;
QAction *m_changeTurnaroundAction;
2019-12-29 18:40:58 +00:00
QAction *m_quitAction;
QAction *m_importAction;
2018-09-05 03:14:36 +00:00
QAction *m_exportAsObjAction;
QAction *m_exportAsObjPlusMaterialsAction;
QAction *m_exportAction;
QAction *m_exportRenderedAsImageAction;
QMenu *m_editMenu;
QAction *m_addAction;
QAction *m_undoAction;
QAction *m_redoAction;
QAction *m_deleteAction;
2018-04-12 12:27:21 +00:00
QAction *m_breakAction;
QAction *m_reverseAction;
2018-04-12 12:46:13 +00:00
QAction *m_connectAction;
QAction *m_cutAction;
QAction *m_copyAction;
QAction *m_pasteAction;
QAction *m_flipHorizontallyAction;
QAction *m_flipVerticallyAction;
QAction *m_rotateClockwiseAction;
QAction *m_rotateCounterclockwiseAction;
2018-06-21 08:24:18 +00:00
QAction *m_switchXzAction;
QAction *m_setCutFaceAction;
QAction *m_clearCutFaceAction;
2019-12-14 13:28:14 +00:00
QAction *m_createWrapPartsAction;
QMenu *m_alignToMenu;
QAction *m_alignToGlobalCenterAction;
QAction *m_alignToGlobalVerticalCenterAction;
QAction *m_alignToGlobalHorizontalCenterAction;
QAction *m_alignToLocalCenterAction;
QAction *m_alignToLocalVerticalCenterAction;
QAction *m_alignToLocalHorizontalCenterAction;
QAction *m_selectAllAction;
QAction *m_selectPartAllAction;
QAction *m_unselectAllAction;
QMenu *m_markAsMenu;
QAction *m_markAsNoneAction;
QAction *m_markAsActions[(int)BoneMark::Count - 1];
2019-10-25 22:17:31 +00:00
QMenu *m_colorizeAsMenu;
QAction *m_colorizeAsBlankAction;
QAction *m_colorizeAsAutoAction;
QMenu *m_viewMenu;
QAction *m_resetModelWidgetPosAction;
QAction *m_toggleWireframeAction;
2019-08-09 22:27:26 +00:00
QAction *m_toggleUvCheckAction;
QAction *m_toggleRotationAction;
2020-01-05 05:05:07 +00:00
QAction *m_toggleColorAction;
bool m_modelRemoveColor = false;
QMenu *m_windowMenu;
QAction *m_showPartsListAction;
QAction *m_showDebugDialogAction;
QAction *m_showMaterialsAction;
QAction *m_showRigAction;
2018-09-21 08:14:37 +00:00
QAction *m_showPosesAction;
QAction *m_showMotionsAction;
QAction *m_showScriptAction;
QMenu *m_helpMenu;
2019-03-10 01:56:54 +00:00
QAction *m_gotoHomepageAction;
QAction *m_viewSourceAction;
QAction *m_aboutAction;
2019-07-24 12:41:55 +00:00
QAction *m_checkForUpdatesAction;
QAction *m_reportIssuesAction;
QAction *m_seeContributorsAction;
QAction *m_seeAcknowlegementsAction;
2018-04-18 13:18:10 +00:00
QAction *m_seeReferenceGuideAction;
2019-10-19 13:14:36 +00:00
QPushButton *m_rotationButton;
2018-04-16 22:54:41 +00:00
QPushButton *m_xlockButton;
QPushButton *m_ylockButton;
QPushButton *m_zlockButton;
2018-09-08 04:20:31 +00:00
QPushButton *m_radiusLockButton;
QMetaObject::Connection m_partListDockerVisibleSwitchConnection;
NormalAndDepthMapsGenerator *m_normalAndDepthMapsGenerator = nullptr;
bool m_isNormalAndDepthMapsObsolete = false;
AutoSaver *m_autoSaver = nullptr;
public:
static int m_modelRenderWidgetInitialX;
static int m_modelRenderWidgetInitialY;
static int m_modelRenderWidgetInitialSize;
static int m_skeletonRenderWidgetInitialX;
static int m_skeletonRenderWidgetInitialY;
static int m_skeletonRenderWidgetInitialSize;
static int m_autoRecovered;
};
#endif