Added a new class, MaterialSpliter, it holds the Material widget, and the Material properties Qt property tree widget, and acts as a proxy / message router for them.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent c9605dde57
commit d96b7e2d66

@ -18,9 +18,11 @@ SET(OVQT_PLUGIN_MATERIAL_EDITOR_HDR
material_properties.h material_properties.h
material_property_editor.h material_property_editor.h
material_widget.h material_widget.h
material_splitter.h
render_passes.h render_passes.h
shader_editor.h shader_editor.h
shader_widget.h shader_widget.h
prop_browser_ctrl.h
) )
SET(OVQT_PLUGIN_MATERIAL_EDITOR_UIS SET(OVQT_PLUGIN_MATERIAL_EDITOR_UIS
@ -56,6 +58,7 @@ ADD_LIBRARY(ovqt_plugin_material_editor MODULE ${SRC}
TARGET_LINK_LIBRARIES( TARGET_LINK_LIBRARIES(
ovqt_plugin_material_editor ovqt_plugin_material_editor
ovqt_plugin_core ovqt_plugin_core
qt_property_browser
nelmisc nelmisc
nel3d nel3d
${QT_LIBRARIES} ${QT_LIBRARIES}

@ -16,7 +16,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_splitter.h"
#include "shader_widget.h" #include "shader_widget.h"
#include "render_passes.h" #include "render_passes.h"
#include "nel3d_interface.h" #include "nel3d_interface.h"
@ -28,23 +28,28 @@
#include <nel/misc/debug.h> #include <nel/misc/debug.h>
#include <QSplitter>
#include <QDockWidget> #include <QDockWidget>
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h"
namespace MaterialEditor namespace MaterialEditor
{ {
MaterialEditorWindow::MaterialEditorWindow(QWidget *parent) : MaterialEditorWindow::MaterialEditorWindow(QWidget *parent) :
QMainWindow(parent) QMainWindow(parent)
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
nl3dIface = new CNel3DInterface(); nl3dIface = new CNel3DInterface();
materialWidget = new MaterialWidget();
shaderWidget = new ShaderWidget(); shaderWidget = new ShaderWidget();
materialSplitter = new MaterialSplitter();
materialSplitter->setNel3DIface( nl3dIface );
passesWidget = new RenderPassesWidget(); passesWidget = new RenderPassesWidget();
passesWidget->setMaterialObserver( materialSplitter );
passesWidget->setNel3dIface( nl3dIface ); passesWidget->setNel3dIface( nl3dIface );
materialWidget->setNel3DIface( nl3dIface );
createMenus(); createMenus();
createDockWidgets(); createDockWidgets();
} }
@ -74,7 +79,7 @@ namespace MaterialEditor
void MaterialEditorWindow::onNewMaterialClicked() void MaterialEditorWindow::onNewMaterialClicked()
{ {
nl3dIface->newMaterial(); nl3dIface->newMaterial();
materialWidget->onNewMaterial(); materialSplitter->onNewMaterial();
} }
void MaterialEditorWindow::onOpenMaterialClicked() void MaterialEditorWindow::onOpenMaterialClicked()
@ -100,7 +105,7 @@ namespace MaterialEditor
); );
} }
materialWidget->onMaterialLoaded(); materialSplitter->onMaterialLoaded();
} }
void MaterialEditorWindow::onSaveMaterialClicked() void MaterialEditorWindow::onSaveMaterialClicked()
@ -176,10 +181,8 @@ namespace MaterialEditor
void MaterialEditorWindow::createDockWidgets() void MaterialEditorWindow::createDockWidgets()
{ {
QDockWidget *dock = new QDockWidget( tr( "Material" ), this ); QDockWidget *dock = new QDockWidget( tr( "Material" ), this );
dock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); dock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
dock->setWidget( materialSplitter );
passesWidget->setMaterialObserver( materialWidget );
dock->setWidget( materialWidget );
addDockWidget( Qt::RightDockWidgetArea, dock ); addDockWidget( Qt::RightDockWidgetArea, dock );
} }

@ -25,7 +25,7 @@ namespace MaterialEditor
class ShaderWidget; class ShaderWidget;
class RenderPassesWidget; class RenderPassesWidget;
class CNel3DInterface; class CNel3DInterface;
class MaterialWidget; class MaterialSplitter;
class MaterialEditorWindow: public QMainWindow class MaterialEditorWindow: public QMainWindow
{ {
@ -51,7 +51,7 @@ private:
ShaderWidget *shaderWidget; ShaderWidget *shaderWidget;
RenderPassesWidget *passesWidget; RenderPassesWidget *passesWidget;
MaterialWidget *materialWidget; MaterialSplitter *materialSplitter;
Ui::MaterialEditorWindow m_ui; Ui::MaterialEditorWindow m_ui;
}; };

@ -0,0 +1,95 @@
// 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 "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 );
}
}

@ -0,0 +1,59 @@
// 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 MATERIAL_SPLITTER_H
#define MATERIAL_SPLITTER_H
#include <QSplitter>
#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

@ -6,22 +6,22 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>292</width> <width>338</width>
<height>696</height> <height>139</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Material</string> <string>Material</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QGridLayout" name="gridLayout">
<item> <item row="0" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Pass</string> <string>Pass</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QComboBox" name="passCB"/> <widget class="QComboBox" name="passCB"/>
@ -44,14 +44,14 @@
</item> </item>
</layout> </layout>
</item> </item>
<item> <item row="2" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Shader</string> <string>Shader</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QComboBox" name="shaderCB"/> <widget class="QComboBox" name="shaderCB"/>
@ -71,7 +71,7 @@
</item> </item>
</layout> </layout>
</item> </item>
<item> <item row="4" column="1">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -79,7 +79,7 @@
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>749</height> <height>18</height>
</size> </size>
</property> </property>
</spacer> </spacer>

@ -0,0 +1,50 @@
// 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 "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()
{
}
}

@ -0,0 +1,45 @@
// 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 PROP_BROWSER_CTRL_H
#define PROP_BROWSER_CTRL_H
#include <QObject>
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
Loading…
Cancel
Save