Probably we don't want the default first pass to be stuck with us if we're loading a material.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent fa3ad050de
commit ed267a6587

@ -76,6 +76,7 @@ namespace NL3D
public: public:
CDynMaterial(); CDynMaterial();
~CDynMaterial(); ~CDynMaterial();
void clear();
void serial( NLMISC::IStream &f ); void serial( NLMISC::IStream &f );
std::string getClassName(){ return "CDynMaterial"; } std::string getClassName(){ return "CDynMaterial"; }

@ -150,6 +150,11 @@ namespace NL3D
} }
CDynMaterial::~CDynMaterial() CDynMaterial::~CDynMaterial()
{
clear();
}
void CDynMaterial::clear()
{ {
std::vector< SRenderPass* >::iterator itr = passes.begin(); std::vector< SRenderPass* >::iterator itr = passes.begin();
while( itr != passes.end() ) while( itr != passes.end() )

@ -81,7 +81,7 @@ namespace MaterialEditor
void MaterialEditorWindow::onNewMaterialClicked() void MaterialEditorWindow::onNewMaterialClicked()
{ {
nl3dIface->newMaterial(); nl3dIface->newMaterial();
materialSplitter->onNewMaterial(); materialSplitter->onMaterialLoaded();
passesWidget->onMaterialLoaded(); passesWidget->onMaterialLoaded();
} }

@ -167,6 +167,7 @@ namespace MaterialEditor
return false; return false;
newMaterial(); newMaterial();
mat->clear();
mat->serial( xml ); mat->serial( xml );
file.close(); file.close();
@ -194,6 +195,7 @@ namespace MaterialEditor
{ {
delete mat; delete mat;
mat = new NL3D::CDynMaterial(); mat = new NL3D::CDynMaterial();
} }
CNelMaterialProxy CNel3DInterface::getMaterial() CNelMaterialProxy CNel3DInterface::getMaterial()

Loading…
Cancel
Save