It's not a bad idea to always have at least 1 pass.

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

@ -144,6 +144,9 @@ namespace NL3D
CDynMaterial::CDynMaterial()
{
SRenderPass *p = new SRenderPass();
p->setName( "pass1" );
passes.push_back( p );
}
CDynMaterial::~CDynMaterial()

@ -49,6 +49,8 @@ namespace MaterialEditor
passesWidget = new RenderPassesWidget();
passesWidget->setMaterialObserver( materialSplitter );
passesWidget->setNel3dIface( nl3dIface );
passesWidget->onMaterialLoaded();
materialSplitter->onMaterialLoaded();
createMenus();
createDockWidgets();
@ -80,6 +82,7 @@ namespace MaterialEditor
{
nl3dIface->newMaterial();
materialSplitter->onNewMaterial();
passesWidget->onMaterialLoaded();
}
void MaterialEditorWindow::onOpenMaterialClicked()
@ -105,6 +108,7 @@ namespace MaterialEditor
);
}
passesWidget->onMaterialLoaded();
materialSplitter->onMaterialLoaded();
}

@ -22,12 +22,13 @@ namespace MaterialEditor
{
MatPropWidget::MatPropWidget( QWidget *parent ) :
QWidget( parent )
QDialog( parent )
{
setupUi( this );
matPropEditWidget = new MatPropEditWidget();
setupConnections();
edit = false;
changed = false;
proxy = NULL;
}
@ -73,6 +74,7 @@ namespace MaterialEditor
{
treeWidget->clear();
nameEdit->clear();
changed = false;
if( this->proxy != NULL )
{
delete this->proxy;
@ -105,18 +107,21 @@ namespace MaterialEditor
}
clear();
setResult( QDialog::Accepted );
close();
}
void MatPropWidget::onCancelClicked()
{
clear();
setResult( QDialog::Rejected );
close();
}
void MatPropWidget::onAddClicked()
{
edit = false;
changed = true;
matPropEditWidget->clear();
matPropEditWidget->show();
}
@ -144,6 +149,7 @@ namespace MaterialEditor
return;
delete item;
changed = true;
}
void MatPropWidget::onEditorOKClicked()
@ -166,6 +172,7 @@ namespace MaterialEditor
item->setData( 2, Qt::DisplayRole, prop.type );
treeWidget->addTopLevelItem( item );
}
changed = true;
}

@ -25,7 +25,7 @@ namespace MaterialEditor
class MatPropEditWidget;
class CRenderPassProxy;
class MatPropWidget : public QWidget, public Ui::MatPropWidget
class MatPropWidget : public QDialog, public Ui::MatPropWidget
{
Q_OBJECT
public:
@ -33,6 +33,7 @@ namespace MaterialEditor
~MatPropWidget();
void load( CRenderPassProxy *proxy );
void clear();
bool getChanged() const{ return changed; }
private Q_SLOTS:
void onOKClicked();
@ -45,6 +46,7 @@ namespace MaterialEditor
private:
void setupConnections();
bool edit;
bool changed;
MatPropEditWidget *matPropEditWidget;
CRenderPassProxy *proxy;
};

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MatPropWidget</class>
<widget class="QWidget" name="MatPropWidget">
<widget class="QDialog" name="MatPropWidget">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>669</width>
<height>504</height>
<width>685</width>
<height>441</height>
</rect>
</property>
<property name="windowTitle">

@ -32,6 +32,7 @@ namespace MaterialEditor
browserCtrl->setBrowser( browser );
setup();
setupConnections();
}
MaterialSplitter::~MaterialSplitter()
@ -43,6 +44,11 @@ namespace MaterialEditor
browser = NULL;
}
void MaterialSplitter::setupConnections()
{
connect( materialWidget, SIGNAL( propsChanged() ), this, SLOT( onPropsChanged() ) );
}
void MaterialSplitter::setup()
{
setOrientation( Qt::Vertical );
@ -91,5 +97,12 @@ namespace MaterialEditor
{
materialWidget->onPassRenamed( from, to );
}
void MaterialSplitter::onPropsChanged()
{
QString pass;
materialWidget->getCurrentPass( pass );
browserCtrl->onPropsChanged();
}
}

@ -36,6 +36,8 @@ namespace MaterialEditor
MaterialSplitter( QWidget *parent = NULL );
~MaterialSplitter();
void setupConnections();
void setup();
void setNel3DIface( CNel3DInterface *iface );
@ -53,6 +55,9 @@ namespace MaterialEditor
MaterialWidget *materialWidget;
CPropBrowserCtrl *browserCtrl;
QtTreePropertyBrowser *browser;
private Q_SLOTS:
void onPropsChanged();
};
}

@ -119,6 +119,11 @@ namespace MaterialEditor
passCB->setItemText( i, to );
}
void MaterialWidget::getCurrentPass( QString &pass )
{
pass = passCB->currentText();
}
void MaterialWidget::setupConnections()
{
connect( passButton, SIGNAL( clicked( bool ) ), this, SLOT( onPassEditClicked() ) );
@ -134,7 +139,9 @@ namespace MaterialEditor
CRenderPassProxy p = nl3dIface->getMaterial().getPass( passCB->currentText().toUtf8().data() );
matPropWidget->load( &p );
matPropWidget->show();
matPropWidget->exec();
if( matPropWidget->getChanged() )
Q_EMIT propsChanged();
}
void MaterialWidget::onShaderEditClicked()

@ -44,6 +44,11 @@ namespace MaterialEditor
void setNel3DIface( CNel3DInterface *iface ){ nl3dIface = iface; }
void getCurrentPass( QString &pass );
Q_SIGNALS:
void propsChanged();
private:
void setupConnections();
ShaderEditorWidget *shaderEditorWidget;

@ -44,7 +44,25 @@ namespace MaterialEditor
void CPropBrowserCtrl::setupConnections()
{
}
void CPropBrowserCtrl::onPropsChanged()
{
clearProps();
loadPropsForPass( currentPass );
}
void CPropBrowserCtrl::clearProps()
{
browser->clear();
}
void CPropBrowserCtrl::loadPropsForPass( const QString &pass )
{
currentPass = pass;
CNelMaterialProxy m = nel3dIface->getMaterial();
CRenderPassProxy p = m.getPass( pass.toUtf8().data() );
}
}

@ -35,10 +35,14 @@ namespace MaterialEditor
void setBrowser( QtTreePropertyBrowser *b );
void setNel3DIface( CNel3DInterface *iface );
void setupConnections();
void onPropsChanged();
void clearProps();
void loadPropsForPass( const QString &pass );
private:
QtTreePropertyBrowser *browser;
CNel3DInterface *nel3dIface;
QString currentPass;
};
}

@ -59,6 +59,21 @@ namespace MaterialEditor
listWidget->clear();
}
void RenderPassesWidget::onMaterialLoaded()
{
clear();
CNelMaterialProxy m = nl3dIface->getMaterial();
std::vector< std::string > pl;
m.getPassList( pl );
std::vector< std::string >::const_iterator itr = pl.begin();
while( itr != pl.end() )
{
listWidget->addItem( QString( itr->c_str() ) );
++itr;
}
}
void RenderPassesWidget::setupConnections()
{
connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOKClicked() ) );

@ -34,8 +34,8 @@ namespace MaterialEditor
void fillList( const QStringList &list );
void getList( QStringList &list );
void clear();
void onMaterialLoaded();
void setNel3dIface( CNel3DInterface *iface ){ nl3dIface = iface; }
void setMaterialObserver( CMaterialObserver *obs ){ observer = obs; }
private:

Loading…
Cancel
Save