2021-11-18 14:58:01 +00:00
|
|
|
#ifndef DUST3D_APPLICATION_DOCUMENT_WINDOW_H_
|
|
|
|
#define DUST3D_APPLICATION_DOCUMENT_WINDOW_H_
|
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
#include "component_preview_images_decorator.h"
|
|
|
|
#include "graphics_container_widget.h"
|
|
|
|
#include "mesh_preview_images_generator.h"
|
|
|
|
#include "model_widget.h"
|
|
|
|
#include <QAction>
|
|
|
|
#include <QLabel>
|
2018-04-07 08:44:39 +00:00
|
|
|
#include <QMainWindow>
|
2022-10-18 09:35:04 +00:00
|
|
|
#include <QMenu>
|
2018-04-08 08:05:12 +00:00
|
|
|
#include <QPushButton>
|
2022-10-18 09:35:04 +00:00
|
|
|
#include <QShortcut>
|
|
|
|
#include <QShowEvent>
|
2018-04-10 07:59:20 +00:00
|
|
|
#include <QString>
|
2019-07-23 10:13:58 +00:00
|
|
|
#include <QStringList>
|
2022-10-18 09:35:04 +00:00
|
|
|
#include <map>
|
|
|
|
#include <memory>
|
2018-04-07 08:44:39 +00:00
|
|
|
|
2020-12-19 02:29:24 +00:00
|
|
|
class Document;
|
2018-04-10 07:59:20 +00:00
|
|
|
class SkeletonGraphicsWidget;
|
2022-10-03 00:06:25 +00:00
|
|
|
class PartManageWidget;
|
2022-11-11 12:06:06 +00:00
|
|
|
class BoneManageWidget;
|
2021-11-18 14:58:01 +00:00
|
|
|
class ToolbarButton;
|
|
|
|
class SpinnableToolbarIcon;
|
2018-04-10 07:59:20 +00:00
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
class DocumentWindow : public QMainWindow {
|
2018-04-07 08:44:39 +00:00
|
|
|
Q_OBJECT
|
|
|
|
signals:
|
|
|
|
void initialized();
|
2019-03-17 06:23:39 +00:00
|
|
|
void uninialized();
|
2022-10-18 09:35:04 +00:00
|
|
|
void waitingExportFinished(const QString& filename, bool isSuccessful);
|
2022-10-12 13:24:45 +00:00
|
|
|
void workingStatusChanged(bool isWorking);
|
2022-10-18 09:35:04 +00:00
|
|
|
|
2018-04-07 08:44:39 +00:00
|
|
|
public:
|
2018-11-05 15:47:21 +00:00
|
|
|
DocumentWindow();
|
|
|
|
~DocumentWindow();
|
2022-10-18 09:35:04 +00:00
|
|
|
Document* document();
|
|
|
|
ModelWidget* modelWidget();
|
2022-10-12 13:24:45 +00:00
|
|
|
bool isWorking();
|
2022-10-18 09:35:04 +00:00
|
|
|
static DocumentWindow* createDocumentWindow();
|
|
|
|
static const std::map<DocumentWindow*, dust3d::Uuid>& documentWindows();
|
2018-04-10 07:59:20 +00:00
|
|
|
static void showAcknowlegements();
|
2018-08-27 08:50:40 +00:00
|
|
|
static void showContributors();
|
2020-07-12 22:19:34 +00:00
|
|
|
static void showSupporters();
|
2018-04-10 07:59:20 +00:00
|
|
|
static void showAbout();
|
2020-04-04 00:54:05 +00:00
|
|
|
static size_t total();
|
2022-10-18 09:35:04 +00:00
|
|
|
|
2018-04-07 08:44:39 +00:00
|
|
|
protected:
|
2022-10-18 09:35:04 +00:00
|
|
|
void showEvent(QShowEvent* event);
|
|
|
|
void closeEvent(QCloseEvent* event);
|
|
|
|
void mousePressEvent(QMouseEvent* event);
|
2018-04-07 08:44:39 +00:00
|
|
|
public slots:
|
|
|
|
void changeTurnaround();
|
2018-04-10 07:59:20 +00:00
|
|
|
void save();
|
2022-10-18 09:35:04 +00:00
|
|
|
void saveTo(const QString& saveAsFilename);
|
2018-04-10 07:59:20 +00:00
|
|
|
void open();
|
2022-10-18 09:35:04 +00:00
|
|
|
void openExample(const QString& modelName);
|
|
|
|
void openPathAs(const QString& path, const QString& asName);
|
2018-09-05 03:14:36 +00:00
|
|
|
void exportObjResult();
|
2018-10-25 09:18:04 +00:00
|
|
|
void exportGlbResult();
|
2018-10-20 05:07:11 +00:00
|
|
|
void exportFbxResult();
|
2018-04-10 07:59:20 +00:00
|
|
|
void newWindow();
|
|
|
|
void newDocument();
|
|
|
|
void saveAs();
|
|
|
|
void saveAll();
|
2019-03-10 01:56:54 +00:00
|
|
|
void gotoHomepage();
|
2018-04-10 07:59:20 +00:00
|
|
|
void viewSource();
|
|
|
|
void about();
|
2019-07-24 12:41:55 +00:00
|
|
|
void checkForUpdates();
|
2018-04-10 07:59:20 +00:00
|
|
|
void reportIssues();
|
|
|
|
void seeAcknowlegements();
|
2018-08-27 08:50:40 +00:00
|
|
|
void seeContributors();
|
2020-07-12 22:19:34 +00:00
|
|
|
void seeSupporters();
|
2018-04-18 13:18:10 +00:00
|
|
|
void seeReferenceGuide();
|
2018-04-10 07:59:20 +00:00
|
|
|
void documentChanged();
|
2018-04-16 22:54:41 +00:00
|
|
|
void updateXlockButtonState();
|
|
|
|
void updateYlockButtonState();
|
|
|
|
void updateZlockButtonState();
|
2018-09-08 04:20:31 +00:00
|
|
|
void updateRadiusLockButtonState();
|
2022-10-18 09:35:04 +00:00
|
|
|
void registerDialog(QWidget* widget);
|
|
|
|
void unregisterDialog(QWidget* widget);
|
|
|
|
void setExportWaitingList(const QStringList& filenames);
|
2019-07-23 10:13:58 +00:00
|
|
|
void checkExportWaitingList();
|
2022-10-18 09:35:04 +00:00
|
|
|
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();
|
2022-10-02 19:45:46 +00:00
|
|
|
void generateComponentPreviewImages();
|
|
|
|
void componentPreviewImagesReady();
|
2022-10-05 11:34:56 +00:00
|
|
|
void decorateComponentPreviewImages();
|
|
|
|
void componentPreviewImageDecorationsReady();
|
2022-12-03 12:01:11 +00:00
|
|
|
void generateBonePreviewImages();
|
|
|
|
void bonePreviewImagesReady();
|
2021-11-18 14:58:01 +00:00
|
|
|
void updateInprogressIndicator();
|
2020-12-20 06:20:59 +00:00
|
|
|
void openRecentFile();
|
|
|
|
void updateRecentFileActions();
|
2022-10-14 08:21:20 +00:00
|
|
|
void toggleRenderColor();
|
2022-10-18 09:35:04 +00:00
|
|
|
|
2018-04-08 08:05:12 +00:00
|
|
|
private:
|
2022-10-18 09:35:04 +00:00
|
|
|
void setCurrentFilename(const QString& filename);
|
2018-04-10 07:59:20 +00:00
|
|
|
void updateTitle();
|
2020-12-19 08:12:50 +00:00
|
|
|
void initializeShortcuts();
|
2022-10-18 09:35:04 +00:00
|
|
|
void initializeToolShortcuts(SkeletonGraphicsWidget* graphicsWidget);
|
|
|
|
void initializeCanvasShortcuts(SkeletonGraphicsWidget* graphicsWidget);
|
|
|
|
QShortcut* createShortcut(QKeySequence key);
|
|
|
|
QString strippedName(const QString& fullFileName);
|
|
|
|
bool openFiles(const QStringList& pathList);
|
2021-11-18 14:58:01 +00:00
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
Document* m_document = nullptr;
|
2020-12-19 08:12:50 +00:00
|
|
|
bool m_firstShow = true;
|
|
|
|
bool m_documentSaved = true;
|
2022-10-18 09:35:04 +00:00
|
|
|
std::vector<QWidget*> m_dialogs;
|
2020-12-19 08:12:50 +00:00
|
|
|
bool m_isLastMeshGenerationSucceed = true;
|
|
|
|
quint64 m_currentUpdatedMeshId = 0;
|
2019-07-23 10:13:58 +00:00
|
|
|
QStringList m_waitingForExportToFilenames;
|
2022-10-18 09:35:04 +00:00
|
|
|
|
2018-04-16 22:54:41 +00:00
|
|
|
QString m_currentFilename;
|
2022-10-18 09:35:04 +00:00
|
|
|
|
|
|
|
ModelWidget* m_modelRenderWidget = nullptr;
|
|
|
|
SkeletonGraphicsWidget* m_canvasGraphicsWidget = nullptr;
|
|
|
|
GraphicsContainerWidget* m_graphicsContainerWidget = nullptr;
|
|
|
|
|
|
|
|
QMenu* m_fileMenu = nullptr;
|
|
|
|
QAction* m_newWindowAction = nullptr;
|
|
|
|
QAction* m_newDocumentAction = nullptr;
|
|
|
|
QAction* m_openAction = nullptr;
|
|
|
|
QMenu* m_openExampleMenu = nullptr;
|
|
|
|
QAction* m_saveAction = nullptr;
|
|
|
|
QAction* m_saveAsAction = nullptr;
|
|
|
|
QAction* m_saveAllAction = nullptr;
|
|
|
|
QAction* m_changeTurnaroundAction = nullptr;
|
|
|
|
std::vector<QAction*> m_recentFileActions;
|
|
|
|
QAction* m_recentFileSeparatorAction = nullptr;
|
|
|
|
QAction* m_quitAction = nullptr;
|
|
|
|
|
|
|
|
QAction* m_exportAsObjAction = nullptr;
|
|
|
|
QAction* m_exportAsGlbAction = nullptr;
|
|
|
|
QAction* m_exportAsFbxAction = nullptr;
|
|
|
|
|
|
|
|
QMenu* m_viewMenu = nullptr;
|
|
|
|
QAction* m_toggleWireframeAction = nullptr;
|
|
|
|
QAction* m_toggleRotationAction = nullptr;
|
|
|
|
QAction* m_toggleColorAction = nullptr;
|
2020-01-05 05:05:07 +00:00
|
|
|
bool m_modelRemoveColor = false;
|
2022-10-18 09:35:04 +00:00
|
|
|
|
|
|
|
QMenu* m_windowMenu = nullptr;
|
|
|
|
QAction* m_showPartsListAction = nullptr;
|
|
|
|
QAction* m_showDebugDialogAction = nullptr;
|
|
|
|
|
|
|
|
QMenu* m_helpMenu = nullptr;
|
|
|
|
QAction* m_gotoHomepageAction = nullptr;
|
|
|
|
QAction* m_viewSourceAction = nullptr;
|
|
|
|
QAction* m_aboutAction = nullptr;
|
|
|
|
QAction* m_checkForUpdatesAction = nullptr;
|
|
|
|
QAction* m_reportIssuesAction = nullptr;
|
|
|
|
QAction* m_seeContributorsAction = nullptr;
|
|
|
|
QAction* m_seeSupportersAction = nullptr;
|
|
|
|
QAction* m_seeAcknowlegementsAction = nullptr;
|
|
|
|
QAction* m_seeReferenceGuideAction = nullptr;
|
|
|
|
|
|
|
|
ToolbarButton* m_xLockButton = nullptr;
|
|
|
|
ToolbarButton* m_yLockButton = nullptr;
|
|
|
|
ToolbarButton* m_zLockButton = nullptr;
|
|
|
|
ToolbarButton* m_radiusLockButton = nullptr;
|
|
|
|
|
2018-05-10 09:16:22 +00:00
|
|
|
QMetaObject::Connection m_partListDockerVisibleSwitchConnection;
|
2022-10-18 09:35:04 +00:00
|
|
|
|
|
|
|
MeshPreviewImagesGenerator* m_componentPreviewImagesGenerator = nullptr;
|
2022-10-02 19:45:46 +00:00
|
|
|
bool m_isComponentPreviewImagesObsolete = false;
|
2022-10-05 11:34:56 +00:00
|
|
|
|
|
|
|
std::unique_ptr<ComponentPreviewImagesDecorator> m_componentPreviewImagesDecorator;
|
|
|
|
bool m_isComponentPreviewImageDecorationsObsolete = false;
|
2022-10-18 09:35:04 +00:00
|
|
|
|
2022-12-03 12:01:11 +00:00
|
|
|
MeshPreviewImagesGenerator* m_bonePreviewImagesGenerator = nullptr;
|
|
|
|
bool m_isBonePreviewImagesObsolete = false;
|
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
PartManageWidget* m_partManageWidget = nullptr;
|
2022-11-11 12:06:06 +00:00
|
|
|
BoneManageWidget* m_boneManageWidget = nullptr;
|
2022-10-18 09:35:04 +00:00
|
|
|
|
|
|
|
SpinnableToolbarIcon* m_inprogressIndicator = nullptr;
|
|
|
|
|
|
|
|
std::map<QKeySequence, QShortcut*> m_shortcutMap;
|
2018-04-07 08:44:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|