From 390d1bb15697f62b90ea7896b4ec39b20d994ee7 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Mon, 23 Sep 2013 17:16:01 +0200 Subject: [PATCH] Don't call newMaterial() every time we load a (sub)material. --HG-- branch : gsoc2013-dfighter --- .../src/plugins/material_editor/nel3d_interface.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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();