29 #include "../../idlib/precompiled.h"
32 #include "../Game_local.h"
33 #include "../../MayaImport/maya_main.h"
41 static idStr Maya_Error;
45 static int importDLL = 0;
93 lres = RegOpenKey( HKEY_LOCAL_MACHINE,
"SOFTWARE\\Alias|Wavefront\\Maya\\4.5\\Setup\\InstallPath", &hKey );
95 if ( lres != ERROR_SUCCESS ) {
99 lres = RegQueryValueEx( hKey,
"MAYA_INSTALL_LOCATION",
NULL, (
unsigned long*)&lType, (
unsigned char*)
NULL, (
unsigned long*)
NULL );
103 if ( lres != ERROR_SUCCESS ) {
112 lres = RegOpenKey( HKEY_LOCAL_MACHINE,
"SOFTWARE\\Alias|Wavefront\\Maya", &hKey );
115 if ( lres != ERROR_SUCCESS ) {
134 if ( !dllPath[ 0 ] ) {
176 ID_TIME_T sourceTime;
184 Maya_Error =
"MayaImport dll not loaded.";
227 Maya_Error =
"Maya not installed in registry.";
235 Maya_Error =
"Could not load MayaImport dll.";
256 if ( Maya_Error !=
"Ok" ) {
283 if ( strlen(game) == 0 ) {
308 if ( strlen(game) == 0 ) {
337 lex.
Error(
"Expected filename" );
345 if ( token ==
"-" ) {
347 lex.
Error(
"Expecting option" );
350 if ( token ==
"sourcedir" ) {
352 lex.
Error(
"Missing pathname after -sourcedir" );
356 }
else if ( token ==
"destdir" ) {
358 lex.
Error(
"Missing pathname after -destdir" );
362 }
else if ( token ==
"dest" ) {
364 lex.
Error(
"Missing filename after -dest" );
376 if ( sourcedir.
Length() ) {
399 idStr defaultCommands;
407 if ( strlen(game) == 0 ) {
437 parser.
Error(
"Unexpoected end-of-file" );
441 if ( command ==
"}" ) {
445 if ( command ==
"options" ) {
447 }
else if ( command ==
"addoptions" ) {
449 defaultCommands +=
" ";
450 defaultCommands += temp;
451 }
else if ( ( command ==
"mesh" ) || ( command ==
"anim" ) || ( command ==
"camera" ) ) {
453 parser.
Error(
"Expected filename" );
459 if ( defaultCommands.
Length() ) {
472 if ( strlen(game) == 0 ) {
476 if ( command ==
"mesh" ) {
478 }
else if ( command ==
"anim" ) {
480 }
else if ( command ==
"camera" ) {
490 parser.
Warning(
"Failed to export '%s' : %s",
src.c_str(), Maya_Error.
c_str() );
495 parser.
Error(
"Unknown token: %s", command.
c_str() );
516 if ( !parser.
LoadFile( filename ) ) {
522 if ( token ==
"export" ) {
void Error(const char *str,...) const id_attribute((format(printf
idStr & SetFileExtension(const char *extension)
virtual idFileList * ListFiles(const char *relativePath, const char *extension, bool sort=false, bool fullRelativePath=false, const char *gamedir=NULL)=0
idCVarSystem * cvarSystem
void Printf(const char *fmt,...) const id_attribute((format(printf
const char * Maya_ConvertModel(const char *ospath, const char *commandline)
virtual int ReadFile(const char *relativePath, void **buffer, ID_TIME_T *timestamp=NULL)=0
void void void void void Error(const char *fmt,...) const id_attribute((format(printf
int GetNumFiles(void) const
idFileSystem * fileSystem
#define MD5_VERSION_STRING
bool ExportAnim(const char *anim)
int ExpectTokenString(const char *string)
bool dllEntry(int version, idCommon *common, idSys *sys)
int Icmp(const char *text) const
idStr & BackSlashesToSlashes(void)
void ExtractFilePath(idStr &dest) const
bool ParseOptions(idLexer &lex)
int ReadToken(idToken *token)
void Error(const char *str,...) id_attribute((format(printf
virtual void * DLL_GetProcAddress(int dllHandle, const char *procName)=0
GLuint GLuint GLsizei count
int ExportDefFile(const char *filename)
virtual int DLL_Load(const char *dllName)=0
virtual const char * GetCVarString(const char *name) const =0
const char * GetFile(int index) const
void void Warning(const char *str,...) const id_attribute((format(printf
bool ExportModel(const char *model)
virtual void FreeFileList(idFileList *fileList)=0
int ExportModels(const char *pathname, const char *extension)
int LoadMemory(const char *ptr, int length, const char *name, int startLine=1)
virtual const char * RelativePathToOSPath(const char *relativePath, const char *basePath="fs_devpath")=0
bool(* exporterDLLEntry_t)(int version, idCommon *common, idSys *sys)
const char * GetString(void) const
virtual void DLL_Unload(int dllHandle)=0
int ParseExportSection(idParser &parser)
static void LoadMayaDll(void)
int LoadFile(const char *filename, bool OSPath=false)
void(* exporterShutdown_t)(void)
const char * ParseRestOfLine(idStr &out)
int CheckTokenString(const char *string)
int SkipBracedSection(bool parseFirstBrace=true)
static void Shutdown(void)
const char * c_str(void) const
idCVar g_exportMask("g_exportMask","", CVAR_GAME,"")
static bool CheckMayaInstall(void)
virtual void CreateOSPath(const char *OSPath)=0
virtual void SetRefreshOnPrint(bool set)=0
char * va(const char *fmt,...)
virtual void FindDLL(const char *basename, char dllPath[MAX_OSPATH], bool updateChecksum)=0
int ReadToken(idToken *token)
const char *(* exporterInterface_t)(const char *ospath, const char *commandline)
int sprintf(idStr &string, const char *fmt,...)
const char * GetFileName(void) const
bool ConvertMayaToMD5(void)