diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/CMakeLists.txt index 993642633..36a31f449 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/CMakeLists.txt @@ -18,9 +18,11 @@ SET(OVQT_PLUGIN_MATERIAL_EDITOR_HDR material_properties.h material_property_editor.h material_widget.h + material_splitter.h render_passes.h shader_editor.h shader_widget.h + prop_browser_ctrl.h ) SET(OVQT_PLUGIN_MATERIAL_EDITOR_UIS @@ -56,6 +58,7 @@ ADD_LIBRARY(ovqt_plugin_material_editor MODULE ${SRC} TARGET_LINK_LIBRARIES( ovqt_plugin_material_editor ovqt_plugin_core + qt_property_browser nelmisc nel3d ${QT_LIBRARIES} diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/doc/material_editor.uml b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/doc/material_editor.uml new file mode 100644 index 000000000..81585cd55 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/doc/material_editor.uml @@ -0,0 +1,2507 @@ + + + + + + + 0.34 + + + + + + UML 1.4 + false + false + true + false + false + false + false + true + false + true + 1 + true + Dialog + 12 + 0 + Class Diagram + + + + + + + + + + + + + + UML 1.4 + + + GoodPractices + + + CodeGeneration + + + + + ArgoUML (using Netbeans XMI Writer version 1.0) + 0.34(6) revised on $Date: 2010-01-11 22:20:14 +0100 (Mon, 11 Jan 2010) $ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MaterialEditorWindow + + + + + + + + + + + + + + + + + + + + + + + + + + + CNel3DInterface + + + + + + + + + + + + + + + + + + + + + + + + + + + QtTreePropertyWindow + + + + + + + + + + + + + + + + + + + + + + + + + + + CPropBrowserCtrl + + + + + + + + + + + + + + + + + + + + + + + + + + + MaterialWidget + + + + + + + + + + + + + + + + + + + + + + + + + + + ShaderWidget + + + + + + + + + + + + + + + + + + + + + + + + + + + RenderPassesWidget + + + + + + + + + + + + + + + + + + + + + + + + sourcePortFig="Fig0" + destPortFig="Fig5" + sourceFigNode="Fig0" + destFigNode="Fig5" + + + + + + + + + + + + + + sourcePortFig="Fig0" + destPortFig="Fig4" + sourceFigNode="Fig0" + destFigNode="Fig4" + + + + + + + + + + + + + + sourcePortFig="Fig0" + destPortFig="Fig6" + sourceFigNode="Fig0" + destFigNode="Fig6" + + + + + + + + + + + + + + sourcePortFig="Fig0" + destPortFig="Fig1" + sourceFigNode="Fig0" + destFigNode="Fig1" + + + + + + + + + + + + + + sourcePortFig="Fig3" + destPortFig="Fig2" + sourceFigNode="Fig3" + destFigNode="Fig2" + + + + + + + + + + + + + + + + + CMaterialObserver + + + + + + + + + + + + + + + + + + + + + + + + sourcePortFig="Fig6" + destPortFig="Fig12" + sourceFigNode="Fig6" + destFigNode="Fig12" + + + + + + + + + + + + + + sourcePortFig="Fig6" + destPortFig="Fig1" + sourceFigNode="Fig6" + destFigNode="Fig1" + + + + + + + + + + + + + + sourcePortFig="Fig4" + destPortFig="Fig1" + sourceFigNode="Fig4" + destFigNode="Fig1" + + + + + + + + + + + + + + + + + MatPropWidget + + + + + + + + + + + + + + + + + + + + + + + + sourcePortFig="Fig4" + destPortFig="Fig16" + sourceFigNode="Fig4" + destFigNode="Fig16" + + + + + + + + + + + + + + + + + MaterialSplitter + + + + + + + + + + + + + + + + + + + + + + + + sourcePortFig="Fig0" + destPortFig="Fig18" + sourceFigNode="Fig0" + destFigNode="Fig18" + + + + + + + + + + + + + + sourcePortFig="Fig18" + destPortFig="Fig2" + sourceFigNode="Fig18" + destFigNode="Fig2" + + + + + + + + + + + + + + sourcePortFig="Fig18" + destPortFig="Fig3" + sourceFigNode="Fig18" + destFigNode="Fig3" + + + + + + + + + + + + + + sourcePortFig="Fig18" + destPortFig="Fig4" + sourceFigNode="Fig18" + destFigNode="Fig4" + + + + + + + + + + + + + + sourcePortFig="Fig18.0" + destPortFig="Fig12" + sourceFigNode="Fig18" + destFigNode="Fig12" + + + + + + + + + + + + + + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp index c494105b6..b37ff97dd 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp @@ -16,7 +16,7 @@ #include "material_editor_window.h" #include "material_editor_constants.h" -#include "material_widget.h" +#include "material_splitter.h" #include "shader_widget.h" #include "render_passes.h" #include "nel3d_interface.h" @@ -28,23 +28,28 @@ #include +#include #include #include #include +#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h" + namespace MaterialEditor { MaterialEditorWindow::MaterialEditorWindow(QWidget *parent) : QMainWindow(parent) { m_ui.setupUi(this); + nl3dIface = new CNel3DInterface(); - materialWidget = new MaterialWidget(); shaderWidget = new ShaderWidget(); + materialSplitter = new MaterialSplitter(); + materialSplitter->setNel3DIface( nl3dIface ); passesWidget = new RenderPassesWidget(); + passesWidget->setMaterialObserver( materialSplitter ); passesWidget->setNel3dIface( nl3dIface ); - materialWidget->setNel3DIface( nl3dIface ); - + createMenus(); createDockWidgets(); } @@ -74,7 +79,7 @@ namespace MaterialEditor void MaterialEditorWindow::onNewMaterialClicked() { nl3dIface->newMaterial(); - materialWidget->onNewMaterial(); + materialSplitter->onNewMaterial(); } void MaterialEditorWindow::onOpenMaterialClicked() @@ -100,7 +105,7 @@ namespace MaterialEditor ); } - materialWidget->onMaterialLoaded(); + materialSplitter->onMaterialLoaded(); } void MaterialEditorWindow::onSaveMaterialClicked() @@ -176,10 +181,8 @@ namespace MaterialEditor void MaterialEditorWindow::createDockWidgets() { QDockWidget *dock = new QDockWidget( tr( "Material" ), this ); - dock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); - - passesWidget->setMaterialObserver( materialWidget ); - dock->setWidget( materialWidget ); + dock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); + dock->setWidget( materialSplitter ); addDockWidget( Qt::RightDockWidgetArea, dock ); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h index f032863b8..534f7fca4 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h @@ -25,7 +25,7 @@ namespace MaterialEditor class ShaderWidget; class RenderPassesWidget; class CNel3DInterface; - class MaterialWidget; + class MaterialSplitter; class MaterialEditorWindow: public QMainWindow { @@ -51,7 +51,7 @@ private: ShaderWidget *shaderWidget; RenderPassesWidget *passesWidget; - MaterialWidget *materialWidget; + MaterialSplitter *materialSplitter; Ui::MaterialEditorWindow m_ui; }; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.cpp new file mode 100644 index 000000000..6ba64a505 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.cpp @@ -0,0 +1,95 @@ +// Object Viewer Qt Material Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#include "material_splitter.h" +#include "nel3d_interface.h" +#include "material_widget.h" +#include "prop_browser_ctrl.h" +#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h" + +namespace MaterialEditor +{ + MaterialSplitter::MaterialSplitter( QWidget *parent ) : + QSplitter( parent ) + { + materialWidget = new MaterialWidget(); + browserCtrl = new CPropBrowserCtrl(); + browser = new QtTreePropertyBrowser(); + browserCtrl->setBrowser( browser ); + + setup(); + } + + MaterialSplitter::~MaterialSplitter() + { + delete browserCtrl; + browserCtrl = NULL; + nl3dIface = NULL; + materialWidget = NULL; + browser = NULL; + } + + void MaterialSplitter::setup() + { + setOrientation( Qt::Vertical ); + addWidget( materialWidget ); + addWidget( browser ); + } + + void MaterialSplitter::setNel3DIface( CNel3DInterface *iface ) + { + nl3dIface = iface; + materialWidget->setNel3DIface( iface ); + browserCtrl->setNel3DIface( iface ); + } + + void MaterialSplitter::onNewMaterial() + { + materialWidget->onNewMaterial(); + } + + void MaterialSplitter::onMaterialLoaded() + { + materialWidget->onMaterialLoaded(); + } + + void MaterialSplitter::onPassAdded( const char *name ) + { + materialWidget->onPassAdded( name ); + } + + void MaterialSplitter::onPassRemoved( const char *name ) + { + materialWidget->onPassRemoved( name ); + } + + void MaterialSplitter::onPassMovedUp( const char *name ) + { + materialWidget->onPassMovedUp( name ); + } + + void MaterialSplitter::onPassMovedDown( const char *name ) + { + materialWidget->onPassMovedDown( name ); + } + + void MaterialSplitter::onPassRenamed( const char *from, const char *to ) + { + materialWidget->onPassRenamed( from, to ); + } +} + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.h new file mode 100644 index 000000000..4d0e219e5 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_splitter.h @@ -0,0 +1,59 @@ +// Object Viewer Qt Material Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#ifndef MATERIAL_SPLITTER_H +#define MATERIAL_SPLITTER_H + +#include +#include "material_observer.h" + +class QtTreePropertyBrowser; + +namespace MaterialEditor +{ + class CNel3DInterface; + class MaterialWidget; + class CPropBrowserCtrl; + + class MaterialSplitter : public QSplitter, public CMaterialObserver + { + Q_OBJECT + public: + MaterialSplitter( QWidget *parent = NULL ); + ~MaterialSplitter(); + + void setup(); + + void setNel3DIface( CNel3DInterface *iface ); + + void onNewMaterial(); + void onMaterialLoaded(); + void onPassAdded( const char *name ); + void onPassRemoved( const char *name ); + void onPassMovedUp( const char *name ); + void onPassMovedDown( const char *name ); + void onPassRenamed( const char *from, const char *to ); + + private: + CNel3DInterface *nl3dIface; + MaterialWidget *materialWidget; + CPropBrowserCtrl *browserCtrl; + QtTreePropertyBrowser *browser; + }; +} + +#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.ui index 9100c40a6..8e0229798 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.ui @@ -6,22 +6,22 @@ 0 0 - 292 - 696 + 338 + 139 Material - - + + Pass - + @@ -44,14 +44,14 @@ - + Shader - + @@ -71,7 +71,7 @@ - + Qt::Vertical @@ -79,7 +79,7 @@ 20 - 749 + 18 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.cpp new file mode 100644 index 000000000..57e985a38 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.cpp @@ -0,0 +1,50 @@ +// Object Viewer Qt Material Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#include "prop_browser_ctrl.h" +#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h" +#include "nel3d_interface.h" + +namespace MaterialEditor +{ + CPropBrowserCtrl::CPropBrowserCtrl( QObject *parent ) : + QObject( parent ) + { + browser = NULL; + nel3dIface = NULL; + } + + CPropBrowserCtrl::~CPropBrowserCtrl() + { + } + + void CPropBrowserCtrl::setBrowser( QtTreePropertyBrowser *b ) + { + browser = b; + } + + void CPropBrowserCtrl::setNel3DIface( CNel3DInterface *iface ) + { + nel3dIface = iface; + } + + void CPropBrowserCtrl::setupConnections() + { + + } +} + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.h new file mode 100644 index 000000000..f345380f2 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.h @@ -0,0 +1,45 @@ +// Object Viewer Qt Material Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#ifndef PROP_BROWSER_CTRL_H +#define PROP_BROWSER_CTRL_H + +#include + +class QtTreePropertyBrowser; + +namespace MaterialEditor +{ + class CNel3DInterface; + + class CPropBrowserCtrl : public QObject + { + Q_OBJECT + public: + CPropBrowserCtrl( QObject *parent = NULL ); + ~CPropBrowserCtrl(); + void setBrowser( QtTreePropertyBrowser *b ); + void setNel3DIface( CNel3DInterface *iface ); + void setupConnections(); + + private: + QtTreePropertyBrowser *browser; + CNel3DInterface *nel3dIface; + }; +} + +#endif