2025.6.1
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 by Tech Soft 3D, Inc.
|
||||
* Copyright (c) 2010 - 2025 by Tech Soft 3D, Inc.
|
||||
* The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., and considered a trade secret
|
||||
* as defined under civil and criminal statutes. Tech Soft 3D shall pursue its civil and criminal remedies in the event
|
||||
* of unauthorized use or misappropriation of its trade secrets. Use of this information by anyone other than authorized
|
||||
@@ -35,14 +35,6 @@
|
||||
|
||||
#include "PRC2XML.h"
|
||||
|
||||
#ifndef _MAX_PATH
|
||||
# ifdef _MSC_VER
|
||||
# define _MAX_PATH 260
|
||||
# else
|
||||
# define _MAX_PATH 4096
|
||||
# endif
|
||||
#endif
|
||||
|
||||
//######################################################################################################################
|
||||
// reads the PRC file and dumps information into XML format
|
||||
A3DStatus ReadFile(A3DSDKHOOPSExchangeLoader& sHoopsExchangeLoader, A3DImport& sImport, _TiXmlElement* treatment)
|
||||
@@ -72,7 +64,7 @@ A3DStatus ReadFile(A3DSDKHOOPSExchangeLoader& sHoopsExchangeLoader, A3DImport& s
|
||||
}
|
||||
else
|
||||
{
|
||||
physicalprops->SetAttribute("error", iRetP);
|
||||
physicalprops->SetAttribute("error", A3DMiscGetErrorMsg(iRetP));
|
||||
}
|
||||
|
||||
treatment->LinkEndChild(physicalprops.release());
|
||||
@@ -162,7 +154,8 @@ A3DStatus ProcessFile(
|
||||
A3DSDKHOOPSExchangeLoader& sHoopsExchangeLoader,
|
||||
A3DImport& sImport,
|
||||
const MY_CHAR* pcPRCFile,
|
||||
const MY_CHAR* pcXMLFile)
|
||||
const MY_CHAR* pcXMLFile,
|
||||
bool bDumpPictures)
|
||||
{
|
||||
A3DUTF8Char sPRCFileUTF8[_MAX_PATH];
|
||||
A3DUTF8Char sXMLFileUTF8[_MAX_PATH];
|
||||
@@ -192,6 +185,10 @@ A3DStatus ProcessFile(
|
||||
treatment->SetAttribute("PRCFile" , sPRCFileUTF8);
|
||||
|
||||
_InitializeFontsArray();
|
||||
|
||||
// if specified, dump pictures from texture material, in an "img" folder next to the XML output
|
||||
if(bDumpPictures)
|
||||
setTextureDirectory(pcXMLFile);
|
||||
|
||||
TEST_RET(ReadFile(sHoopsExchangeLoader, sImport, treatment.get()))
|
||||
|
||||
@@ -203,10 +200,85 @@ A3DStatus ProcessFile(
|
||||
}
|
||||
catch(const std::bad_alloc&)
|
||||
{
|
||||
PrintLogError(NULL, "std::bad_alloc exception caught\n");
|
||||
PrintConstLogError(NULL, "std::bad_alloc exception caught\n");
|
||||
if (doc.get())
|
||||
// try to save what has already been generated
|
||||
doc->SaveFile(sXMLFileUTF8);
|
||||
return A3D_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
#if ( !defined(__ANDROID__) && !defined(APPLE_IOS) ) || TARGET_OS_MACCATALYST == 1
|
||||
//######################################################################################################################
|
||||
void ShowUsage(MY_CHAR** ppcArgv)
|
||||
{
|
||||
if (ppcArgv)
|
||||
MY_PRINTF2("Usage:\n %s [input CAD file] [output XML file] [output LOG file] [-dumppictures]\n", ppcArgv[0]);
|
||||
else
|
||||
MY_PRINTF("Usage:\n PRC2XML [input CAD file] [output XML file] [output LOG file] [-dumppictures]\n");
|
||||
|
||||
MY_PRINTF(" Default output XML file is [input CAD file].xml\n");
|
||||
MY_PRINTF(" Default output LOG file is [output XML file]_Log.txt\n");
|
||||
MY_PRINTF(" If -dumppictures is specified, pictures from texture materials will be exported in an \"img\" folder, next to the XML output\n\n");
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
bool ParseArgs(A3DInt32 iArgc, MY_CHAR** ppcArgv,
|
||||
MY_CHAR(&acSrcFileName)[_MAX_PATH * 2],
|
||||
MY_CHAR(&acDstFileName)[_MAX_PATH * 2],
|
||||
MY_CHAR(&acLogFileName)[_MAX_PATH * 2],
|
||||
unsigned& uPrc2xmlFlagArgs)
|
||||
{
|
||||
if (iArgc == 2)
|
||||
{
|
||||
if (!MY_STRCMP(ppcArgv[1], "-help"))
|
||||
return false;
|
||||
else if (!MY_STRCMP(ppcArgv[1], "-usage"))
|
||||
return false;
|
||||
}
|
||||
|
||||
acSrcFileName[0] = '\0';
|
||||
acDstFileName[0] = '\0';
|
||||
acLogFileName[0] = '\0';
|
||||
|
||||
// parse arguments
|
||||
A3DInt32 iPositionalArg = 0;
|
||||
for (A3DInt32 iArg = 1; iArg < iArgc; ++iArg)
|
||||
{
|
||||
if (!MY_STRCMP(ppcArgv[iArg], "-dumppictures"))
|
||||
{
|
||||
uPrc2xmlFlagArgs |= DUMPPICTURES;
|
||||
}
|
||||
else if (!MY_STRCMP(ppcArgv[iArg], "-dumprelationships"))
|
||||
{
|
||||
uPrc2xmlFlagArgs |= DUMPRELATIONSHIPS;
|
||||
}
|
||||
else if ('-' == ppcArgv[iArg][0])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (iPositionalArg)
|
||||
{
|
||||
case 0: MY_STRCPY(acSrcFileName, ppcArgv[iArg]); break;
|
||||
case 1: MY_STRCPY(acDstFileName, ppcArgv[iArg]); break;
|
||||
case 2: MY_STRCPY(acLogFileName, ppcArgv[iArg]); break;
|
||||
default: break;
|
||||
}
|
||||
++iPositionalArg;
|
||||
}
|
||||
}
|
||||
|
||||
// init default values
|
||||
if (acSrcFileName[0] == '\0')
|
||||
MY_STRCPY(acSrcFileName, DEFAULT_INPUT_CAD);
|
||||
if (acDstFileName[0] == '\0')
|
||||
MY_SPRINTF(acDstFileName, "%s.xml", acSrcFileName);
|
||||
if (acLogFileName[0] == '\0')
|
||||
MY_SPRINTF(acLogFileName, "%s_Log.txt", acDstFileName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user