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() void MaterialEditorWindow::onShadersClicked()
{ {
shaderWidget->show(); shaderWidget->show();
@ -283,6 +290,10 @@ namespace MaterialEditor
a = new QAction( tr( "Save material" ), NULL ); a = new QAction( tr( "Save material" ), NULL );
connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onSaveMaterialClicked() ) ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onSaveMaterialClicked() ) );
mm->addAction( a ); 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" ) ); mm = m->addMenu( tr( "Scene" ) );

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

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

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

Loading…
Cancel
Save