From c7c9f927c78f1bd2d788db76a83d252e2ec125f6 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 5 Jun 2010 00:48:19 +0200 Subject: [PATCH] Changed: Stability fixes for exporting with max plugins. --- code/nel/include/nel/3d/mesh_multi_lod.h | 1 + .../3d/plugin_max/nel_export/nel_export.cpp | 8 +- .../plugin_max/nel_export/nel_export.vcproj | 176 +++++++++--------- .../nel_export/nel_export_export.cpp | 14 +- .../nel_export/nel_export_script.cpp | 131 ++++++++++--- .../vertex_tree_paint.cpp | 5 + 6 files changed, 218 insertions(+), 117 deletions(-) diff --git a/code/nel/include/nel/3d/mesh_multi_lod.h b/code/nel/include/nel/3d/mesh_multi_lod.h index 5e891b7b2..d56383f26 100644 --- a/code/nel/include/nel/3d/mesh_multi_lod.h +++ b/code/nel/include/nel/3d/mesh_multi_lod.h @@ -61,6 +61,7 @@ public: class CBuildSlot { public: + CBuildSlot() : MeshGeom(NULL) { } /** * Flags for the build of a slot * diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp index 35a9bd6a0..04e815eac 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp @@ -317,9 +317,15 @@ static BOOL CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA // Get the node INode* pNode=theCNelExport._Ip->GetSelNode (nNode); + if (pNode == NULL) + nlwarning("pNode == NULL"); + + if (pNode->GetName() == NULL) + nlwarning("pNode->GetName()"); + // Name of the node char sNodeMsg[256]; - sprintf (sNodeMsg, "Save %s model...", pNode->GetName()); + nlwarning (sNodeMsg, "Save %s model...", pNode->GetName()); // It is a zone ? if (RPO::isZone (*pNode, time)) diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export.vcproj b/code/nel/tools/3d/plugin_max/nel_export/nel_export.vcproj index 65fadc12d..565fde7c8 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export.vcproj +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export.vcproj @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + deleteLM( *node); - if (theCNelExport.exportMesh (sPath, *node, ip->GetTime())) - ret = &true_value; + // Is the flag dont export set ? + if (CExportNel::getScriptAppData (node, NEL3D_APPDATA_DONTEXPORT, 0)) + return ret; + // Object is flagged as a collision? + int bCol= CExportNel::getScriptAppData(node, NEL3D_APPDATA_COLLISION, BST_UNCHECKED); + if(bCol == BST_CHECKED) + return ret; + + // Export + theCNelExport._ExportNel->deleteLM( *node); + if (theCNelExport.exportMesh (sPath, *node, ip->GetTime())) + ret = &true_value; + } + catch (Exception &e) + { + nlwarning ("ERROR (NelExportShape) %s", e.what()); + } + catch (...) + { + nlwarning ("ERROR (NelExportShape) catch (...)"); + } + nlinfo("ret"); return ret; } @@ -129,7 +142,8 @@ Value* export_shape_ex_cf (Value** arg_list, int count) // Get a INode pointer from the argument passed to us INode *node = arg_list[0]->to_node(); - nlassert (node); + nlassert(node); + nlassert(node->GetName()); // Export path std::string sPath=arg_list[1]->to_string(); @@ -167,9 +181,13 @@ Value* export_shape_ex_cf (Value** arg_list, int count) } catch (Exception &e) { - nlwarning ("ERROR %s", e.what()); + nlwarning ("ERROR (NelExportShapeEx) %s", e.what()); } - + catch (...) + { + nlwarning ("ERROR (NelExportShapeEx) catch (...)"); + } + nlinfo("ret"); return ret; } @@ -207,7 +225,11 @@ Value* export_skeleton_cf (Value** arg_list, int count) } catch (Exception &e) { - nlwarning ("ERROR %s", e.what()); + nlwarning ("ERROR (NelExportSkeleton) %s", e.what()); + } + catch (...) + { + nlwarning ("ERROR (NelExportSkeleton) catch (...)"); } return ret; @@ -274,7 +296,11 @@ Value* export_animation_cf (Value** arg_list, int count) } catch (Exception &e) { - nlwarning ("ERROR %s", e.what()); + nlwarning ("ERROR (NelExportAnimation) %s", e.what()); + } + catch (...) + { + nlwarning ("ERROR (NelExportAnimation) catch (...)"); } return ret; } @@ -328,7 +354,11 @@ Value* export_ig_cf (Value** arg_list, int count) } catch (Exception &e) { - nlwarning ("ERROR %s", e.what()); + nlwarning ("ERROR (NelExportInstanceGroup) %s", e.what()); + } + catch (...) + { + nlwarning ("ERROR (NelExportInstanceGroup) catch (...)"); } return ret; @@ -383,7 +413,11 @@ Value* export_skeleton_weight_cf (Value** arg_list, int count) } catch (Exception &e) { - nlwarning ("ERROR %s", e.what()); + nlwarning ("ERROR (NelExportSkeletonWeight) %s", e.what()); + } + catch (...) + { + nlwarning ("ERROR (NelExportSkeletonWeight) catch (...)"); } return ret; @@ -397,9 +431,20 @@ Value* view_shape_cf (Value** arg_list, int count) // Get a good interface pointer Interface *ip = MAXScript_interface; - theCNelExport.init (true, true, ip, true); + try + { + theCNelExport.init (true, true, ip, true); - theCNelExport.viewMesh (ip->GetTime()); + theCNelExport.viewMesh (ip->GetTime()); + } + catch (Exception &e) + { + nlwarning ("ERROR %s", e.what()); + } + catch (...) + { + nlwarning ("ERROR catch (...)"); + } return &true_value; } @@ -496,9 +541,20 @@ Value* export_vegetable_cf (Value** arg_list, int count) // Ok ? Boolean *ret=&false_value; - // Export - if (theCNelExport.exportVegetable (sPath, *node, ip->GetTime())) - ret = &true_value; + try + { + // Export + if (theCNelExport.exportVegetable (sPath, *node, ip->GetTime())) + ret = &true_value; + } + catch (Exception &e) + { + nlwarning ("ERROR (NelExportVegetable) %s", e.what()); + } + catch (...) + { + nlwarning ("ERROR (NelExportVegetable) catch (...)"); + } return ret; } @@ -586,7 +642,11 @@ Value* export_collision_cf (Value** arg_list, int count) } catch (Exception &e) { - nlwarning ("ERROR %s", e.what()); + nlwarning ("ERROR (NelExportCollision) %s", e.what()); + } + catch (...) + { + nlwarning ("ERROR (NelExportCollision) catch (...)"); } return ret; } @@ -639,7 +699,11 @@ Value* export_pacs_primitives_cf (Value** arg_list, int count) } catch (Exception &e) { - nlwarning ("ERROR %s", e.what()); + nlwarning ("ERROR (NelExportPACSPrimitives) %s", e.what()); + } + catch (...) + { + nlwarning ("ERROR (NelExportPACSPrimitives) catch (...)"); } return ret; } @@ -674,9 +738,20 @@ Value* export_lod_character_cf (Value** arg_list, int count) // Ok ? Boolean *ret=&false_value; - // Export - if (theCNelExport.exportLodCharacter (sPath, *node, ip->GetTime())) - ret = &true_value; + try + { + // Export + if (theCNelExport.exportLodCharacter (sPath, *node, ip->GetTime())) + ret = &true_value; + } + catch (Exception &e) + { + nlwarning ("ERROR (NelExportLodCharacter) %s", e.what()); + } + catch (...) + { + nlwarning ("ERROR (NelExportLodCharacter) catch (...)"); + } return ret; } diff --git a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp index a103d0b69..f6d523e6a 100644 --- a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp +++ b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp @@ -1170,6 +1170,11 @@ LocalModData* VertexPaintData::Clone() void VertexPaintData::SynchVerts(Mesh &m) { + if (mesh == NULL) + { + nlwarning("mesh == NULL"); + return; + } if(nverts) delete [] nverts;