Add bone document
parent
2495969f87
commit
fac30fc6a4
|
@ -535,6 +535,9 @@ HEADERS += src/statusbarlabel.h
|
||||||
SOURCES += src/silhouetteimagegenerator.cpp
|
SOURCES += src/silhouetteimagegenerator.cpp
|
||||||
HEADERS += src/silhouetteimagegenerator.h
|
HEADERS += src/silhouetteimagegenerator.h
|
||||||
|
|
||||||
|
SOURCES += src/bonedocument.cpp
|
||||||
|
HEADERS += src/bonedocument.h
|
||||||
|
|
||||||
SOURCES += src/main.cpp
|
SOURCES += src/main.cpp
|
||||||
|
|
||||||
HEADERS += src/version.h
|
HEADERS += src/version.h
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
#include "bonedocument.h"
|
||||||
|
|
||||||
|
BoneDocument::BoneDocument()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BoneDocument::undoable(void) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BoneDocument::redoable(void) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BoneDocument::hasPastableNodesInClipboard(void) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BoneDocument::originSettled(void) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BoneDocument::isNodeEditable(QUuid) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BoneDocument::isEdgeEditable(QUuid) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BoneDocument::copyNodes(std::set<QUuid> nodeIdSet) const
|
||||||
|
{
|
||||||
|
// TODO:
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BoneDocument::undo(void)
|
||||||
|
{
|
||||||
|
// TODO:
|
||||||
|
}
|
||||||
|
|
||||||
|
void BoneDocument::redo(void)
|
||||||
|
{
|
||||||
|
// TODO:
|
||||||
|
}
|
||||||
|
|
||||||
|
void BoneDocument::paste(void)
|
||||||
|
{
|
||||||
|
// TODO:
|
||||||
|
}
|
||||||
|
|
||||||
|
void BoneDocument::updateTurnaround(const QImage &image)
|
||||||
|
{
|
||||||
|
turnaround = image;
|
||||||
|
emit turnaroundChanged();
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef DUST3D_BONE_DOCUMENT_H
|
||||||
|
#define DUST3D_BONE_DOCUMENT_H
|
||||||
|
#include "skeletondocument.h"
|
||||||
|
|
||||||
|
class BoneDocument : public SkeletonDocument
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
signals:
|
||||||
|
void turnaroundChanged();
|
||||||
|
public:
|
||||||
|
BoneDocument();
|
||||||
|
bool undoable(void) const;
|
||||||
|
bool redoable(void) const;
|
||||||
|
bool hasPastableNodesInClipboard(void) const;
|
||||||
|
bool originSettled(void) const;
|
||||||
|
bool isNodeEditable(QUuid) const;
|
||||||
|
bool isEdgeEditable(QUuid) const;
|
||||||
|
void copyNodes(std::set<QUuid> nodeIdSet) const;
|
||||||
|
void undo(void);
|
||||||
|
void redo(void);
|
||||||
|
void paste(void);
|
||||||
|
void updateTurnaround(const QImage &image);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -54,6 +54,7 @@
|
||||||
#include "statusbarlabel.h"
|
#include "statusbarlabel.h"
|
||||||
#include "silhouetteimagegenerator.h"
|
#include "silhouetteimagegenerator.h"
|
||||||
#include "flowlayout.h"
|
#include "flowlayout.h"
|
||||||
|
#include "bonedocument.h"
|
||||||
|
|
||||||
int DocumentWindow::m_autoRecovered = false;
|
int DocumentWindow::m_autoRecovered = false;
|
||||||
|
|
||||||
|
@ -207,6 +208,11 @@ DocumentWindow::DocumentWindow() :
|
||||||
SkeletonGraphicsWidget *shapeGraphicsWidget = new SkeletonGraphicsWidget(m_document);
|
SkeletonGraphicsWidget *shapeGraphicsWidget = new SkeletonGraphicsWidget(m_document);
|
||||||
m_shapeGraphicsWidget = shapeGraphicsWidget;
|
m_shapeGraphicsWidget = shapeGraphicsWidget;
|
||||||
|
|
||||||
|
m_boneDocument = new BoneDocument;
|
||||||
|
|
||||||
|
SkeletonGraphicsWidget *boneGraphicsWidget = new SkeletonGraphicsWidget(m_boneDocument);
|
||||||
|
m_boneGraphicsWidget = boneGraphicsWidget;
|
||||||
|
|
||||||
QVBoxLayout *toolButtonLayout = new QVBoxLayout;
|
QVBoxLayout *toolButtonLayout = new QVBoxLayout;
|
||||||
toolButtonLayout->setSpacing(0);
|
toolButtonLayout->setSpacing(0);
|
||||||
toolButtonLayout->setContentsMargins(5, 10, 4, 0);
|
toolButtonLayout->setContentsMargins(5, 10, 4, 0);
|
||||||
|
@ -323,8 +329,18 @@ DocumentWindow::DocumentWindow() :
|
||||||
shapeGraphicsLayout->addWidget(shapeGraphicsWidget);
|
shapeGraphicsLayout->addWidget(shapeGraphicsWidget);
|
||||||
shapeWidget->setLayout(shapeGraphicsLayout);
|
shapeWidget->setLayout(shapeGraphicsLayout);
|
||||||
|
|
||||||
|
QWidget *boneWidget = new QWidget;
|
||||||
|
|
||||||
|
QGridLayout *boneGraphicsLayout = new QGridLayout;
|
||||||
|
boneGraphicsLayout->setSpacing(0);
|
||||||
|
boneGraphicsLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
boneGraphicsLayout->addWidget(boneGraphicsWidget);
|
||||||
|
boneWidget->setLayout(boneGraphicsLayout);
|
||||||
|
|
||||||
QStackedWidget *canvasStackedWidget = new QStackedWidget;
|
QStackedWidget *canvasStackedWidget = new QStackedWidget;
|
||||||
|
canvasStackedWidget->addWidget(boneWidget);
|
||||||
canvasStackedWidget->addWidget(shapeWidget);
|
canvasStackedWidget->addWidget(shapeWidget);
|
||||||
|
canvasStackedWidget->setCurrentIndex(1);
|
||||||
|
|
||||||
GraphicsContainerWidget *containerWidget = new GraphicsContainerWidget;
|
GraphicsContainerWidget *containerWidget = new GraphicsContainerWidget;
|
||||||
containerWidget->setGraphicsWidget(shapeGraphicsWidget);
|
containerWidget->setGraphicsWidget(shapeGraphicsWidget);
|
||||||
|
@ -338,6 +354,17 @@ DocumentWindow::DocumentWindow() :
|
||||||
containerWidget->setAutoFillBackground(true);
|
containerWidget->setAutoFillBackground(true);
|
||||||
containerWidget->setPalette(Theme::statusBarActivePalette);
|
containerWidget->setPalette(Theme::statusBarActivePalette);
|
||||||
|
|
||||||
|
auto setGraphicsIndex = [=](int index) {
|
||||||
|
canvasStackedWidget->setCurrentIndex(index);
|
||||||
|
if (0 == index) {
|
||||||
|
containerWidget->setGraphicsWidget(boneGraphicsWidget);
|
||||||
|
boneGraphicsWidget->canvasResized();
|
||||||
|
} else if (1 == index) {
|
||||||
|
containerWidget->setGraphicsWidget(shapeGraphicsWidget);
|
||||||
|
shapeGraphicsWidget->canvasResized();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
m_graphicsContainerWidget = containerWidget;
|
m_graphicsContainerWidget = containerWidget;
|
||||||
|
|
||||||
m_modelRenderWidget = new ModelWidget(containerWidget);
|
m_modelRenderWidget = new ModelWidget(containerWidget);
|
||||||
|
@ -386,6 +413,7 @@ DocumentWindow::DocumentWindow() :
|
||||||
connect(m_modelRenderWidget, &ModelWidget::renderParametersChanged, this, &DocumentWindow::delayedGenerateNormalAndDepthMaps);
|
connect(m_modelRenderWidget, &ModelWidget::renderParametersChanged, this, &DocumentWindow::delayedGenerateNormalAndDepthMaps);
|
||||||
|
|
||||||
m_shapeGraphicsWidget->setModelWidget(m_modelRenderWidget);
|
m_shapeGraphicsWidget->setModelWidget(m_modelRenderWidget);
|
||||||
|
m_boneGraphicsWidget->setModelWidget(m_modelRenderWidget);
|
||||||
containerWidget->setModelWidget(m_modelRenderWidget);
|
containerWidget->setModelWidget(m_modelRenderWidget);
|
||||||
|
|
||||||
setTabPosition(Qt::RightDockWidgetArea, QTabWidget::East);
|
setTabPosition(Qt::RightDockWidgetArea, QTabWidget::East);
|
||||||
|
@ -519,11 +547,13 @@ DocumentWindow::DocumentWindow() :
|
||||||
connect(boneLabel, &StatusBarLabel::clicked, this, [=]() {
|
connect(boneLabel, &StatusBarLabel::clicked, this, [=]() {
|
||||||
boneLabel->setSelected(true);
|
boneLabel->setSelected(true);
|
||||||
shapeLabel->setSelected(false);
|
shapeLabel->setSelected(false);
|
||||||
|
setGraphicsIndex(0);
|
||||||
updateGraphicsViewEditTarget(GraphicsViewEditTarget::Bone);
|
updateGraphicsViewEditTarget(GraphicsViewEditTarget::Bone);
|
||||||
});
|
});
|
||||||
connect(shapeLabel, &StatusBarLabel::clicked, this, [=]() {
|
connect(shapeLabel, &StatusBarLabel::clicked, this, [=]() {
|
||||||
shapeLabel->setSelected(true);
|
shapeLabel->setSelected(true);
|
||||||
boneLabel->setSelected(false);
|
boneLabel->setSelected(false);
|
||||||
|
setGraphicsIndex(1);
|
||||||
updateGraphicsViewEditTarget(GraphicsViewEditTarget::Shape);
|
updateGraphicsViewEditTarget(GraphicsViewEditTarget::Shape);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -808,9 +838,13 @@ DocumentWindow::DocumentWindow() :
|
||||||
|
|
||||||
connect(containerWidget, &GraphicsContainerWidget::containerSizeChanged,
|
connect(containerWidget, &GraphicsContainerWidget::containerSizeChanged,
|
||||||
shapeGraphicsWidget, &SkeletonGraphicsWidget::canvasResized);
|
shapeGraphicsWidget, &SkeletonGraphicsWidget::canvasResized);
|
||||||
|
connect(containerWidget, &GraphicsContainerWidget::containerSizeChanged,
|
||||||
|
boneGraphicsWidget, &SkeletonGraphicsWidget::canvasResized);
|
||||||
|
|
||||||
connect(m_document, &Document::turnaroundChanged,
|
connect(m_document, &Document::turnaroundChanged,
|
||||||
shapeGraphicsWidget, &SkeletonGraphicsWidget::turnaroundChanged);
|
shapeGraphicsWidget, &SkeletonGraphicsWidget::turnaroundChanged);
|
||||||
|
connect(m_boneDocument, &BoneDocument::turnaroundChanged,
|
||||||
|
boneGraphicsWidget, &SkeletonGraphicsWidget::turnaroundChanged);
|
||||||
|
|
||||||
connect(addButton, &QPushButton::clicked, [=]() {
|
connect(addButton, &QPushButton::clicked, [=]() {
|
||||||
m_document->setEditMode(SkeletonDocumentEditMode::Add);
|
m_document->setEditMode(SkeletonDocumentEditMode::Add);
|
||||||
|
@ -2411,7 +2445,7 @@ void DocumentWindow::silhouetteImageReady()
|
||||||
{
|
{
|
||||||
QImage *image = m_silhouetteImageGenerator->takeResultImage();
|
QImage *image = m_silhouetteImageGenerator->takeResultImage();
|
||||||
if (nullptr != image)
|
if (nullptr != image)
|
||||||
image->save("test.png");
|
m_boneDocument->updateTurnaround(*image);
|
||||||
delete image;
|
delete image;
|
||||||
|
|
||||||
delete m_silhouetteImageGenerator;
|
delete m_silhouetteImageGenerator;
|
||||||
|
|
|
@ -25,6 +25,7 @@ class SkeletonGraphicsWidget;
|
||||||
class PartTreeWidget;
|
class PartTreeWidget;
|
||||||
class SpinnableAwesomeButton;
|
class SpinnableAwesomeButton;
|
||||||
class SilhouetteImageGenerator;
|
class SilhouetteImageGenerator;
|
||||||
|
class BoneDocument;
|
||||||
|
|
||||||
class DocumentWindow : public QMainWindow
|
class DocumentWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
|
@ -123,6 +124,7 @@ private:
|
||||||
void createPartSnapshotForFillMesh(const QUuid &fillMeshFileId, Snapshot *snapshot);
|
void createPartSnapshotForFillMesh(const QUuid &fillMeshFileId, Snapshot *snapshot);
|
||||||
private:
|
private:
|
||||||
Document *m_document;
|
Document *m_document;
|
||||||
|
BoneDocument *m_boneDocument;
|
||||||
bool m_firstShow;
|
bool m_firstShow;
|
||||||
bool m_documentSaved;
|
bool m_documentSaved;
|
||||||
PreferencesWidget *m_preferencesWidget;
|
PreferencesWidget *m_preferencesWidget;
|
||||||
|
@ -136,6 +138,7 @@ private:
|
||||||
|
|
||||||
ModelWidget *m_modelRenderWidget;
|
ModelWidget *m_modelRenderWidget;
|
||||||
SkeletonGraphicsWidget *m_shapeGraphicsWidget;
|
SkeletonGraphicsWidget *m_shapeGraphicsWidget;
|
||||||
|
SkeletonGraphicsWidget *m_boneGraphicsWidget;
|
||||||
RigWidget *m_rigWidget;
|
RigWidget *m_rigWidget;
|
||||||
GraphicsContainerWidget *m_graphicsContainerWidget;
|
GraphicsContainerWidget *m_graphicsContainerWidget;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue