Added ShaderWidget, and restructured the material related menu items.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent d46944f258
commit abbc09e19c

@ -20,6 +20,7 @@ SET(OVQT_PLUGIN_MATERIAL_EDITOR_HDR
material_widget.h material_widget.h
render_passes.h render_passes.h
shader_editor.h shader_editor.h
shader_widget.h
) )
SET(OVQT_PLUGIN_MATERIAL_EDITOR_UIS SET(OVQT_PLUGIN_MATERIAL_EDITOR_UIS
@ -29,6 +30,7 @@ SET(OVQT_PLUGIN_MATERIAL_EDITOR_UIS
material_widget.ui material_widget.ui
render_passes.ui render_passes.ui
shader_editor.ui shader_editor.ui
shader_widget.ui
) )
SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTGUI TRUE)

@ -29,6 +29,7 @@ namespace MaterialEditor
void MaterialEditorContext::open() void MaterialEditorContext::open()
{ {
m_materialEditorWindow->onOpenClicked();
} }
void MaterialEditorContext::newDocument() void MaterialEditorContext::newDocument()

@ -17,6 +17,7 @@
#include "material_editor_window.h" #include "material_editor_window.h"
#include "material_editor_constants.h" #include "material_editor_constants.h"
#include "material_widget.h" #include "material_widget.h"
#include "shader_widget.h"
#include "material_properties.h" #include "material_properties.h"
#include "../core/icore.h" #include "../core/icore.h"
@ -27,6 +28,7 @@
#include <nel/misc/debug.h> #include <nel/misc/debug.h>
#include <QDockWidget> #include <QDockWidget>
#include <QFileDialog>
namespace MaterialEditor namespace MaterialEditor
{ {
@ -34,6 +36,7 @@ namespace MaterialEditor
QMainWindow(parent) QMainWindow(parent)
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
shaderWidget = new ShaderWidget();
matPropWidget = new MatPropWidget(); matPropWidget = new MatPropWidget();
createMenus(); createMenus();
createDockWidgets(); createDockWidgets();
@ -41,15 +44,58 @@ namespace MaterialEditor
MaterialEditorWindow::~MaterialEditorWindow() MaterialEditorWindow::~MaterialEditorWindow()
{ {
delete shaderWidget;
shaderWidget = NULL;
delete matPropWidget; delete matPropWidget;
matPropWidget = NULL; 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() void MaterialEditorWindow::onEditMaterialClicked()
{ {
matPropWidget->show(); matPropWidget->show();
} }
void MaterialEditorWindow::onShadersClicked()
{
shaderWidget->show();
}
void MaterialEditorWindow::createMenus() void MaterialEditorWindow::createMenus()
{ {
Core::MenuManager *mm = Core::ICore::instance()->menuManager(); Core::MenuManager *mm = Core::ICore::instance()->menuManager();
@ -57,12 +103,32 @@ namespace MaterialEditor
QMenu *menu = mm->menu( Core::Constants::M_TOOLS ); QMenu *menu = mm->menu( Core::Constants::M_TOOLS );
if( menu != NULL ) if( menu != NULL )
{ {
QMenu *m = menu->addMenu( "Material Editor" ); QMenu *m = menu->addMenu( tr( "Material Editor" ) );
QAction *a; QAction *a;
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 ); a = new QAction( tr( "Edit material" ), NULL );
connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onEditMaterialClicked() ) ); 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 ); m->addAction( a );
} }
} }

@ -23,6 +23,7 @@ namespace MaterialEditor
{ {
class MatPropWidget; class MatPropWidget;
class ShaderWidget;
class MaterialEditorWindow: public QMainWindow class MaterialEditorWindow: public QMainWindow
{ {
@ -31,13 +32,20 @@ public:
MaterialEditorWindow( QWidget *parent = NULL ); MaterialEditorWindow( QWidget *parent = NULL );
~MaterialEditorWindow(); ~MaterialEditorWindow();
void onOpenClicked();
private Q_SLOTS: private Q_SLOTS:
void onNewMaterialClicked();
void onOpenMaterialClicked();
void onSaveMaterialClicked();
void onEditMaterialClicked(); void onEditMaterialClicked();
void onShadersClicked();
private: private:
void createMenus(); void createMenus();
void createDockWidgets(); void createDockWidgets();
ShaderWidget *shaderWidget;
MatPropWidget *matPropWidget; MatPropWidget *matPropWidget;
Ui::MaterialEditorWindow m_ui; Ui::MaterialEditorWindow m_ui;

@ -0,0 +1,63 @@
// Object Viewer Qt Material Editor plugin <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#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()
{
}
}

@ -0,0 +1,46 @@
// Object Viewer Qt Material Editor plugin <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#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

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ShaderWidget</class>
<widget class="QWidget" name="ShaderWidget">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>698</width>
<height>304</height>
</rect>
</property>
<property name="windowTitle">
<string>Shaders</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="5" colspan="2">
<widget class="QTreeWidget" name="shaderListWidget">
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Description</string>
</property>
</column>
<column>
<property name="text">
<string>Path</string>
</property>
</column>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="newButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>New</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="addButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="removeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="editButton">
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
<item row="4" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>123</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="okButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item row="5" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>664</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
Loading…
Cancel
Save