diff --git a/code/nel/include/nel/3d/dynamic_material.h b/code/nel/include/nel/3d/dynamic_material.h index 92f25ebdd..6e3d24997 100644 --- a/code/nel/include/nel/3d/dynamic_material.h +++ b/code/nel/include/nel/3d/dynamic_material.h @@ -76,6 +76,7 @@ namespace NL3D public: CDynMaterial(); ~CDynMaterial(); + void clear(); void serial( NLMISC::IStream &f ); std::string getClassName(){ return "CDynMaterial"; } diff --git a/code/nel/src/3d/dynamic_material.cpp b/code/nel/src/3d/dynamic_material.cpp index 7d192c257..f12e245c1 100644 --- a/code/nel/src/3d/dynamic_material.cpp +++ b/code/nel/src/3d/dynamic_material.cpp @@ -150,6 +150,11 @@ namespace NL3D } CDynMaterial::~CDynMaterial() + { + clear(); + } + + void CDynMaterial::clear() { std::vector< SRenderPass* >::iterator itr = passes.begin(); while( itr != passes.end() ) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp index 88da0791d..d72e7c7fa 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp @@ -81,7 +81,7 @@ namespace MaterialEditor void MaterialEditorWindow::onNewMaterialClicked() { nl3dIface->newMaterial(); - materialSplitter->onNewMaterial(); + materialSplitter->onMaterialLoaded(); passesWidget->onMaterialLoaded(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.cpp index 21b134a90..1efeac4f0 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/nel3d_interface.cpp @@ -167,6 +167,7 @@ namespace MaterialEditor return false; newMaterial(); + mat->clear(); mat->serial( xml ); file.close(); @@ -194,6 +195,7 @@ namespace MaterialEditor { delete mat; mat = new NL3D::CDynMaterial(); + } CNelMaterialProxy CNel3DInterface::getMaterial()