From 07e0eeb5ad9f81a62032aa37c0cfef84a9f6ed5c Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 4 Sep 2012 16:25:47 +0200 Subject: the complete beginnings of a material editor, pushing so I can work from my netbook .. --- LayoutStudio.pro | 6 ++++-- lslayoutwindow.cpp | 32 +++++++++++++++++++++++++++++--- lslayoutwindow.h | 11 +++++++++++ lsmaterialeditor.cpp | 6 ++++++ lsmaterialeditor.h | 17 +++++++++++++++++ 5 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 lsmaterialeditor.cpp create mode 100644 lsmaterialeditor.h diff --git a/LayoutStudio.pro b/LayoutStudio.pro index cf9287d..3cc5bc3 100644 --- a/LayoutStudio.pro +++ b/LayoutStudio.pro @@ -40,7 +40,8 @@ SOURCES += main.cpp \ lslayoutwindow.cpp \ lsscenemodel.cpp \ lspaneeditor.cpp \ - lstexcoordseteditor.cpp + lstexcoordseteditor.cpp \ + lsmaterialeditor.cpp HEADERS += lsmainwindow.h \ lsglobals.h \ lyt/packagebase.h \ @@ -79,7 +80,8 @@ HEADERS += lsmainwindow.h \ lslayoutwindow.h \ lsscenemodel.h \ lspaneeditor.h \ - lstexcoordseteditor.h + lstexcoordseteditor.h \ + lsmaterialeditor.h FORMS += RESOURCES += resources.qrc diff --git a/lslayoutwindow.cpp b/lslayoutwindow.cpp index 867b6c8..38e0417 100644 --- a/lslayoutwindow.cpp +++ b/lslayoutwindow.cpp @@ -1,6 +1,7 @@ #include "lslayoutwindow.h" #include "lsscenemodel.h" #include "lspaneeditor.h" +#include "lsmaterialeditor.h" #include "layoutgl/widget.h" #include #include @@ -39,11 +40,9 @@ LSLayoutWindow::LSLayoutWindow(LYTPackageBase *pkg, const QString &layoutName, Q connect(m_heightBox, SIGNAL(valueChanged(double)), SLOT(handleHeightChanged(double))); - QGroupBox *matGroup = new QGroupBox("Materials", this); QGroupBox *grpGroup = new QGroupBox("Groups", this); - sgrid->addWidget(matGroup, 1, 0, 1, 1); - sgrid->addWidget(grpGroup, 1, 1, 1, 1); + sgrid->addWidget(grpGroup, 1, 0, 1, 2); sgrid->setRowStretch(1, 1); m_tabWidget->addTab(w, "Layout"); @@ -85,6 +84,29 @@ LSLayoutWindow::LSLayoutWindow(LYTPackageBase *pkg, const QString &layoutName, Q m_tabWidget->addTab(m_sceneSplitter, "Scene Graph"); + // prepare the materials tab + m_materialSplitter = new QSplitter(this); + + w = new QWidget(this); + QGridLayout *mgrid = new QGridLayout(w); + + m_addMaterialButton = new QPushButton("Add", w); + m_removeMaterialButton = new QPushButton("Remove", w); + m_materialList = new QListView(w); + + mgrid->addWidget(m_materialList, 0, 0, 1, 2); + mgrid->addWidget(m_addMaterialButton, 1, 0, 1, 1); + mgrid->addWidget(m_removeMaterialButton, 1, 1, 1, 1); + + m_materialEditor = new LSMaterialEditor(m_materialSplitter); + + m_materialSplitter->addWidget(w); + m_materialSplitter->addWidget(m_materialEditor); + m_materialSplitter->setCollapsible(1, false); + + m_tabWidget->addTab(m_materialSplitter, "Materials"); + + // get the resource m_layout = new LYTLayout(*m_package, m_layoutName); @@ -138,6 +160,10 @@ void LSLayoutWindow::selectedPaneChanged(const QModelIndex ¤t, const QMode m_paneEditorSwitcher->setCurrentIndex(1); } +void LSLayoutWindow::selectedMaterialChanged(const QModelIndex ¤t, const QModelIndex &previous) { + +} + void LSLayoutWindow::handleWidthChanged(double v) { m_layout->width = v; diff --git a/lslayoutwindow.h b/lslayoutwindow.h index b2c4385..cd3c6ec 100644 --- a/lslayoutwindow.h +++ b/lslayoutwindow.h @@ -13,6 +13,7 @@ #include "lyt/packagebase.h" #include "lyt/layout.h" class LSPaneEditor; +class LSMaterialEditor; class LGLWidget; class LSLayoutWindow : public QMainWindow { @@ -52,10 +53,20 @@ private: bool m_loadingSettings; + // material things + QSplitter *m_materialSplitter; + + QListView *m_materialList; + QPushButton *m_addMaterialButton; + QPushButton *m_removeMaterialButton; + + LSMaterialEditor *m_materialEditor; + private slots: void handleWidthChanged(double v); void handleHeightChanged(double v); void selectedPaneChanged(const QModelIndex ¤t, const QModelIndex &previous); + void selectedMaterialChanged(const QModelIndex ¤t, const QModelIndex &previous); signals: diff --git a/lsmaterialeditor.cpp b/lsmaterialeditor.cpp new file mode 100644 index 0000000..1b32635 --- /dev/null +++ b/lsmaterialeditor.cpp @@ -0,0 +1,6 @@ +#include "lsmaterialeditor.h" + +LSMaterialEditor::LSMaterialEditor(QWidget *parent) : + QWidget(parent) { + +} diff --git a/lsmaterialeditor.h b/lsmaterialeditor.h new file mode 100644 index 0000000..e594acc --- /dev/null +++ b/lsmaterialeditor.h @@ -0,0 +1,17 @@ +#ifndef LSMATERIALEDITOR_H +#define LSMATERIALEDITOR_H + +#include + +class LSMaterialEditor : public QWidget { + Q_OBJECT +public: + explicit LSMaterialEditor(QWidget *parent = 0); + +signals: + +public slots: + +}; + +#endif // LSMATERIALEDITOR_H -- cgit v1.2.3