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 51b30e6fe..993642633 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 @@ -20,6 +20,7 @@ SET(OVQT_PLUGIN_MATERIAL_EDITOR_HDR material_widget.h render_passes.h shader_editor.h + shader_widget.h ) SET(OVQT_PLUGIN_MATERIAL_EDITOR_UIS @@ -29,6 +30,7 @@ SET(OVQT_PLUGIN_MATERIAL_EDITOR_UIS material_widget.ui render_passes.ui shader_editor.ui + shader_widget.ui ) SET(QT_USE_QTGUI TRUE) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.cpp index 3bc3185a8..4941b1ae6 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.cpp @@ -29,6 +29,7 @@ namespace MaterialEditor void MaterialEditorContext::open() { + m_materialEditorWindow->onOpenClicked(); } void MaterialEditorContext::newDocument() 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 75add54aa..d691ed445 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 @@ -17,6 +17,7 @@ #include "material_editor_window.h" #include "material_editor_constants.h" #include "material_widget.h" +#include "shader_widget.h" #include "material_properties.h" #include "../core/icore.h" @@ -27,6 +28,7 @@ #include #include +#include namespace MaterialEditor { @@ -34,6 +36,7 @@ namespace MaterialEditor QMainWindow(parent) { m_ui.setupUi(this); + shaderWidget = new ShaderWidget(); matPropWidget = new MatPropWidget(); createMenus(); createDockWidgets(); @@ -41,14 +44,57 @@ namespace MaterialEditor MaterialEditorWindow::~MaterialEditorWindow() { + delete shaderWidget; + shaderWidget = NULL; delete matPropWidget; matPropWidget = NULL; } + void MaterialEditorWindow::onOpenClicked() + { + QString fn = QFileDialog::getOpenFileName( + this, + tr( "Open model" ), + "/", + tr( "Shape files ( *.shape )" ) + ); + + + } + + void MaterialEditorWindow::onNewMaterialClicked() + { + } + + void MaterialEditorWindow::onOpenMaterialClicked() + { + QString fn = QFileDialog::getOpenFileName( + this, + tr( "Open material" ), + "/", + tr( "Material files ( *.nelmat )" ) + ); + } + + void MaterialEditorWindow::onSaveMaterialClicked() + { + QString fn = QFileDialog::getSaveFileName( + this, + tr( "Save material" ), + "/", + tr( "Material files ( *.nelmat )" ) + ); + } + void MaterialEditorWindow::onEditMaterialClicked() { matPropWidget->show(); } + + void MaterialEditorWindow::onShadersClicked() + { + shaderWidget->show(); + } void MaterialEditorWindow::createMenus() { @@ -57,12 +103,32 @@ namespace MaterialEditor QMenu *menu = mm->menu( Core::Constants::M_TOOLS ); if( menu != NULL ) { - QMenu *m = menu->addMenu( "Material Editor" ); + QMenu *m = menu->addMenu( tr( "Material Editor" ) ); QAction *a; - - a = new QAction( tr( "Edit material" ), NULL ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onEditMaterialClicked() ) ); + + QMenu *mm = m->addMenu( tr( "Material" ) ); + { + a = new QAction( tr( "New material" ), NULL ); + connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onNewMaterialClicked() ) ); + mm->addAction( a ); + + a = new QAction( tr( "Open material" ) , NULL ); + connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onOpenMaterialClicked() ) ); + mm->addAction( a ); + + a = new QAction( tr( "Save material" ), NULL ); + connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onSaveMaterialClicked() ) ); + mm->addAction( a ); + + a = new QAction( tr( "Edit material" ), NULL ); + connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onEditMaterialClicked() ) ); + mm->addAction( a ); + } + + a = new QAction( tr( "Shaders" ), NULL ); + connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onShadersClicked() ) ); m->addAction( a ); + } } 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 cd21370ec..e37790a23 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 @@ -23,6 +23,7 @@ namespace MaterialEditor { class MatPropWidget; + class ShaderWidget; class MaterialEditorWindow: public QMainWindow { @@ -31,13 +32,20 @@ public: MaterialEditorWindow( QWidget *parent = NULL ); ~MaterialEditorWindow(); + void onOpenClicked(); + private Q_SLOTS: + void onNewMaterialClicked(); + void onOpenMaterialClicked(); + void onSaveMaterialClicked(); void onEditMaterialClicked(); + void onShadersClicked(); private: void createMenus(); void createDockWidgets(); + ShaderWidget *shaderWidget; MatPropWidget *matPropWidget; Ui::MaterialEditorWindow m_ui; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.cpp new file mode 100644 index 000000000..90c5585d2 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.cpp @@ -0,0 +1,63 @@ +// 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 "shader_widget.h" + +namespace MaterialEditor +{ + ShaderWidget::ShaderWidget( QWidget *parent ) : + QWidget( parent ) + { + setupUi( this ); + setupConnections(); + } + + ShaderWidget::~ShaderWidget() + { + } + + void ShaderWidget::setupConnections() + { + connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOKClicked() ) ); + + connect( newButton, SIGNAL( clicked( bool ) ), this, SLOT( onNewClicked() ) ); + connect( addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) ); + connect( removeButton, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveClicked() ) ); + connect( editButton, SIGNAL( clicked( bool ) ), this, SLOT( onEditClicked() ) ); + } + + void ShaderWidget::onOKClicked() + { + close(); + } + + void ShaderWidget::onNewClicked() + { + } + + void ShaderWidget::onAddClicked() + { + } + + void ShaderWidget::onRemoveClicked() + { + } + + void ShaderWidget::onEditClicked() + { + } +} + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.h new file mode 100644 index 000000000..ce7c869f8 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.h @@ -0,0 +1,46 @@ +// 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 SHADER_WIDGET_H +#define SHADER_WIDGET_H + +#include "ui_shader_widget.h" + +namespace MaterialEditor +{ + class ShaderWidget : public QWidget, public Ui::ShaderWidget + { + Q_OBJECT + + public: + ShaderWidget( QWidget *parent = NULL ); + ~ShaderWidget(); + + private: + void setupConnections(); + + private Q_SLOTS: + void onOKClicked(); + void onNewClicked(); + void onAddClicked(); + void onRemoveClicked(); + void onEditClicked(); + }; +} + +#endif + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.ui new file mode 100644 index 000000000..ea9a93621 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/shader_widget.ui @@ -0,0 +1,128 @@ + + + ShaderWidget + + + Qt::ApplicationModal + + + + 0 + 0 + 698 + 304 + + + + Shaders + + + + + + + Name + + + + + Description + + + + + Path + + + + + + + + + 0 + 0 + + + + New + + + + + + + + 0 + 0 + + + + Add + + + + + + + + 0 + 0 + + + + Remove + + + + + + + Edit + + + + + + + Qt::Vertical + + + + 20 + 123 + + + + + + + + + 0 + 0 + + + + OK + + + + + + + Qt::Horizontal + + + + 664 + 20 + + + + + + + + +