mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-21 00:18:43 +00:00
Changed: Stability fixes for exporting with max plugins.
This commit is contained in:
parent
608f589d4e
commit
9bebd05c51
6 changed files with 218 additions and 117 deletions
|
@ -61,6 +61,7 @@ public:
|
|||
class CBuildSlot
|
||||
{
|
||||
public:
|
||||
CBuildSlot() : MeshGeom(NULL) { }
|
||||
/**
|
||||
* Flags for the build of a slot
|
||||
*
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Version="9,00"
|
||||
Name="nel_export"
|
||||
ProjectGUID="{F12B8538-1EAB-4BCB-8506-9DB5605F14E5}"
|
||||
RootNamespace="nelexport"
|
||||
|
@ -101,90 +101,6 @@
|
|||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</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
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
|
@ -269,6 +185,92 @@
|
|||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</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
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
|
@ -446,7 +448,7 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
|
@ -454,7 +456,7 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
|
|
|
@ -103,11 +103,23 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time)
|
|||
}
|
||||
catch (...)
|
||||
{
|
||||
nlwarning("Shape serialization failed!");
|
||||
file.close();
|
||||
remove(sPath);
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
|
|
@ -88,18 +88,31 @@ Value* export_shape_cf (Value** arg_list, int count)
|
|||
// Ok ?
|
||||
Boolean *ret=&false_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;
|
||||
try
|
||||
{
|
||||
|
||||
// Export
|
||||
theCNelExport._ExportNel->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;
|
||||
}
|
||||
|
|
|
@ -1170,6 +1170,11 @@ LocalModData* VertexPaintData::Clone()
|
|||
|
||||
void VertexPaintData::SynchVerts(Mesh &m)
|
||||
{
|
||||
if (mesh == NULL)
|
||||
{
|
||||
nlwarning("mesh == NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
if(nverts)
|
||||
delete [] nverts;
|
||||
|
|
Loading…
Reference in a new issue