We don't want duplicate passes.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent ea06a2c656
commit 9294cdc644

@ -84,6 +84,19 @@ namespace MaterialEditor
connect( downButton, SIGNAL( clicked( bool ) ), this, SLOT( onDownClicked() ) );
}
bool RenderPassesWidget::passExists( const QString &label )
{
int c = listWidget->count();
for( int i = 0; i < c; i++ )
{
if( label == listWidget->item( i )->text() )
return true;
}
return false;
}
void RenderPassesWidget::onOKClicked()
{
close();
@ -101,17 +114,7 @@ namespace MaterialEditor
if( label.isEmpty() )
return;
int i = 0;
while( i < listWidget->count() )
{
QListWidgetItem *item = listWidget->item( i );
QString text = item->text();
if( text == label )
break;
i++;
}
if( i < listWidget->count() )
if( passExists( label ) )
{
QMessageBox::warning(
NULL,
@ -168,6 +171,19 @@ namespace MaterialEditor
if( to.isEmpty() )
return;
if( from == to )
return;
if( passExists( to ) )
{
QMessageBox::warning(
NULL,
tr( "Pass label" ),
tr( "Pass label already exists!" )
);
return;
}
item->setText( to );
CNelMaterialProxy material = nl3dIface->getMaterial();

@ -40,6 +40,7 @@ namespace MaterialEditor
private:
void setupConnections();
bool passExists( const QString &label );
CNel3DInterface *nl3dIface;
CMaterialObserver *observer;

Loading…
Cancel
Save