From 9c258ad62831abffcc80da8871fa34881bc6cbc1 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 5 Jun 2010 00:44:34 +0200 Subject: [PATCH] Fixed: Export crashes caused by incorrect delete of objects created by max. --- .../3d/plugin_max/nel_mesh_lib/calc_lm.cpp | 4 +- .../nel_mesh_lib/export_collision.cpp | 2 +- .../plugin_max/nel_mesh_lib/export_light.cpp | 2 +- .../nel_mesh_lib/export_lod_character.cpp | 2 +- .../plugin_max/nel_mesh_lib/export_mesh.cpp | 10 +- .../nel_mesh_lib/export_mesh_interface.cpp | 6 +- .../plugin_max/nel_mesh_lib/export_misc.cpp | 2 +- .../plugin_max/nel_mesh_lib/export_scene.cpp | 1 + .../nel_mesh_lib/export_skinning.cpp | 2 +- .../nel_mesh_lib/export_vegetable.cpp | 2 +- .../nel_mesh_lib/nel_mesh_lib.vcproj | 145 +++++++++--------- 11 files changed, 90 insertions(+), 88 deletions(-) diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp index 16f426e1f..9f5d95441 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp @@ -98,7 +98,7 @@ bool SLightBuild::canConvertFromMaxLight (INode *node, TimeValue tvTime) return false; if( deleteIt ) - delete maxLight; + maxLight->DeleteMe(); return true; } @@ -295,7 +295,7 @@ void SLightBuild::convertFromMaxLight (INode *node,TimeValue tvTime) this->rSoftShadowConeLength = (float)atof(sTmp.c_str()); if( deleteIt ) - delete maxLight; + maxLight->DeleteMe(); } // *********************************************************************************************** diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp index 1724c7661..b0264a8e9 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp @@ -135,7 +135,7 @@ CCollisionMeshBuild* CExportNel::createCollisionMeshBuild(std::vector & // Delete the triObject if we should... if (deleteIt) - delete tri; + tri->DeleteMe(); } } } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_light.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_light.cpp index a9d30a002..14b38ad78 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_light.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_light.cpp @@ -237,7 +237,7 @@ void CExportNel::getLights (std::vector& vectLight, TimeValue time, INod // Delete the triObject if we should... if (deleteIt) - delete maxLight; + maxLight->DeleteMe(); } } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_lod_character.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_lod_character.cpp index 0e7ff71a0..baccbe17b 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_lod_character.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_lod_character.cpp @@ -177,7 +177,7 @@ bool CExportNel::buildLodCharacter (NL3D::CLodCharacterShapeBuild& lodBuild, IN // Delete the triObject if we should... if (deleteIt) - delete tri; + tri->DeleteMe(); } } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp index d4e2f9358..afa742b61 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp @@ -107,7 +107,7 @@ CMesh::CMeshBuild* CExportNel::createMeshBuild(INode& node, TimeValue tvTime, CM // Delete the triObject if we should... if (deleteIt) - delete tri; + tri->DeleteMe(); } } @@ -441,7 +441,7 @@ IShape* CExportNel::buildShape (INode& node, TimeValue time, const TInodePtrInt // Delete the triObject if we should... if (deleteIt) - delete tri; + tri->DeleteMe(); } } @@ -1388,7 +1388,7 @@ IMeshGeom *CExportNel::buildMeshGeom (INode& node, TimeValue time, const TInodeP // Delete the triObject if we should... if (deleteIt) - delete tri; + tri->DeleteMe(); } } @@ -2033,7 +2033,7 @@ NL3D::IShape *CExportNel::buildWaterShape(INode& node, TimeValue time) // Delete the triObject if we should... if (deleteIt) - delete tri; + tri->DeleteMe(); nlinfo("WaterShape : build succesful"); return ws; } @@ -2074,7 +2074,7 @@ bool CExportNel::buildMeshAABBox(INode &node, NLMISC::CAABBox &dest, TimeValue t if (deleteIt) { #ifndef NL_DEBUG - delete tri; + tri->DeleteMe(); #endif // NL_DEBUG } return true; diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp index 08d4ef5e1..4ec4f5ba3 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp @@ -178,7 +178,7 @@ bool CMeshInterface::buildFromMaxMesh(INode &node, TimeValue tvTime) // if (deleteIt) { - delete tri; + tri->DeleteMe(); } return true; } @@ -358,7 +358,7 @@ static void AddNodeToQuadGrid(const NLMISC::CAABBox &delimiter, TNodeFaceQG &des // if (deleteIt) { - delete tri; + tri->DeleteMe(); } } } @@ -487,7 +487,7 @@ static bool SelectVerticesInMeshFromInterfaces(const std::vector if (obj != tri) { // not a mesh object, so do nothing - delete tri; + tri->DeleteMe(); return false; } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp index 37e9b94c7..0f2ebdc18 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp @@ -1257,7 +1257,7 @@ void CExportNel::buildCamera(NL3D::CCameraInfo &cameraInfo, INode& node, TimeVal cameraInfo.Fov = genCamera->GetFOV(time); if (deleteIt) - delete genCamera; + genCamera->DeleteMe(); } } } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp index a3f9b532a..8395d11ce 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp @@ -597,6 +597,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector& vectNode, v else { // What??? + nlerror("sLightBuild.Type == %i", (uint32)(sLightBuild.Type)); nlstop; } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp index bb5d9ee4f..c48b840c7 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp @@ -1423,7 +1423,7 @@ bool CExportNel::mirrorPhysiqueSelection(INode &node, TimeValue tvTime, const st // Delete the triObject if we should... if (deleteIt) - delete tri; + tri->DeleteMe(); // ok! ok= true; diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_vegetable.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_vegetable.cpp index 7db4cb7df..6c054404a 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_vegetable.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_vegetable.cpp @@ -151,7 +151,7 @@ bool CExportNel::buildVegetableShape (NL3D::CVegetableShape& skeletonShape, INo } if (deleteIt) - delete tri; + tri->DeleteMe(); } } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/nel_mesh_lib.vcproj b/code/nel/tools/3d/plugin_max/nel_mesh_lib/nel_mesh_lib.vcproj index ced78d327..b2b18fcc2 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/nel_mesh_lib.vcproj +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/nel_mesh_lib.vcproj @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +