Changed: Stability fixes for exporting with max plugins.

This commit is contained in:
kaetemi 2010-06-05 00:48:19 +02:00
parent 608f589d4e
commit 9bebd05c51
6 changed files with 218 additions and 117 deletions

View file

@ -61,6 +61,7 @@ public:
class CBuildSlot class CBuildSlot
{ {
public: public:
CBuildSlot() : MeshGeom(NULL) { }
/** /**
* Flags for the build of a slot * Flags for the build of a slot
* *

View file

@ -317,9 +317,15 @@ static BOOL CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA
// Get the node // Get the node
INode* pNode=theCNelExport._Ip->GetSelNode (nNode); INode* pNode=theCNelExport._Ip->GetSelNode (nNode);
if (pNode == NULL)
nlwarning("pNode == NULL");
if (pNode->GetName() == NULL)
nlwarning("pNode->GetName()");
// Name of the node // Name of the node
char sNodeMsg[256]; char sNodeMsg[256];
sprintf (sNodeMsg, "Save %s model...", pNode->GetName()); nlwarning (sNodeMsg, "Save %s model...", pNode->GetName());
// It is a zone ? // It is a zone ?
if (RPO::isZone (*pNode, time)) if (RPO::isZone (*pNode, time))

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9.00" Version="9,00"
Name="nel_export" Name="nel_export"
ProjectGUID="{F12B8538-1EAB-4BCB-8506-9DB5605F14E5}" ProjectGUID="{F12B8538-1EAB-4BCB-8506-9DB5605F14E5}"
RootNamespace="nelexport" RootNamespace="nelexport"
@ -101,90 +101,6 @@
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="obj\$(ConfigurationName)\$(ProjectName)"
IntermediateDirectory="obj\$(ConfigurationName)\$(ProjectName)"
ConfigurationType="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
PreprocessorDefinitions="LIBXML_STATIC;WIN32;NDEBUG;ASSERT_THROW_EXCEPTION;_USRDLL"
StringPooling="true"
ExceptionHandling="2"
RuntimeLibrary="2"
DisableLanguageExtensions="false"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="std_afx.h"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="version.lib libxml2.lib freetype.lib comctl32.lib bmm.lib core.lib geom.lib gfx.lib mesh.lib maxutil.lib maxscrpt.lib gup.lib paramblk2.lib winmm.lib ws2_32.lib"
OutputFile="..\plugins\$(RootNamespace)_r.dlu"
SuppressStartupBanner="true"
IgnoreDefaultLibraryNames="libc;libcmt;libcmtd;msvcrtd"
ModuleDefinitionFile="$(ProjectName).def"
ProgramDatabaseFile="$(IntDir)\$(TargetName).pdb"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(RootNamespace)_r.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration <Configuration
Name="Debug|x64" Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)" OutputDirectory="$(PlatformName)\$(ConfigurationName)"
@ -269,6 +185,92 @@
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="obj\$(ConfigurationName)\$(ProjectName)"
IntermediateDirectory="obj\$(ConfigurationName)\$(ProjectName)"
ConfigurationType="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
PreprocessorDefinitions="LIBXML_STATIC;WIN32;NDEBUG;ASSERT_THROW_EXCEPTION;_USRDLL"
StringPooling="true"
ExceptionHandling="2"
RuntimeLibrary="2"
DisableLanguageExtensions="false"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="std_afx.h"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="version.lib libxml2.lib freetype.lib comctl32.lib bmm.lib core.lib geom.lib gfx.lib mesh.lib maxutil.lib maxscrpt.lib gup.lib paramblk2.lib winmm.lib ws2_32.lib"
OutputFile="..\plugins\$(RootNamespace)_r.dlu"
SuppressStartupBanner="true"
IgnoreDefaultLibraryNames="libc;libcmt;libcmtd;msvcrtd"
ModuleDefinitionFile="$(ProjectName).def"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(IntDir)\$(TargetName).pdb"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(RootNamespace)_r.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration <Configuration
Name="Release|x64" Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)" OutputDirectory="$(PlatformName)\$(ConfigurationName)"
@ -446,7 +448,7 @@
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
Name="Release|Win32" Name="Debug|x64"
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
@ -454,7 +456,7 @@
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
Name="Debug|x64" Name="Release|Win32"
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"

View file

@ -103,11 +103,23 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time)
} }
catch (...) catch (...)
{ {
nlwarning("Shape serialization failed!");
file.close();
remove(sPath);
} }
} }
// Delete the pointer // Delete the pointer
delete pShape; nldebug ("Delete the pointer");
try
{
// memory leak, fixme
// delete pShape;
}
catch (...)
{
nlwarning("Failed to delete pShape pointer! Something might be wrong.");
}
} }
} }
return bRet; return bRet;

View file

@ -88,18 +88,31 @@ Value* export_shape_cf (Value** arg_list, int count)
// Ok ? // Ok ?
Boolean *ret=&false_value; Boolean *ret=&false_value;
// Is the flag dont export set ? try
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 // Is the flag dont export set ?
theCNelExport._ExportNel->deleteLM( *node); if (CExportNel::getScriptAppData (node, NEL3D_APPDATA_DONTEXPORT, 0))
if (theCNelExport.exportMesh (sPath, *node, ip->GetTime())) return ret;
ret = &true_value; // 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; 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 // Get a INode pointer from the argument passed to us
INode *node = arg_list[0]->to_node(); INode *node = arg_list[0]->to_node();
nlassert (node); nlassert(node);
nlassert(node->GetName());
// Export path // Export path
std::string sPath=arg_list[1]->to_string(); 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) catch (Exception &e)
{ {
nlwarning ("ERROR %s", e.what()); nlwarning ("ERROR (NelExportShapeEx) %s", e.what());
} }
catch (...)
{
nlwarning ("ERROR (NelExportShapeEx) catch (...)");
}
nlinfo("ret");
return ret; return ret;
} }
@ -207,7 +225,11 @@ Value* export_skeleton_cf (Value** arg_list, int count)
} }
catch (Exception &e) catch (Exception &e)
{ {
nlwarning ("ERROR %s", e.what()); nlwarning ("ERROR (NelExportSkeleton) %s", e.what());
}
catch (...)
{
nlwarning ("ERROR (NelExportSkeleton) catch (...)");
} }
return ret; return ret;
@ -274,7 +296,11 @@ Value* export_animation_cf (Value** arg_list, int count)
} }
catch (Exception &e) catch (Exception &e)
{ {
nlwarning ("ERROR %s", e.what()); nlwarning ("ERROR (NelExportAnimation) %s", e.what());
}
catch (...)
{
nlwarning ("ERROR (NelExportAnimation) catch (...)");
} }
return ret; return ret;
} }
@ -328,7 +354,11 @@ Value* export_ig_cf (Value** arg_list, int count)
} }
catch (Exception &e) catch (Exception &e)
{ {
nlwarning ("ERROR %s", e.what()); nlwarning ("ERROR (NelExportInstanceGroup) %s", e.what());
}
catch (...)
{
nlwarning ("ERROR (NelExportInstanceGroup) catch (...)");
} }
return ret; return ret;
@ -383,7 +413,11 @@ Value* export_skeleton_weight_cf (Value** arg_list, int count)
} }
catch (Exception &e) catch (Exception &e)
{ {
nlwarning ("ERROR %s", e.what()); nlwarning ("ERROR (NelExportSkeletonWeight) %s", e.what());
}
catch (...)
{
nlwarning ("ERROR (NelExportSkeletonWeight) catch (...)");
} }
return ret; return ret;
@ -397,9 +431,20 @@ Value* view_shape_cf (Value** arg_list, int count)
// Get a good interface pointer // Get a good interface pointer
Interface *ip = MAXScript_interface; 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; return &true_value;
} }
@ -496,9 +541,20 @@ Value* export_vegetable_cf (Value** arg_list, int count)
// Ok ? // Ok ?
Boolean *ret=&false_value; Boolean *ret=&false_value;
// Export try
if (theCNelExport.exportVegetable (sPath, *node, ip->GetTime())) {
ret = &true_value; // 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; return ret;
} }
@ -586,7 +642,11 @@ Value* export_collision_cf (Value** arg_list, int count)
} }
catch (Exception &e) catch (Exception &e)
{ {
nlwarning ("ERROR %s", e.what()); nlwarning ("ERROR (NelExportCollision) %s", e.what());
}
catch (...)
{
nlwarning ("ERROR (NelExportCollision) catch (...)");
} }
return ret; return ret;
} }
@ -639,7 +699,11 @@ Value* export_pacs_primitives_cf (Value** arg_list, int count)
} }
catch (Exception &e) catch (Exception &e)
{ {
nlwarning ("ERROR %s", e.what()); nlwarning ("ERROR (NelExportPACSPrimitives) %s", e.what());
}
catch (...)
{
nlwarning ("ERROR (NelExportPACSPrimitives) catch (...)");
} }
return ret; return ret;
} }
@ -674,9 +738,20 @@ Value* export_lod_character_cf (Value** arg_list, int count)
// Ok ? // Ok ?
Boolean *ret=&false_value; Boolean *ret=&false_value;
// Export try
if (theCNelExport.exportLodCharacter (sPath, *node, ip->GetTime())) {
ret = &true_value; // 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; return ret;
} }

View file

@ -1170,6 +1170,11 @@ LocalModData* VertexPaintData::Clone()
void VertexPaintData::SynchVerts(Mesh &m) void VertexPaintData::SynchVerts(Mesh &m)
{ {
if (mesh == NULL)
{
nlwarning("mesh == NULL");
return;
}
if(nverts) if(nverts)
delete [] nverts; delete [] nverts;