Shaders will now show up in the shader combobox of MaterialWidget.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent 1f2ff5721e
commit c9cd9cdd3c

@ -54,6 +54,7 @@ namespace MaterialEditor
createMenus();
createDockWidgets();
setupConnections();
QTimer::singleShot( 1, this, SLOT( onStartup() ) );
}
@ -153,6 +154,7 @@ namespace MaterialEditor
void MaterialEditorWindow::onStartup()
{
nl3dIface->loadShaders();
shaderWidget->load();
}
void MaterialEditorWindow::createMenus()
@ -197,5 +199,16 @@ namespace MaterialEditor
dock->setWidget( materialSplitter );
addDockWidget( Qt::RightDockWidgetArea, dock );
}
void MaterialEditorWindow::setupConnections()
{
connect( shaderWidget, SIGNAL( shaderAdded( const QString& ) ),
materialSplitter, SLOT( onShaderAdded( const QString& ) ) );
connect( shaderWidget, SIGNAL( shaderRemoved( const QString& ) ),
materialSplitter, SLOT( onShaderRemoved( const QString& ) ) );
}
}

@ -47,6 +47,7 @@ private Q_SLOTS:
private:
void createMenus();
void createDockWidgets();
void setupConnections();
CNel3DInterface *nl3dIface;

@ -99,6 +99,16 @@ namespace MaterialEditor
materialWidget->onPassRenamed( from, to );
}
void MaterialSplitter::onShaderAdded( const QString &name )
{
materialWidget->onShaderAdded( name );
}
void MaterialSplitter::onShaderRemoved( const QString &name )
{
materialWidget->onShaderRemoved( name );
}
void MaterialSplitter::onPropsChanged()
{
QString pass;

@ -50,6 +50,10 @@ namespace MaterialEditor
void onPassMovedDown( const char *name );
void onPassRenamed( const char *from, const char *to );
public Q_SLOTS:
void onShaderAdded( const QString &name );
void onShaderRemoved( const QString &name );
private:
CNel3DInterface *nl3dIface;
MaterialWidget *materialWidget;

@ -119,6 +119,20 @@ namespace MaterialEditor
passCB->setItemText( i, to );
}
void MaterialWidget::onShaderAdded( const QString &name )
{
shaderCB->addItem( name );
}
void MaterialWidget::onShaderRemoved( const QString &name )
{
int i = shaderCB->findText( name );
if( i < 0 )
return;
shaderCB->removeItem( i );
}
void MaterialWidget::getCurrentPass( QString &pass )
{
pass = passCB->currentText();

@ -42,6 +42,9 @@ namespace MaterialEditor
void onPassMovedDown( const char *name );
void onPassRenamed( const char *from, const char *to );
void onShaderAdded( const QString &name );
void onShaderRemoved( const QString &name );
void setNel3DIface( CNel3DInterface *iface ){ nl3dIface = iface; }
void getCurrentPass( QString &pass );

@ -47,10 +47,15 @@ namespace MaterialEditor
shaderList->clear();
QString name;
std::vector< std::string >::const_iterator itr = v.begin();
while( itr != v.end() )
{
shaderList->addItem( itr->c_str() );
name = itr->c_str();
shaderList->addItem( name );
Q_EMIT shaderAdded( name );
++itr;
}
}
@ -134,6 +139,8 @@ namespace MaterialEditor
}
shaderList->addItem( name );
Q_EMIT shaderAdded( name );
}
void ShaderWidget::onRemoveClicked()
@ -154,7 +161,8 @@ namespace MaterialEditor
if( selection == QMessageBox::Yes )
{
QListWidgetItem *item = shaderList->takeItem( i );
std::string n = item->text().toUtf8().data();
QString name = item->text();
std::string n = name.toUtf8().data();
delete item;
nl3dIface->removeShader( n );
@ -162,6 +170,8 @@ namespace MaterialEditor
if( shaderList->count() == 0 )
description->setPlainText( "" );
Q_EMIT shaderRemoved( name );
}
}

@ -36,6 +36,10 @@ namespace MaterialEditor
void setNel3DInterface( CNel3DInterface *iface ){ nl3dIface = iface; }
void load();
Q_SIGNALS:
void shaderAdded( const QString &name );
void shaderRemoved( const QString &name );
private:
void setupConnections();
bool nameExists( const QString &name );

Loading…
Cancel
Save