Instead of auto-generating the dynmaterial added a menu item in the material editor that will trigger it if needed.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 11 years ago
parent 8269ec7be5
commit c3c3f154b1

@ -176,6 +176,13 @@ namespace MaterialEditor
}
void MaterialEditorWindow::onGenMaterialsClicked()
{
nl3dIface->genMaterials();
passesWidget->onMaterialLoaded();
materialSplitter->onMaterialLoaded();
}
void MaterialEditorWindow::onShadersClicked()
{
shaderWidget->show();
@ -283,6 +290,10 @@ namespace MaterialEditor
a = new QAction( tr( "Save material" ), NULL );
connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onSaveMaterialClicked() ) );
mm->addAction( a );
a = new QAction( tr( "Generate materials" ), NULL );
connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onGenMaterialsClicked() ) );
mm->addAction( a );
}
mm = m->addMenu( tr( "Scene" ) );

@ -41,6 +41,7 @@ private Q_SLOTS:
void onNewMaterialClicked();
void onOpenMaterialClicked();
void onSaveMaterialClicked();
void onGenMaterialsClicked();
void onShadersClicked();
void onPassesClicked();
void onStartup();

@ -288,6 +288,13 @@ namespace MaterialEditor
return true;
}
void CNel3DInterface::genMaterials()
{
int c = currentShape.getNumMaterials();
for( int i = 0; i < c; i++ )
currentShape.getMaterial( i ).getObjectPtr()->createDynMat();
}
void CNel3DInterface::newMaterial()
{
if( currentShape.empty() )
@ -496,10 +503,6 @@ namespace MaterialEditor
clearScene();
currentShape = instance;
int c = currentShape.getNumMaterials();
for( int i = 0; i < c; i++ )
currentShape.getMaterial( i ).getObjectPtr()->createDynMat();
subMatId = 0;
setupCamera();

@ -136,6 +136,7 @@ namespace MaterialEditor
bool loadMaterial( const char *fname );
bool saveMaterial( const char *fname );
void genMaterials();
void newMaterial();
bool selectSubMaterial( int id );

Loading…
Cancel
Save