diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj index a8677f3..2ca822f 100644 --- a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj +++ b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj @@ -105,8 +105,6 @@ - - @@ -164,8 +162,6 @@ - - diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters index 180c9a0..f6b745d 100644 --- a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters +++ b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters @@ -173,13 +173,6 @@ Source Files\Editor\third-party modules - Source Files\Editor\third-party modules - - - Source Files - - - Source Files Source Files\Renderer\Painting @@ -213,12 +206,6 @@ Header Files\Editor - - Header Files - - - Header Files - @@ -346,6 +333,9 @@ Header Files\Editor + + Header Files\Editor + Header Files\Renderer\Painting @@ -370,13 +360,6 @@ Header Files\Renderer\Painting - - Header Files\Editor - Header Files\Editor\third-party modules\qquick - - - Header Files\Editor\util - diff --git a/ArchitectureColoredPainting/EditorWidget.ui b/ArchitectureColoredPainting/EditorWidget.ui index 38ca891..7f00648 100644 --- a/ArchitectureColoredPainting/EditorWidget.ui +++ b/ArchitectureColoredPainting/EditorWidget.ui @@ -27,60 +27,18 @@ 0 - - - - - - 纹理编辑 - - - Qt::AlignCenter - - - - - - - - - - - - - - - - - - 0 - - - - Layer - - - - - Element - - - - - - - - Qt::CustomContextMenu - - - - - - - - - - + + + + + 纹理编辑 + + + + + + + @@ -91,17 +49,6 @@ QOpenGLWidget
PreviewWindow.h
- - LayerTreeWidget - QTreeWidget -
LayerTreeWidget.h
-
- - InfoDisplayWidget - QWidget -
InfoDisplayWidget.h
- 1 -
diff --git a/ArchitectureColoredPainting/Shaders/painting.comp b/ArchitectureColoredPainting/Shaders/painting.comp index 34e5a91..7f27e23 100644 --- a/ArchitectureColoredPainting/Shaders/painting.comp +++ b/ArchitectureColoredPainting/Shaders/painting.comp @@ -876,49 +876,6 @@ void drawLine(in float d, in uint styleIndex, out vec4 elementColor, out vec2 me } } -void drawLine(in float d, in uint styleIndex, out vec4 elementColor, out vec2 metallicRoughness) -{ - elementColor = vec4(1); - metallicRoughness = vec2(0.8); - switch(int(elementData[styleIndex+3])) - { - case 0: - { - elementColor = vec4(elementData[styleIndex+7],elementData[styleIndex+8],elementData[styleIndex+9],1); - metallicRoughness = vec2(elementData[styleIndex+10],elementData[styleIndex+11]); - break; - } - case 1: - { - elementColor = vec4(mix(vec3(0), vec3(1), d), 1); - metallicRoughness = vec2(0,0.8); - break; - } - case 2: - { - float levels[] = {0.25,0.5,0.75}; - vec3 colors[] = {vec3(1,0,0), vec3(0,1,0), vec3(0,0,1), vec3(1,1,0)}; - int i = 0; - while(i<3) - { - if(d(tabWidget->widget(0)); - elementInfoDisplayWidget = dynamic_cast(tabWidget->widget(1)); - connect(treeWidget, &LayerTreeWidget::displayLayerChange, this, &EditorWidget::onLayerChange); - connect(layerInfoDisplayWidget, &InfoDisplayWidget::requireRefreshPreview, this, - &EditorWidget::triggerRefreshPreview); - // &EditorWidget::triggerRefreshPreview); - // test + qDebug() << "123"; + // test QFile settingFile; settingFile.setFileName("../data.json"); settingFile.open(QFile::ReadOnly); @@ -28,10 +19,6 @@ EditorWidget::EditorWidget(QWidget *parent) : QWidget(parent) elementManager = new ElementManager(source); layerManager = new LayerManager(source, elementManager); previewWindow->initialize(layerManager); - if (layerManager->getRoot() != nullptr) - { - treeWidget->addTopLevelItem(layerManager->getRoot()->qTreeItem); - } } EditorWidget::~EditorWidget() @@ -41,16 +28,3 @@ EditorWidget::~EditorWidget() void EditorWidget::paintEvent(QPaintEvent *event) { } - -void EditorWidget::onLayerChange(LayerWrapper *layer) -{ - displayLayer = layer; - // TODO : notify InfoDisplayWidget and update - dynamic_cast(tabWidget->widget(0))->setLayer(layer); - this->update(); -} - -void EditorWidget::triggerRefreshPreview() -{ - previewWindow->update(); -} diff --git a/ArchitectureColoredPainting/src/Editor/EditorWidget.h b/ArchitectureColoredPainting/src/Editor/EditorWidget.h index 3e7a3f5..14ce226 100644 --- a/ArchitectureColoredPainting/src/Editor/EditorWidget.h +++ b/ArchitectureColoredPainting/src/Editor/EditorWidget.h @@ -1,38 +1,24 @@ #pragma once #include "ElementManager.h" -#include "InfoDisplayWidget.h" #include "LayerManager.h" -#include "LayerTreeWidget.h" #include "PreviewWindow.h" #include "ui_EditorWidget.h" #include -#include #include + class EditorWidget : public QWidget { Q_OBJECT private: - // DATA PART + Ui::EditorWidgetClass ui; PreviewWindow *previewWindow; ElementManager *elementManager; LayerManager *layerManager; - // QT GUI PART - Ui::EditorWidgetClass ui; - LayerTreeWidget *treeWidget; - QTabWidget *tabWidget; - InfoDisplayWidget *layerInfoDisplayWidget, *elementInfoDisplayWidget; - // QT DATA PART - LayerWrapper *displayLayer; - GraphicElement *displayElement; public: EditorWidget(QWidget *parent = nullptr); ~EditorWidget(); void paintEvent(QPaintEvent *event) override; - - private slots: - void onLayerChange(LayerWrapper *layer); - void triggerRefreshPreview(); }; diff --git a/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp b/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp index fd1078f..567ccc1 100644 --- a/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp +++ b/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp @@ -11,14 +11,12 @@ void SimpleElement::loadSvgFile(const QString& filePath) // TODO ʽ SvgFileLoader loader; loader.loadSvgFile(filePath, painterPath); - qDebug() << "load svg file success "<drawPath(root->getCache()); @@ -61,11 +57,3 @@ bool LayerManager::changeParent(FolderLayerWrapper *newParent) const selectedLayers[0]->setParent(newParent); return true; } -void LayerManager::addLayer(LayerWrapper *layer) -{ - layerSet.insert(layer); -} -void LayerManager::removeLayer(LayerWrapper *layer) -{ - layerSet.erase(layer); -} diff --git a/ArchitectureColoredPainting/src/Editor/LayerManager.h b/ArchitectureColoredPainting/src/Editor/LayerManager.h index a3a9742..370861a 100644 --- a/ArchitectureColoredPainting/src/Editor/LayerManager.h +++ b/ArchitectureColoredPainting/src/Editor/LayerManager.h @@ -3,11 +3,9 @@ #include "LayerWrapper.h" #include #include -#include #include #include using std::pair; -using std::set; using std::vector; class ElementManager; class LayerWrapper; @@ -23,13 +21,8 @@ class LayerManager LayerPtrs involvedLeafLayersCache; bool singleSelectedCheck() const; bool multipleSelectedCheck() const; - set layerSet; public: - void addLayer(LayerWrapper *layer); - void removeLayer(LayerWrapper *layer); - LayerWrapper *getRoot() const; - LayerManager() = default; LayerManager(QJsonObject source, ElementManager *elementManager); void paint(QPainter *painter) const; bool rename(QString newName) const; diff --git a/ArchitectureColoredPainting/src/Editor/LayerWrapper.cpp b/ArchitectureColoredPainting/src/Editor/LayerWrapper.cpp index e06bc7a..96ea1af 100644 --- a/ArchitectureColoredPainting/src/Editor/LayerWrapper.cpp +++ b/ArchitectureColoredPainting/src/Editor/LayerWrapper.cpp @@ -33,23 +33,15 @@ LayerWrapper::LayerWrapper(QJsonObject json, LayerWrapper *parent) { this->parent = shared_ptr(parent); auto transformJson = json.value("transform").toObject(); - property.name = json.value("name").toString(); - property.offset = {transformJson.value("offset").toObject().value("x").toDouble(), - transformJson.value("offset").toObject().value("y").toDouble()}; - property.scale = {transformJson.value("scale").toObject().value("x").toDouble(), - transformJson.value("scale").toObject().value("y").toDouble()}; - property.rotation = {transformJson.value("rotation").toDouble()}; - qTreeItem = new QTreeWidgetItem(); - qTreeItem->setText(0, property.name); - if (parent != nullptr) - parent->qTreeItem->addChild(qTreeItem); - qTreeItem->setData(0, Qt::UserRole, QVariant::fromValue(this)); + property.offset = { transformJson.value("offset").toObject().value("x").toDouble(), transformJson.value("offset").toObject().value("y").toDouble() }; + property.scale = { transformJson.value("scale").toObject().value("x").toDouble(), transformJson.value("scale").toObject().value("y").toDouble() }; + property.rotation = { transformJson.value("rotation").toDouble()}; } FolderLayerWrapper::FolderLayerWrapper(QJsonObject json, ElementManager *elementManager, LayerWrapper *parent) : LayerWrapper(json, parent) { - qDebug() << json.value("name").toString() << " " << this; + qDebug() << json.value("name").toString()<<" "<getPaintObject()); } LayerWrapper::refresh(); @@ -122,12 +113,3 @@ void FolderLayerWrapper::removeAllChild() { children.clear(); } - -namespace LayerEvent -{ - -static void onDoubleClick(QTreeWidgetItem *qItem, LayerWrapper *layerWrapper) -{ -} - -} // namespace LayerEvent diff --git a/ArchitectureColoredPainting/src/Editor/LayerWrapper.h b/ArchitectureColoredPainting/src/Editor/LayerWrapper.h index b36fb74..0aefcc0 100644 --- a/ArchitectureColoredPainting/src/Editor/LayerWrapper.h +++ b/ArchitectureColoredPainting/src/Editor/LayerWrapper.h @@ -7,9 +7,7 @@ #include #include #include -#include #include -#include #include #include using std::shared_ptr; @@ -21,7 +19,6 @@ class ElementManager; class LayerWrapper { - protected: shared_ptr parent; QPointF referencePoint; @@ -29,7 +26,6 @@ class LayerWrapper QPainterPath cache; public: - QTreeWidgetItem *qTreeItem; struct SimpleProperty { QString name = ""; @@ -46,11 +42,6 @@ class LayerWrapper LayerWrapper *getParent() const; // invoke by manager, then invoke parent's applyStyles LayerWrapper(QJsonObject json, LayerWrapper *parent); LayerWrapper() = default; - // TODO : export Function - // virtual LayerWrapper *addChild() = 0; // Leaf Child Only - // virtual LayerWrapper *addParent() = 0; // Folder Parent Only - // virtual void deleteSelf() const = 0; - // virtual void deleteAll() const = 0; }; class FolderLayerWrapper : public LayerWrapper @@ -77,5 +68,3 @@ class LeafLayerWrapper : public LayerWrapper LeafLayerWrapper() = default; LeafLayerWrapper(QJsonObject json, ElementManager *elementManager, LayerWrapper *parent); }; - -Q_DECLARE_METATYPE(LayerWrapper *)