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_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}

@ -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,22 +28,27 @@
#include <nel/misc/debug.h>
#include <QSplitter>
#include <QDockWidget>
#include <QFileDialog>
#include <QMessageBox>
#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()
@ -177,9 +182,7 @@ namespace MaterialEditor
{
QDockWidget *dock = new QDockWidget( tr( "Material" ), this );
dock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
passesWidget->setMaterialObserver( materialWidget );
dock->setWidget( materialWidget );
dock->setWidget( materialSplitter );
addDockWidget( Qt::RightDockWidgetArea, dock );
}

@ -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;
};

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