Only use the shader combo box for the user shaders.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 11 years ago
parent 586c25f864
commit dbd5185de1

@ -1073,6 +1073,7 @@ private:
void endMultiPass(); void endMultiPass();
// @} // @}
// Sets up a rendering pass from the dynamic material
bool setupDynMatPass( uint pass ); bool setupDynMatPass( uint pass );
/// LastVB for UV setup. /// LastVB for UV setup.

@ -656,54 +656,6 @@ void CMaterial::createDynMat()
SRenderPass *p = dynMat->getPass( 0 ); SRenderPass *p = dynMat->getPass( 0 );
switch( _ShaderType )
{
case Normal:
p->setShaderRef( "Normal" );
break;
case Bump:
p->setShaderRef( "Bump" );
break;
case UserColor:
p->setShaderRef( "UserColor" );
break;
case LightMap:
p->setShaderRef( "LightMap" );
break;
case Specular:
p->setShaderRef( "Specular" );
break;
case Caustics:
p->setShaderRef( "Caustics" );
break;
case PerPixelLighting:
p->setShaderRef( "PerPixelLighting" );
break;
case PerPixelLightingNoSpec:
p->setShaderRef( "PerPixelLightingNoSpec" );
break;
case Cloud:
p->setShaderRef( "Cloud" );
break;
case Water:
p->setShaderRef( "Water" );
break;
default:
nlassert( false );
break;
}
float v[ 4 ]; float v[ 4 ];
float m[ 16 ]; float m[ 16 ];
SDynMaterialProp prop; SDynMaterialProp prop;

@ -21,22 +21,6 @@
namespace MaterialEditor namespace MaterialEditor
{ {
const int NUM_STOCK_SHADERS = 10;
const char *stockShaders[ NUM_STOCK_SHADERS ] =
{
"Normal",
"Bump",
"UserColor",
"LightMap",
"Specular",
"Caustics",
"PerPixelLighting",
"PerPixelLightingNoSpec",
"Cloud",
"Water"
};
MaterialWidget::MaterialWidget( QWidget *parent ) : MaterialWidget::MaterialWidget( QWidget *parent ) :
QWidget( parent ) QWidget( parent )
{ {
@ -44,7 +28,6 @@ namespace MaterialEditor
shaderEditorWidget = new ShaderEditorWidget(); shaderEditorWidget = new ShaderEditorWidget();
matPropWidget = new MatPropWidget(); matPropWidget = new MatPropWidget();
setNel3DIface( NULL ); setNel3DIface( NULL );
addStockShaders();
setupConnections(); setupConnections();
} }
@ -194,13 +177,6 @@ namespace MaterialEditor
pass = passCB->currentText(); pass = passCB->currentText();
} }
void MaterialWidget::addStockShaders()
{
for( int i = 0; i < 10; i++ )
shaderCB->addItem( QString( stockShaders[ i ] ) );
}
void MaterialWidget::setupConnections() void MaterialWidget::setupConnections()
{ {
connect( passButton, SIGNAL( clicked( bool ) ), this, SLOT( onPassEditClicked() ) ); connect( passButton, SIGNAL( clicked( bool ) ), this, SLOT( onPassEditClicked() ) );
@ -266,16 +242,11 @@ namespace MaterialEditor
pass.getShaderRef( s ); pass.getShaderRef( s );
int i = shaderCB->findText( s.c_str() ); int i = shaderCB->findText( s.c_str() );
if( i >= 0 ) if( i > 0 )
shaderCB->setCurrentIndex( i ); shaderCB->setCurrentIndex( i );
else else
shaderCB->setCurrentIndex( 0 ); shaderCB->setCurrentIndex( 0 );
if( i > NUM_STOCK_SHADERS )
shaderButton->setEnabled( true );
else
shaderButton->setEnabled( false );
Q_EMIT passChanged( text ); Q_EMIT passChanged( text );
} }
@ -290,7 +261,7 @@ namespace MaterialEditor
CRenderPassProxy pass = m.getPass( p.toUtf8().data() ); CRenderPassProxy pass = m.getPass( p.toUtf8().data() );
pass.setShaderRef( text.toUtf8().data() ); pass.setShaderRef( text.toUtf8().data() );
if( shaderCB->currentIndex() > NUM_STOCK_SHADERS ) if( !text.isEmpty() )
shaderButton->setEnabled( true ); shaderButton->setEnabled( true );
else else
shaderButton->setEnabled( false ); shaderButton->setEnabled( false );

@ -57,7 +57,6 @@ namespace MaterialEditor
void subMatChanged( int i ); void subMatChanged( int i );
private: private:
void addStockShaders();
void setupConnections(); void setupConnections();
ShaderEditorWidget *shaderEditorWidget; ShaderEditorWidget *shaderEditorWidget;
MatPropWidget *matPropWidget; MatPropWidget *matPropWidget;

Loading…
Cancel
Save