diff --git a/dust3d.pro b/dust3d.pro index 3ec66bc0..74ed34e8 100644 --- a/dust3d.pro +++ b/dust3d.pro @@ -502,6 +502,9 @@ HEADERS += src/silhouetteimagegenerator.h SOURCES += src/bonedocument.cpp HEADERS += src/bonedocument.h +SOURCES += src/materiallayer.cpp +HEADERS += src/materiallayer.h + SOURCES += src/main.cpp HEADERS += src/version.h diff --git a/src/autosaver.cpp b/src/autosaver.cpp index fecad990..cd650bc7 100644 --- a/src/autosaver.cpp +++ b/src/autosaver.cpp @@ -9,6 +9,7 @@ #include "autosaver.h" #include "documentsaver.h" #include "snapshotxml.h" +#include "document.h" AutoSaver::AutoSaver(Document *document) : m_document(document) diff --git a/src/autosaver.h b/src/autosaver.h index fc5269e5..6956cafb 100644 --- a/src/autosaver.h +++ b/src/autosaver.h @@ -2,8 +2,8 @@ #define DUST3D_AUTO_SAVER_H #include #include -#include "document.h" +class Document; class DocumentSaver; class AutoSaver : public QObject diff --git a/src/bonedocument.cpp b/src/bonedocument.cpp index 965f206c..ef7d9f2d 100644 --- a/src/bonedocument.cpp +++ b/src/bonedocument.cpp @@ -60,3 +60,44 @@ void BoneDocument::updateTurnaround(const QImage &image) turnaround = image; emit turnaroundChanged(); } + +void BoneDocument::setEditMode(SkeletonDocumentEditMode mode) +{ + if (editMode == mode) + return; + + editMode = mode; + emit editModeChanged(); +} + +void BoneDocument::setXlockState(bool locked) +{ + if (xlocked == locked) + return; + xlocked = locked; + emit xlockStateChanged(); +} + +void BoneDocument::setYlockState(bool locked) +{ + if (ylocked == locked) + return; + ylocked = locked; + emit ylockStateChanged(); +} + +void BoneDocument::setZlockState(bool locked) +{ + if (zlocked == locked) + return; + zlocked = locked; + emit zlockStateChanged(); +} + +void BoneDocument::setRadiusLockState(bool locked) +{ + if (radiusLocked == locked) + return; + radiusLocked = locked; + emit radiusLockStateChanged(); +} diff --git a/src/bonedocument.h b/src/bonedocument.h index 51d78e15..46f0608d 100644 --- a/src/bonedocument.h +++ b/src/bonedocument.h @@ -7,6 +7,11 @@ class BoneDocument : public SkeletonDocument Q_OBJECT signals: void turnaroundChanged(); + void editModeChanged(); + void xlockStateChanged(); + void ylockStateChanged(); + void zlockStateChanged(); + void radiusLockStateChanged(); public: BoneDocument(); bool undoable(void) const; @@ -16,10 +21,16 @@ public: bool isNodeEditable(QUuid) const; bool isEdgeEditable(QUuid) const; void copyNodes(std::set nodeIdSet) const; +public slots: void undo(void); void redo(void); void paste(void); void updateTurnaround(const QImage &image); + void setEditMode(SkeletonDocumentEditMode mode); + void setXlockState(bool locked); + void setYlockState(bool locked); + void setZlockState(bool locked); + void setRadiusLockState(bool locked); }; #endif diff --git a/src/document.cpp b/src/document.cpp index 5ed8ebbc..f20849e6 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -44,7 +44,6 @@ Document::Document() : m_meshGenerator(nullptr), m_resultMesh(nullptr), m_paintedMesh(nullptr), - //m_resultMeshCutFaceTransforms(nullptr), m_resultMeshNodesCutFaces(nullptr), m_isMeshGenerationSucceed(true), m_batchChangeRefCount(0), @@ -109,7 +108,6 @@ Document::~Document() { delete m_resultMesh; delete m_paintedMesh; - //delete m_resultMeshCutFaceTransforms; delete m_resultMeshNodesCutFaces; delete m_postProcessedObject; delete textureImage; @@ -292,10 +290,6 @@ void Document::removeEdge(QUuid edgeId) updateLinkedPart(oldPartId, newPartNodeNumMap[0].first); } - for (const auto &partId: newPartIds) { - checkPartGrid(partId); - } - emit skeletonChanged(); } @@ -375,10 +369,6 @@ void Document::removeNode(QUuid nodeId) updateLinkedPart(oldPartId, newPartNodeNumMap[0].first); } - for (const auto &partId: newPartIds) { - checkPartGrid(partId); - } - emit skeletonChanged(); } @@ -444,7 +434,6 @@ QUuid Document::createNode(QUuid nodeId, float x, float y, float z, float radius if (newPartAdded) addPartToComponent(partId, m_currentCanvasComponentId); - checkPartGrid(partId); emit skeletonChanged(); return node.id; @@ -594,36 +583,9 @@ void Document::addEdge(QUuid fromNodeId, QUuid toNodeId) removePart(toPartId); } - checkPartGrid(fromNode->partId); - emit skeletonChanged(); } -void Document::checkPartGrid(QUuid partId) -{ - return; - /* - SkeletonPart *part = (SkeletonPart *)findPart(partId); - if (nullptr == part) - return; - bool isGrid = false; - for (const auto &nodeId: part->nodeIds) { - const SkeletonNode *node = findNode(nodeId); - if (nullptr == node) - continue; - if (node->edgeIds.size() >= 3) { - isGrid = true; - break; - } - } - if (part->gridded == isGrid) - return; - part->gridded = isGrid; - part->dirty = true; - emit partGridStateChanged(partId); - */ -} - void Document::updateLinkedPart(QUuid oldPartId, QUuid newPartId) { for (auto &partIt: partMap) { @@ -1221,10 +1183,6 @@ void Document::toSnapshot(Snapshot *snapshot, const std::set &limitNodeId component["expanded"] = componentIt.second.expanded ? "true" : "false"; component["combineMode"] = CombineModeToString(componentIt.second.combineMode); component["__dirty"] = componentIt.second.dirty ? "true" : "false"; - if (componentIt.second.smoothAllAdjusted()) - component["smoothAll"] = QString::number(componentIt.second.smoothAll); - if (componentIt.second.smoothSeamAdjusted()) - component["smoothSeam"] = QString::number(componentIt.second.smoothSeam); QStringList childIdList; for (const auto &childId: componentIt.second.childrenIds) { childIdList.append(childId.toString()); @@ -1378,7 +1336,6 @@ void Document::createSinglePartFromEdges(const std::vector &nodes, } for (const auto &partIt : newAddedPartIds) { - checkPartGrid(partIt); emit partVisibleStateChanged(partIt); } @@ -1657,12 +1614,6 @@ void Document::addFromSnapshot(const Snapshot &snapshot, enum SnapshotSource sou if (isTrueValueString(valueOfKeyInMapOrEmpty(componentKv.second, "inverse"))) component.combineMode = CombineMode::Inversion; } - const auto &smoothAllIt = componentKv.second.find("smoothAll"); - if (smoothAllIt != componentKv.second.end()) - component.setSmoothAll(smoothAllIt->second.toFloat()); - const auto &smoothSeamIt = componentKv.second.find("smoothSeam"); - if (smoothSeamIt != componentKv.second.end()) - component.setSmoothSeam(smoothSeamIt->second.toFloat()); //qDebug() << "Add component:" << component.id << " old:" << componentKv.first << "name:" << component.name; if ("partId" == linkDataType) { QUuid partId = oldNewIdMap[QUuid(linkData)]; @@ -1731,7 +1682,6 @@ void Document::addFromSnapshot(const Snapshot &snapshot, enum SnapshotSource sou emit skeletonChanged(); for (const auto &partIt : newAddedPartIds) { - checkPartGrid(partIt); emit partVisibleStateChanged(partIt); } @@ -1872,14 +1822,9 @@ void Document::meshReady() delete m_resultMesh; m_resultMesh = resultMesh; - //delete m_resultMeshCutFaceTransforms; - //m_resultMeshCutFaceTransforms = m_meshGenerator->takeCutFaceTransforms(); - delete m_resultMeshNodesCutFaces; m_resultMeshNodesCutFaces = m_meshGenerator->takeNodesCutFaces(); - //addToolToMesh(m_resultMesh); - m_isMeshGenerationSucceed = isSuccessful; delete m_currentObject; @@ -1930,36 +1875,6 @@ void Document::meshReady() } } -//void Document::addToolToMesh(Model *mesh) -//{ -// if (nullptr == mesh) -// return; -// -// if (nullptr == m_resultMeshCutFaceTransforms || -// nullptr == m_resultMeshNodesCutFaces || -// m_resultMeshCutFaceTransforms->empty() || -// m_resultMeshNodesCutFaces->empty()) -// return; -// -// ToolMesh toolMesh; -// for (const auto &transformIt: *m_resultMeshCutFaceTransforms) { -// const auto &nodeId = transformIt.first; -// const auto &transform = transformIt.second; -// qDebug() << "nodeId:" << nodeId; -// for (const auto &cutFaceIt: (*m_resultMeshNodesCutFaces)[nodeId]) { -// const auto &cutFaceId = cutFaceIt.first; -// const auto &cutFace2d = cutFaceIt.second; -// QVector3D position = transform.translation + transform.rotation * (transform.uFactor * cutFace2d.x() + transform.vFactor * cutFace2d.y()); -// qDebug() << "cutFaceId:" << cutFaceId; -// toolMesh.addNode(nodeId.toString() + cutFaceId, position); -// } -// } -// toolMesh.generate(); -// int shaderVertexCount = 0; -// ShaderVertex *shaderVertices = toolMesh.takeShaderVertices(&shaderVertexCount); -// mesh->updateTool(shaderVertices, shaderVertexCount); -//} - bool Document::isPostProcessResultObsolete() const { return m_isPostProcessResultObsolete; @@ -2283,32 +2198,6 @@ void Document::setComponentCombineMode(QUuid componentId, CombineMode combineMod emit skeletonChanged(); } -void Document::setComponentSmoothAll(QUuid componentId, float toSmoothAll) -{ - auto component = componentMap.find(componentId); - if (component == componentMap.end()) { - qDebug() << "Component not found:" << componentId; - return; - } - component->second.setSmoothAll(toSmoothAll); - component->second.dirty = true; - emit componentSmoothAllChanged(componentId); - emit skeletonChanged(); -} - -void Document::setComponentSmoothSeam(QUuid componentId, float toSmoothSeam) -{ - auto component = componentMap.find(componentId); - if (component == componentMap.end()) { - qDebug() << "Component not found:" << componentId; - return; - } - component->second.setSmoothSeam(toSmoothSeam); - component->second.dirty = true; - emit componentSmoothSeamChanged(componentId); - emit skeletonChanged(); -} - void Document::setPartSubdivState(QUuid partId, bool subdived) { auto part = partMap.find(partId); diff --git a/src/document.h b/src/document.h index 155864c0..0a0f2e90 100644 --- a/src/document.h +++ b/src/document.h @@ -26,6 +26,7 @@ #include "paintmode.h" #include "proceduralanimation.h" #include "texturepainter.h" +#include "materiallayer.h" class MaterialPreviewsGenerator; class MotionsGenerator; @@ -218,20 +219,6 @@ private: Model *m_previewMesh = nullptr; }; -class MaterialMap -{ -public: - TextureType forWhat; - QUuid imageId; -}; - -class MaterialLayer -{ -public: - std::vector maps; - float tileScale = 1.0; -}; - class Material { public: @@ -283,8 +270,6 @@ signals: void componentRemoved(QUuid componentId); void componentAdded(QUuid componentId); void componentExpandStateChanged(QUuid componentId); - void componentSmoothAllChanged(QUuid componentId); - void componentSmoothSeamChanged(QUuid componentId); void componentLayerChanged(QUuid componentId); void nodeRemoved(QUuid nodeId); void edgeRemoved(QUuid edgeId); @@ -549,8 +534,6 @@ public slots: void createNewComponentAndMoveThisIn(QUuid componentId); void createNewChildComponent(QUuid parentComponentId); void setComponentExpandState(QUuid componentId, bool expanded); - void setComponentSmoothAll(QUuid componentId, float toSmoothAll); - void setComponentSmoothSeam(QUuid componentId, float toSmoothSeam); void hideOtherComponents(QUuid componentId); void lockOtherComponents(QUuid componentId); void hideAllComponents(); @@ -622,15 +605,12 @@ private: void markAllDirty(); void removeRigResults(); void updateLinkedPart(QUuid oldPartId, QUuid newPartId); - //void addToolToMesh(Model *mesh); bool updateDefaultVariables(const std::map> &defaultVariables); - void checkPartGrid(QUuid partId); private: // need initialize bool m_isResultMeshObsolete; MeshGenerator *m_meshGenerator; Model *m_resultMesh; Model *m_paintedMesh; - //std::map *m_resultMeshCutFaceTransforms; std::map> *m_resultMeshNodesCutFaces; bool m_isMeshGenerationSucceed; int m_batchChangeRefCount; diff --git a/src/documentwindow.cpp b/src/documentwindow.cpp index b2a181a3..375db102 100644 --- a/src/documentwindow.cpp +++ b/src/documentwindow.cpp @@ -55,6 +55,7 @@ #include "silhouetteimagegenerator.h" #include "flowlayout.h" #include "bonedocument.h" +#include "document.h" int DocumentWindow::m_autoRecovered = false; @@ -884,6 +885,22 @@ DocumentWindow::DocumentWindow() : connect(m_document, &Document::editModeChanged, this, [=]() { m_modelRenderWidget->enableMousePicking(SkeletonDocumentEditMode::Paint == m_document->editMode); }); + connect(m_document, &Document::editModeChanged, this, [=]() { + m_boneDocument->setEditMode(m_document->editMode); + }); + + connect(m_document, &Document::xlockStateChanged, this, [=]() { + m_boneDocument->setXlockState(m_document->xlocked); + }); + connect(m_document, &Document::ylockStateChanged, this, [=]() { + m_boneDocument->setYlockState(m_document->ylocked); + }); + connect(m_document, &Document::zlockStateChanged, this, [=]() { + m_boneDocument->setZlockState(m_document->zlocked); + }); + connect(m_document, &Document::radiusLockStateChanged, this, [=]() { + m_boneDocument->setRadiusLockState(m_document->radiusLocked); + }); m_partListDockerVisibleSwitchConnection = connect(m_document, &Document::skeletonChanged, [=]() { if (m_shapeGraphicsWidget->hasItems()) { @@ -894,6 +911,7 @@ DocumentWindow::DocumentWindow() : }); connect(m_document, &Document::editModeChanged, shapeGraphicsWidget, &SkeletonGraphicsWidget::editModeChanged); + connect(m_boneDocument, &BoneDocument::editModeChanged, boneGraphicsWidget, &SkeletonGraphicsWidget::editModeChanged); connect(shapeGraphicsWidget, &SkeletonGraphicsWidget::shortcutToggleWireframe, [=]() { m_modelRenderWidget->toggleWireframe(); @@ -984,8 +1002,6 @@ DocumentWindow::DocumentWindow() : connect(m_partTreeWidget, &PartTreeWidget::createNewChildComponent, m_document, &Document::createNewChildComponent); connect(m_partTreeWidget, &PartTreeWidget::renameComponent, m_document, &Document::renameComponent); connect(m_partTreeWidget, &PartTreeWidget::setComponentExpandState, m_document, &Document::setComponentExpandState); - connect(m_partTreeWidget, &PartTreeWidget::setComponentSmoothAll, m_document, &Document::setComponentSmoothAll); - connect(m_partTreeWidget, &PartTreeWidget::setComponentSmoothSeam, m_document, &Document::setComponentSmoothSeam); connect(m_partTreeWidget, &PartTreeWidget::moveComponent, m_document, &Document::moveComponent); connect(m_partTreeWidget, &PartTreeWidget::removeComponent, m_document, &Document::removeComponent); connect(m_partTreeWidget, &PartTreeWidget::hideOtherComponents, m_document, &Document::hideOtherComponents); @@ -1177,6 +1193,7 @@ void DocumentWindow::toggleRotation() if (nullptr == m_shapeGraphicsWidget) return; m_shapeGraphicsWidget->setRotated(!m_shapeGraphicsWidget->rotated()); + m_boneGraphicsWidget->setRotated(m_shapeGraphicsWidget->rotated()); updateRotationButtonState(); } diff --git a/src/documentwindow.h b/src/documentwindow.h index 69ff8725..7baad362 100644 --- a/src/documentwindow.h +++ b/src/documentwindow.h @@ -10,7 +10,6 @@ #include #include #include -#include "document.h" #include "modelwidget.h" #include "rigwidget.h" #include "bonemark.h" @@ -21,11 +20,13 @@ #include "partpreviewimagesgenerator.h" #include "QtColorWidgets/ColorWheel" +class Document; class SkeletonGraphicsWidget; class PartTreeWidget; class SpinnableAwesomeButton; class SilhouetteImageGenerator; class BoneDocument; +class Snapshot; class DocumentWindow : public QMainWindow { diff --git a/src/fbxfile.cpp b/src/fbxfile.cpp index 7f849b58..e52440af 100644 --- a/src/fbxfile.cpp +++ b/src/fbxfile.cpp @@ -10,6 +10,7 @@ #include "jointnodetree.h" #include "util.h" #include "modelshaderprogram.h" +#include "document.h" using namespace fbx; diff --git a/src/fbxfile.h b/src/fbxfile.h index 40d536d7..333b1815 100644 --- a/src/fbxfile.h +++ b/src/fbxfile.h @@ -7,7 +7,8 @@ #include #include #include "object.h" -#include "document.h" +#include "rig.h" +#include "jointnodetree.h" class FbxFileWriter : public QObject { diff --git a/src/main.cpp b/src/main.cpp index 4a90f537..66e5cd0c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,6 +11,7 @@ #include "documentwindow.h" #include "theme.h" #include "version.h" +#include "document.h" int main(int argc, char ** argv) { diff --git a/src/markiconcreator.h b/src/markiconcreator.h index 4b5fe949..f82ba85b 100644 --- a/src/markiconcreator.h +++ b/src/markiconcreator.h @@ -2,7 +2,7 @@ #define DUST3D_MARK_ICON_CREATOR_H #include #include -#include "document.h" +#include "bonemark.h" class MarkIconCreator { diff --git a/src/materialeditwidget.cpp b/src/materialeditwidget.cpp index 0631fd8f..65caf905 100644 --- a/src/materialeditwidget.cpp +++ b/src/materialeditwidget.cpp @@ -15,6 +15,7 @@ #include "version.h" #include "imageforever.h" #include "util.h" +#include "document.h" ImagePreviewWidget *MaterialEditWidget::createMapButton() { diff --git a/src/materialeditwidget.h b/src/materialeditwidget.h index 7f757bf6..a002db0e 100644 --- a/src/materialeditwidget.h +++ b/src/materialeditwidget.h @@ -4,11 +4,13 @@ #include #include #include -#include "document.h" #include "modelwidget.h" #include "materialpreviewsgenerator.h" #include "imagepreviewwidget.h" #include "floatnumberwidget.h" +#include "materiallayer.h" + +class Document; enum class PopupWidgetType { diff --git a/src/materiallayer.cpp b/src/materiallayer.cpp new file mode 100644 index 00000000..f26bdaba --- /dev/null +++ b/src/materiallayer.cpp @@ -0,0 +1 @@ +#include "materiallayer.h" diff --git a/src/materiallayer.h b/src/materiallayer.h new file mode 100644 index 00000000..af595edd --- /dev/null +++ b/src/materiallayer.h @@ -0,0 +1,21 @@ +#ifndef DUST3D_MATERIAL_LAYER_H +#define DUST3D_MATERIAL_LAYER_H +#include +#include +#include "texturetype.h" + +class MaterialMap +{ +public: + TextureType forWhat; + QUuid imageId; +}; + +class MaterialLayer +{ +public: + std::vector maps; + float tileScale = 1.0; +}; + +#endif diff --git a/src/materiallistwidget.cpp b/src/materiallistwidget.cpp index 955b89ed..9e92e508 100644 --- a/src/materiallistwidget.cpp +++ b/src/materiallistwidget.cpp @@ -5,6 +5,7 @@ #include #include "snapshotxml.h" #include "materiallistwidget.h" +#include "document.h" MaterialListWidget::MaterialListWidget(const Document *document, QWidget *parent) : QTreeWidget(parent), diff --git a/src/materiallistwidget.h b/src/materiallistwidget.h index 2fe312d1..37839442 100644 --- a/src/materiallistwidget.h +++ b/src/materiallistwidget.h @@ -3,9 +3,10 @@ #include #include #include -#include "document.h" #include "materialwidget.h" +class Document; + class MaterialListWidget : public QTreeWidget { Q_OBJECT diff --git a/src/materialmanagewidget.cpp b/src/materialmanagewidget.cpp index ea850ee1..624675ab 100644 --- a/src/materialmanagewidget.cpp +++ b/src/materialmanagewidget.cpp @@ -5,6 +5,7 @@ #include "theme.h" #include "materialeditwidget.h" #include "infolabel.h" +#include "document.h" MaterialManageWidget::MaterialManageWidget(const Document *document, QWidget *parent) : QWidget(parent), diff --git a/src/materialmanagewidget.h b/src/materialmanagewidget.h index 9fed41d2..b3be862e 100644 --- a/src/materialmanagewidget.h +++ b/src/materialmanagewidget.h @@ -1,9 +1,10 @@ #ifndef DUST3D_MATERIAL_MANAGE_WIDGET_H #define DUST3D_MATERIAL_MANAGE_WIDGET_H #include -#include "document.h" #include "materiallistwidget.h" +class Document; + class MaterialManageWidget : public QWidget { Q_OBJECT diff --git a/src/materialpreviewsgenerator.h b/src/materialpreviewsgenerator.h index 4de40c9a..44dfef24 100644 --- a/src/materialpreviewsgenerator.h +++ b/src/materialpreviewsgenerator.h @@ -5,7 +5,7 @@ #include #include #include "model.h" -#include "document.h" +#include "materiallayer.h" class MaterialPreviewsGenerator : public QObject { diff --git a/src/materialwidget.cpp b/src/materialwidget.cpp index 3cfd6518..91f6432f 100644 --- a/src/materialwidget.cpp +++ b/src/materialwidget.cpp @@ -1,5 +1,6 @@ #include #include "materialwidget.h" +#include "document.h" MaterialWidget::MaterialWidget(const Document *document, QUuid materialId) : m_materialId(materialId), diff --git a/src/materialwidget.h b/src/materialwidget.h index c877ac9a..c54500dc 100644 --- a/src/materialwidget.h +++ b/src/materialwidget.h @@ -3,9 +3,11 @@ #include #include #include -#include "document.h" +#include #include "modelwidget.h" +class Document; + class MaterialWidget : public QFrame { Q_OBJECT diff --git a/src/motioneditwidget.cpp b/src/motioneditwidget.cpp index 90484079..9decee91 100644 --- a/src/motioneditwidget.cpp +++ b/src/motioneditwidget.cpp @@ -14,6 +14,7 @@ #include "util.h" #include "version.h" #include "vertebratamovemotionparameterswidget.h" +#include "theme.h" MotionEditWidget::~MotionEditWidget() { diff --git a/src/motioneditwidget.h b/src/motioneditwidget.h index b2d9c8b8..3e10a973 100644 --- a/src/motioneditwidget.h +++ b/src/motioneditwidget.h @@ -5,6 +5,8 @@ #include #include #include +#include +#include #include "rig.h" #include "object.h" diff --git a/src/motionlistwidget.cpp b/src/motionlistwidget.cpp index 2f75811d..6d9bb6f2 100644 --- a/src/motionlistwidget.cpp +++ b/src/motionlistwidget.cpp @@ -5,6 +5,7 @@ #include #include "snapshotxml.h" #include "motionlistwidget.h" +#include "document.h" MotionListWidget::MotionListWidget(const Document *document, QWidget *parent) : QTreeWidget(parent), diff --git a/src/motionlistwidget.h b/src/motionlistwidget.h index 5b914b35..3fb2a8e3 100644 --- a/src/motionlistwidget.h +++ b/src/motionlistwidget.h @@ -3,9 +3,10 @@ #include #include #include -#include "document.h" #include "motionwidget.h" +class Document; + class MotionListWidget : public QTreeWidget { Q_OBJECT diff --git a/src/motionmanagewidget.cpp b/src/motionmanagewidget.cpp index c4fc4074..80b5a1c9 100644 --- a/src/motionmanagewidget.cpp +++ b/src/motionmanagewidget.cpp @@ -5,6 +5,7 @@ #include "theme.h" #include "infolabel.h" #include "motioneditwidget.h" +#include "document.h" MotionManageWidget::MotionManageWidget(const Document *document, QWidget *parent) : QWidget(parent), diff --git a/src/motionmanagewidget.h b/src/motionmanagewidget.h index e92a2a95..34908d00 100644 --- a/src/motionmanagewidget.h +++ b/src/motionmanagewidget.h @@ -1,9 +1,10 @@ #ifndef DUST3D_MOTION_MANAGE_WIDGET_H #define DUST3D_MOTION_MANAGE_WIDGET_H #include -#include "document.h" #include "motionlistwidget.h" +class Document; + class MotionManageWidget : public QWidget { Q_OBJECT diff --git a/src/motionsgenerator.h b/src/motionsgenerator.h index 1431d29e..a088a1be 100644 --- a/src/motionsgenerator.h +++ b/src/motionsgenerator.h @@ -8,7 +8,6 @@ #include "simpleshadermesh.h" #include "rig.h" #include "jointnodetree.h" -#include "document.h" class MotionsGenerator : public QObject { diff --git a/src/motionwidget.cpp b/src/motionwidget.cpp index b61f207f..000fc66f 100644 --- a/src/motionwidget.cpp +++ b/src/motionwidget.cpp @@ -1,5 +1,6 @@ #include #include "motionwidget.h" +#include "document.h" MotionWidget::MotionWidget(const Document *document, QUuid motionId) : m_motionId(motionId), diff --git a/src/motionwidget.h b/src/motionwidget.h index 9674c47b..d2ec1d1b 100644 --- a/src/motionwidget.h +++ b/src/motionwidget.h @@ -3,9 +3,11 @@ #include #include #include -#include "document.h" +#include #include "modelwidget.h" +class Document; + class MotionWidget : public QFrame { Q_OBJECT diff --git a/src/parttreewidget.cpp b/src/parttreewidget.cpp index a9f8a82a..78ea2fe6 100644 --- a/src/parttreewidget.cpp +++ b/src/parttreewidget.cpp @@ -16,6 +16,7 @@ #include "skeletongraphicswidget.h" #include "floatnumberwidget.h" #include "intnumberwidget.h" +#include "document.h" PartTreeWidget::PartTreeWidget(const Document *document, QWidget *parent) : QTreeWidget(parent), @@ -781,78 +782,6 @@ void PartTreeWidget::showContextMenu(const QPoint &pos, bool shorted) } } -QWidget *PartTreeWidget::createSmoothMenuWidget(QUuid componentId) -{ - QWidget *popup = new QWidget; - - const Component *component = m_document->findComponent(componentId); - if (!component) { - qDebug() << "Find component failed:" << componentId; - return popup; - } - - bool showSeamControl = component->linkToPartId.isNull(); - - FloatNumberWidget *smoothAllWidget = new FloatNumberWidget; - smoothAllWidget->setItemName(tr("All")); - smoothAllWidget->setRange(0, 1); - smoothAllWidget->setValue(component->smoothAll); - - connect(smoothAllWidget, &FloatNumberWidget::valueChanged, [=](float value) { - emit setComponentSmoothAll(componentId, value); - emit groupOperationAdded(); - }); - - QPushButton *smoothAllEraser = new QPushButton(QChar(fa::eraser)); - Theme::initAwesomeToolButton(smoothAllEraser); - - connect(smoothAllEraser, &QPushButton::clicked, [=]() { - smoothAllWidget->setValue(0.0); - }); - - FloatNumberWidget *smoothSeamWidget = nullptr; - QPushButton *smoothSeamEraser = nullptr; - - if (showSeamControl) { - smoothSeamWidget = new FloatNumberWidget; - smoothSeamWidget->setItemName(tr("Seam")); - smoothSeamWidget->setRange(0, 1); - smoothSeamWidget->setValue(component->smoothSeam); - - connect(smoothSeamWidget, &FloatNumberWidget::valueChanged, [=](float value) { - emit setComponentSmoothSeam(componentId, value); - emit groupOperationAdded(); - }); - - smoothSeamEraser = new QPushButton(QChar(fa::eraser)); - Theme::initAwesomeToolButton(smoothSeamEraser); - - connect(smoothSeamEraser, &QPushButton::clicked, [=]() { - smoothSeamWidget->setValue(0.0); - }); - } - - QHBoxLayout *smoothSeamLayout = nullptr; - - QVBoxLayout *layout = new QVBoxLayout; - QHBoxLayout *smoothAllLayout = new QHBoxLayout; - if (showSeamControl) - smoothSeamLayout = new QHBoxLayout; - smoothAllLayout->addWidget(smoothAllEraser); - smoothAllLayout->addWidget(smoothAllWidget); - if (showSeamControl) { - smoothSeamLayout->addWidget(smoothSeamEraser); - smoothSeamLayout->addWidget(smoothSeamWidget); - } - layout->addLayout(smoothAllLayout); - if (showSeamControl) - layout->addLayout(smoothSeamLayout); - - popup->setLayout(layout); - - return popup; -} - QTreeWidgetItem *PartTreeWidget::findComponentItem(QUuid componentId) { auto findResult = m_componentItemMap.find(componentId); diff --git a/src/parttreewidget.h b/src/parttreewidget.h index 1a60df09..64a635ff 100644 --- a/src/parttreewidget.h +++ b/src/parttreewidget.h @@ -5,7 +5,12 @@ #include #include #include -#include "document.h" +#include +#include "parttarget.h" +#include "partbase.h" +#include "combinemode.h" + +class Document; class PartTreeWidget : public QTreeWidget { @@ -21,8 +26,6 @@ signals: void createNewChildComponent(QUuid parentComponentId); void renameComponent(QUuid componentId, QString name); void setComponentExpandState(QUuid componentId, bool expanded); - void setComponentSmoothAll(QUuid componentId, float toSmoothAll); - void setComponentSmoothSeam(QUuid componentId, float toSmoothSeam); void setPartTarget(QUuid partId, PartTarget target); void setPartBase(QUuid partId, PartBase base); void moveComponent(QUuid componentId, QUuid toParentId); @@ -93,7 +96,6 @@ private: void addComponentChildrenToItem(QUuid componentId, QTreeWidgetItem *parentItem); void deleteItemChildren(QTreeWidgetItem *item); void selectComponent(QUuid componentId, bool multiple=false); - QWidget *createSmoothMenuWidget(QUuid componentId); void updateComponentSelectState(QUuid componentId, bool selected); void updateComponentAppearance(QUuid componentId); bool isComponentSelected(QUuid componentId); diff --git a/src/partwidget.cpp b/src/partwidget.cpp index 23823567..9bab6861 100644 --- a/src/partwidget.cpp +++ b/src/partwidget.cpp @@ -22,6 +22,7 @@ #include "flowlayout.h" #include "imageforever.h" #include "imagepreviewwidget.h" +#include "document.h" PartWidget::PartWidget(const Document *document, QUuid partId) : m_document(document), diff --git a/src/partwidget.h b/src/partwidget.h index 69e7df8f..79f73b02 100644 --- a/src/partwidget.h +++ b/src/partwidget.h @@ -3,8 +3,10 @@ #include #include #include -#include "document.h" #include "modelwidget.h" +#include "cutface.h" + +class Document; class PartWidget : public QWidget { diff --git a/src/preferenceswidget.cpp b/src/preferenceswidget.cpp index 7b762ed4..a9ee3257 100644 --- a/src/preferenceswidget.cpp +++ b/src/preferenceswidget.cpp @@ -7,6 +7,7 @@ #include "util.h" #include "preferences.h" #include "theme.h" +#include "document.h" PreferencesWidget::PreferencesWidget(const Document *document, QWidget *parent) : QDialog(parent), diff --git a/src/preferenceswidget.h b/src/preferenceswidget.h index 801a8948..09ddf8b3 100644 --- a/src/preferenceswidget.h +++ b/src/preferenceswidget.h @@ -1,7 +1,8 @@ #ifndef DUST3D_PREFERENCES_WIDGET_H #define DUST3D_PREFERENCES_WIDGET_H #include -#include "document.h" + +class Document; class PreferencesWidget : public QDialog { diff --git a/src/rigwidget.cpp b/src/rigwidget.cpp index 06e52d85..aaef8b38 100644 --- a/src/rigwidget.cpp +++ b/src/rigwidget.cpp @@ -5,6 +5,7 @@ #include "rigtype.h" #include "infolabel.h" #include "theme.h" +#include "document.h" RigWidget::RigWidget(const Document *document, QWidget *parent) : QWidget(parent), diff --git a/src/rigwidget.h b/src/rigwidget.h index d5eee5e8..138ef06a 100644 --- a/src/rigwidget.h +++ b/src/rigwidget.h @@ -3,11 +3,12 @@ #include #include #include -#include "document.h" #include "rigtype.h" #include "modelwidget.h" #include "infolabel.h" +class Document; + class RigWidget : public QWidget { Q_OBJECT diff --git a/src/scriptvariableswidget.cpp b/src/scriptvariableswidget.cpp index 17206de3..0a9d653a 100755 --- a/src/scriptvariableswidget.cpp +++ b/src/scriptvariableswidget.cpp @@ -10,6 +10,7 @@ #include "theme.h" #include "floatnumberwidget.h" #include "intnumberwidget.h" +#include "document.h" ScriptVariablesWidget::ScriptVariablesWidget(const Document *document, QWidget *parent) : diff --git a/src/scriptvariableswidget.h b/src/scriptvariableswidget.h index a8084d87..0c0b7191 100755 --- a/src/scriptvariableswidget.h +++ b/src/scriptvariableswidget.h @@ -4,7 +4,8 @@ #include #include #include -#include "document.h" + +class Document; class ScriptVariablesWidget : public QScrollArea { diff --git a/src/scriptwidget.cpp b/src/scriptwidget.cpp index adbeddde..9a5446ce 100755 --- a/src/scriptwidget.cpp +++ b/src/scriptwidget.cpp @@ -3,6 +3,7 @@ #include "scriptwidget.h" #include "scripteditwidget.h" #include "theme.h" +#include "document.h" ScriptWidget::ScriptWidget(const Document *document, QWidget *parent) : QWidget(parent), diff --git a/src/scriptwidget.h b/src/scriptwidget.h index b8e77738..7ea00d16 100755 --- a/src/scriptwidget.h +++ b/src/scriptwidget.h @@ -2,9 +2,10 @@ #define SCRIPT_WIDGET_H #include #include -#include "document.h" #include "scriptvariableswidget.h" +class Document; + class ScriptWidget : public QWidget { Q_OBJECT diff --git a/src/skeletondocument.h b/src/skeletondocument.h index c30ceb77..af1b0988 100644 --- a/src/skeletondocument.h +++ b/src/skeletondocument.h @@ -1,4 +1,3 @@ - #ifndef DUST3D_SKELETON_DOCUMENT_H #define DUST3D_SKELETON_DOCUMENT_H #include