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 bf13b08a3..72c103bee 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 @@ -258,9 +258,15 @@ namespace MaterialEditor if( !xml.init( file ) ) return false; - newMaterial(); NL3D::CDynMaterial *mat = currentShape.getMaterial( subMatId ).getObjectPtr()->getDynMat(); - mat->clear(); + if( mat != NULL ) + mat->clear(); + else + { + currentShape.getMaterial( subMatId ).getObjectPtr()->createCleanDynMat(); + mat = currentShape.getMaterial( subMatId ).getObjectPtr()->getDynMat(); + } + mat->serial( xml ); file.close();