// ***************************************************************************** MPxFileTranslator::MFileKind GtoIO::identifyFile( const MFileObject &file, const char *magic, short magicSize ) const { if( magicSize < 4 ) { return MPxFileTranslator::kNotMyFileType; } const unsigned int magicInt = *((unsigned int *)magic ); if( magicInt == Gto::Header::Magic || magicInt == Gto::Header::Cigam ) { return MPxFileTranslator::kIsMyFileType; } const char gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ if( magic[0] == gz_magic[0] && magic[1] == gz_magic[1] ) { if( strstr( file.name().asChar(), ".gto" ) ) { return MPxFileTranslator::kIsMyFileType; } } return MPxFileTranslator::kNotMyFileType; }
MPxFileTranslator::MFileKind NifTranslator::identifyFile(const MFileObject& fileName, const char* buffer, short size) const { MString fName = fileName.name(); if (fName.toUpperCase() != "NIF" && fName.toUpperCase() != "KF") return kNotMyFileType; return kIsMyFileType; }
MPxFileTranslator::MFileKind metro_model_translator::identifyFile(const MFileObject &file, const char *buffer, short size) const { MString name = file.name(); MString ext = name.substring( name.rindex( '.' ), name.length() ).toLowerCase(); if( ext != MString( ".model" ) ) return MPxFileTranslator::kNotMyFileType; return MPxFileTranslator::kIsMyFileType; }
MPxFileTranslator::MFileKind DCTranslator::identifyFile( const MFileObject &fileName, const char *, short) const { const char * name = fileName.name().asChar(); size_t nameLength = strlen(name); if ((nameLength > 14) && !_stricmp(name + nameLength - 7, MAYA_TRANSLATOR_EXT)) return kCouldBeMyFileType; else return kNotMyFileType; }
MPxFileTranslator::MFileKind FileTranslator::identifyFile ( const MFileObject &fileObject, const char *buffer, short size ) const { // Just check for the proper extension for now MFileKind rval = kNotMyFileType; int extLocation = fileObject.name().rindex ( '.' ); if ( extLocation > 0 ) { MString ext = fileObject.name().substring ( extLocation + 1, fileObject.name().length()-1 ).toLowerCase(); if ( ext == "dae" || ext == "xml" ) { rval = kIsMyFileType; } } return rval; }
MPxFileTranslator::MFileKind ObjTranslator::identifyFile ( const MFileObject& fileName, const char* buffer, short size) const { const char * name = fileName.name().asChar(); int nameLength = strlen(name); if ((nameLength > 4) && !strcasecmp(name+nameLength-4, ".dae")) return kCouldBeMyFileType; else return kNotMyFileType; }
MPxFileTranslator::MFileKind CXRayCameraExport::identifyFile ( const MFileObject& fileName, const char* buffer, short size) const { const char * name = fileName.name().asChar(); int nameLength = xr_strlen(name); if ((nameLength > 4) && !stricmp(name+nameLength-4, ".anm")) return kCouldBeMyFileType; else return kNotMyFileType; }
MPxFileTranslator::MFileKind atomExport::identifyFile( const MFileObject& fileName, const char* buffer, short size) const { const char *name = fileName.name().asChar(); int nameLength = (int)strlen(name); if ((nameLength > 5) && !strcasecmp(name+nameLength-5, ".atom")) { return kIsMyFileType; } return kNotMyFileType; }
OSGFileTranslator::MFileKind OSGFileTranslator::identifyFile (const MFileObject &file, const char *buffer, short size) const { std::string filename = file.name().asChar(); if ( filename.substr( filename.size()-4, 4 ).compare(".osg") ) return kIsMyFileType; else if ( filename.substr( filename.size()-4, 4 ).compare(".ive") ) return kIsMyFileType; else if ( filename.substr( filename.size()-5, 5 ).compare(".osgt") ) return kIsMyFileType; else if ( filename.substr( filename.size()-5, 5 ).compare(".osgb") ) return kIsMyFileType; else if ( filename.substr( filename.size()-5, 5 ).compare(".osgx") ) return kIsMyFileType; return kNotMyFileType; }
MPxFileTranslator::MFileKind XFileTranslator::identifyFile( const MFileObject& fileName, const char* buffer, short size) const { LPSTR extension = PathFindExtensionA(fileName.name().asChar()); if(0==lstrcmpA(extension, ".x")) { return kIsMyFileType; } else { return kNotMyFileType; } }
// // Maya calls this method to find out if this translator is capable of // handling the given file. // MPxFileTranslator::MFileKind maTranslator::identifyFile( const MFileObject& file, const char* buffer, short bufferLen ) const { MString tagStr = comment(fTranslatorName); int tagLen = tagStr.length(); // // If the buffer contains enough info to positively identify the file, // then use it. Otherwise we'll base the identification on the file // extension. // if (bufferLen >= tagLen) { MString initialContents(buffer, bufferLen); MStringArray initialLines; initialContents.split('\n', initialLines); if (initialLines.length() > 0) { if (((int)initialLines[0].length() >= tagLen) && (initialLines[0].substring(0, tagLen-1) == tagStr)) { return kIsMyFileType; } } } else { MString fileName(file.name()); int fileNameLen = fileName.length(); int startOfExtension = fileName.rindex('.') + 1; if ((startOfExtension > 0) && (startOfExtension < fileNameLen) && (fileName.substring(startOfExtension, fileNameLen) == fExtension)) { return kIsMyFileType; } } return kNotMyFileType; }
MPxFileTranslator::MFileKind CVsDmxIOTranslator::identifyFile( const MFileObject &i_mFileObject, const char * /* i_buffer */, const short /* i_size */ ) const { MFileKind retVal( kNotMyFileType ); const MString &name( i_mFileObject.name() ); if ( name.length() ) { if ( name.substring( name.rindex( '.' ) + 1, name.length() - 1 ) == MString( "dmx" ) ) { retVal = kIsMyFileType; } } return retVal; }
MPxFileTranslator::MFileKind atomImport::identifyFile( const MFileObject& fileName, const char* buffer, short size) const { const char *name = fileName.name().asChar(); int nameLength = (int)strlen(name); if ((nameLength > 5) && !strcasecmp(name+nameLength-5, ".atom")) { return kIsMyFileType; } // Check the buffer to see if this contains the correct keywords // to be a anim file. // if (strncmp(buffer, "atomVersion", 11) == 0) { return kIsMyFileType; } return kNotMyFileType; }
// Write method of the GE2.0 translator / file exporter MStatus ge2Translator::writer ( const MFileObject & fileObject, const MString & options, MPxFileTranslator::FileAccessMode mode) { char LTmpStr[MAXPATHLEN]; unsigned int i, LN; // const MString fname = fileObject.fullName (); MString extension; MString baseFileName; // Lets strip off the known extension of .grp if it is there. extension.set (".grp"); int extLocation = fileObject.name ().rindex ('.'); if ( (extLocation != -1) && // no '.' in name (extLocation != 0) && // name was ".grp" -- that's ok?? (fileObject.name ().substring (extLocation, fileObject.name ().length () - 1) == extension) ) { baseFileName = fileObject.name ().substring (0, extLocation - 1); } else { baseFileName = fileObject.name (); extension.clear (); } geWrapper.setBaseFileName( baseFileName ); geWrapper.setPathName( fileObject.fullName() ); geWrapper.pluginVersion = version; // Set the directory at the Dt level strncpy( LTmpStr, geWrapper.getPathName().asChar(), MAXPATHLEN ); LN = (int)strlen( LTmpStr ); if ( LTmpStr[LN - 1] == '/' ) LTmpStr[LN - 1] = '\0'; DtSetDirectory( LTmpStr ); // in an ideal world, everything in setDefaults() should be overridden // with the option parsing. If the mel script doesn't get run for whatever // reason, or neglects to return some values, hopefully setDefaults will // enable the export to go through anyway geWrapper.setDefaults(); // Turn off this pesky warning on NT - performance warning // for int -> bool conversion. #ifdef WIN32 #pragma warning ( disable : 4800 ) #endif // Lets now do all of the option processing if ( options.length () > 0 ) { //Start parsing. MStringArray optionList; MStringArray theOption; options.split(';', optionList); //break out all the options. for ( i = 0; i < optionList.length (); ++i ) { theOption.clear (); optionList[i].split( '=', theOption ); if ( theOption.length () > 1 ) { if ( theOption[0] == MString( "enableAnim" ) ) { geWrapper.enableAnim = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "animStart" ) ) { geWrapper.frameStart = (int) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "animEnd" ) ) { geWrapper.frameEnd = (int) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "animStep" ) ) { geWrapper.frameStep = (int) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "animVertices" ) ) { geWrapper.animVertices = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "animDisplacement" ) ) { if ( theOption[1].asInt() == 1 ) geWrapper.vertexDisplacement = ge2Wrapper::kVDRelative; else geWrapper.vertexDisplacement = ge2Wrapper::kVDAbsolute; } else if ( theOption[0] == MString( "animTransforms" ) ) { geWrapper.animTransforms = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "animShaders" ) ) { geWrapper.animShaders = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "animLights" ) ) { geWrapper.animLights = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "animCamera" ) ) { geWrapper.animCamera = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "keyCurves" ) ) { geWrapper.keyCurves = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "keySample" ) ) { geWrapper.keySample = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "sampRate" ) ) { geWrapper.sampleRate = (int) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "sampTol" ) ) { geWrapper.sampleTolerance = (float) ( theOption[1].asFloat() ); } else if ( theOption[0] == MString( "useGL" ) ) { geWrapper.useDomainGL = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "usePSX" ) ) { geWrapper.useDomainPSX = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "useN64" ) ) { geWrapper.useDomainN64 = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "useCustom" ) ) { geWrapper.useDomainCustom = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "hrcType" ) ) { geWrapper.hrcMode = static_cast <ge2Wrapper::GEHrcMode> ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "exportSel" ) ) { geWrapper.selType = static_cast <ge2Wrapper::GESelType> ( theOption[1].asInt() ); if ( (mode == MPxFileTranslator::kExportActiveAccessMode) && (geWrapper.selType == ge2Wrapper::kSelAll) ) { geWrapper.selType = ge2Wrapper::kSelActive; } } else if ( theOption[0] == MString( "exportLights" ) ) { geWrapper.outputLights = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "exportCamera" ) ) { geWrapper.outputCamera = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "exportJoints" ) ) { geWrapper.outputJoints = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "exportNormals" ) ) { geWrapper.outputNormals = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "opposite" ) ) { geWrapper.oppositeNormals = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "exportGeometry" ) ) { geWrapper.outputGeometry = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "reverse" ) ) { geWrapper.reverseWinding = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "exportTextures" ) ) { geWrapper.outputTextures = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "tesselation" ) ) { if ( theOption[1].asInt() == 2 ) DtExt_setTesselate( kTESSQUAD ); else DtExt_setTesselate( kTESSTRI ); } else if ( theOption[0] == MString( "texsample" ) ) { geWrapper.sampleTextures = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "texevaluate" ) ) { geWrapper.evalTextures = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "texOriginal" ) ) { geWrapper.useOriginalFileTextures = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "Xtexres" ) ) { geWrapper.xTexRes = (int) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "Ytexres" ) ) { geWrapper.yTexRes = (int) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "MaxXtexres" ) ) { geWrapper.xMaxTexRes = (int) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "MaxYtexres" ) ) { geWrapper.yMaxTexRes = (int) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "texType" ) ) { geWrapper.texType = theOption[1]; } else if ( theOption[0] == MString( "precision" ) ) { geWrapper.precision = (int) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "format" ) ) { geWrapper.useTabs = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "comments" ) ) { geWrapper.writeComments = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "verboseGeom" ) ) { geWrapper.verboseGeom = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "verboseLgt" ) ) { geWrapper.verboseLgt = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "verboseCam" ) ) { geWrapper.verboseCam = (bool) ( theOption[1].asInt() ); } else if ( theOption[0] == MString( "script" ) ) { geWrapper.userScript = theOption[1]; } else if ( theOption[0] == MString( "scriptAppend" ) ) { geWrapper.scriptAppendFileName = (int) ( theOption[1].asInt() ); } } } } #ifdef WIN32 #pragma warning ( default : 4800 ) #endif geWrapper.initScene(); // do some initialization geWrapper.writeScene(); // write it to the appropriate files geWrapper.killScene(); // clean-up return MS::kSuccess; }
// // Maya calls this method to have the translator write out a file. // MStatus maTranslator::writer( const MFileObject& file, const MString& /* options */, MPxFileTranslator::FileAccessMode mode ) { // // For simplicity, we only do full saves/exports. // if ((mode != kSaveAccessMode) && (mode != kExportAccessMode)) return MS::kNotImplemented; // // Let's see if we can open the output file. // fstream output(file.fullName().asChar(), ios::out | ios::trunc); if (!output.good()) return MS::kNotFound; // // Get some node flags to keep track of those nodes for which we // have already done various stages of processing. // MStatus status; fCreateFlag = MFnDependencyNode::allocateFlag(fPluginName, &status); if (status) fAttrFlag = MFnDependencyNode::allocateFlag(fPluginName, &status); if (status) fConnectionFlag = MFnDependencyNode::allocateFlag(fPluginName, &status); if (!status) { MGlobal::displayError( "Could not allocate three free node flags." " Try unloading some other plugins." ); return MS::kFailure; } // // Run through all of the nodes in the scene and clear their flags. // MItDependencyNodes nodesIter; for (; !nodesIter.isDone(); nodesIter.next()) { MObject node = nodesIter.item(); MFnDependencyNode nodeFn(node); nodeFn.setFlag(fCreateFlag, false); nodeFn.setFlag(fAttrFlag, false); nodeFn.setFlag(fConnectionFlag, false); } // // Write out the various sections of the file. // writeHeader(output, file.name()); writeFileInfo(output); writeReferences(output); writeRequirements(output); writeUnits(output); writeDagNodes(output); writeNonDagNodes(output); writeDefaultNodes(output); writeReferenceNodes(output); writeConnections(output); writeFooter(output, file.name()); output.close(); MFnDependencyNode::deallocateFlag(fPluginName, fCreateFlag); return MS::kSuccess; }
MStatus rtgTranslator::writer ( const MFileObject & fileObject, const MString & options, MPxFileTranslator::FileAccessMode mode) { char LTmpStr[MAXPATHLEN]; unsigned int i; int LN; const MString fname = fileObject.fullName (); MString extension; MString baseFileName; int TimeSlider = 0; int AnimEnabled = 0; // Lets strip off the known extension of .rtg if it is there. extension.set (".rtg"); int extLocation = fileObject.name ().rindex ('.'); if (extLocation > 0 && fileObject.name ().substring (extLocation, fileObject.name ().length () - 1) == extension) { baseFileName = fileObject.name ().substring (0, extLocation - 1); } else { baseFileName = fileObject.name (); extension.clear (); } DtExt_SceneInit( (char *)baseFileName.asChar() ); // Lets now do all of the option processing if (options.length () > 0) { //Start parsing. MStringArray optionList; MStringArray theOption; options.split (';', optionList); //break out all the options. for ( i = 0; i < optionList.length (); ++i) { theOption.clear (); optionList[i].split ('=', theOption); if (theOption.length () > 1) { if (theOption[0] == MString ("v18compatible")) { rtg_v18_compatible = (int) (theOption[1].asInt() ); } else if (theOption[0] == MString ("timeslider")) { TimeSlider = (int) (theOption[1].asInt ()); } else if (theOption[0] == MString ("animEnabled")) { AnimEnabled = (int) (theOption[1].asInt ()); } else if (theOption[0] == MString ("animStart")) { DtFrameSetStart( (int) (theOption[1].asInt ()) ); } else if (theOption[0] == MString ("animEnd")) { DtFrameSetEnd( (int) (theOption[1].asInt ()) ); } else if (theOption[0] == MString ("animStep")) { DtFrameSetBy( (int) (theOption[1].asInt ()) ); } else if (theOption[0] == MString ("hrcType")) { switch ( theOption[1].asInt () - 1) { case VRHRC_FLAT: DtExt_setOutputTransforms (kTRANSFORMMINIMAL); DtExt_setParents (0); break; case VRHRC_WORLD: DtExt_setOutputTransforms (kTRANSFORMNONE); DtExt_setParents (0); break; case VRHRC_FULL: default: DtExt_setOutputTransforms (kTRANSFORMALL); DtExt_setParents (1); break; } } else if (theOption[0] == MString ("joints")) { // Allow user to specify if the hierarchy should include // NULL geometry nodes - usually joints DtExt_setJointHierarchy( theOption[1].asInt() ); } else if (theOption[0] == MString ("exportSel")) { switch ( theOption[1].asInt () - 1) { case VRSEL_ALL: DtExt_setWalkMode (ALL_Nodes); break; case VRSEL_ACTIVE: DtExt_setWalkMode (ACTIVE_Nodes); break; case VRSEL_PICKED: DtExt_setWalkMode (PICKED_Nodes); break; } } else if (theOption[0] == MString ("texsample")) { // Allow user to specify if the textures should be sampled // with the Texture Placement options DtExt_setSoftTextures ( theOption[1].asInt() ); } else if (theOption[0] == MString ("texevaluate")) { // Allow the user to specify if the tex should be eval with // convertSolidTx command or read in if is a file texture. DtExt_setInlineTextures( theOption[1].asInt() ); } else if (theOption[0] == MString ("texoriginal")) { // Allow the user to specify if the tex should be eval at all. DtExt_setOriginalTexture( theOption[1].asInt() ); } else if (theOption[0] == MString ("Xtexres")) { // Set the X size of the texture swatches to use DtExt_setXTextureRes ( theOption[1].asInt () ); } else if (theOption[0] == MString ("Ytexres")) { // Set the Y size of the texture swatches to use DtExt_setYTextureRes ( theOption[1].asInt () ); } else if (theOption[0] == MString ("MaxXtexres")) { // Set the Max X size of the texture swatches to use DtExt_setMaxXTextureRes( theOption[1].asInt () ); } else if (theOption[0] == MString ("MaxYtexres")) { // Set the Max Y size of the texture swatches to use DtExt_setMaxYTextureRes( theOption[1].asInt () ); } else if (theOption[0] == MString ("precision")) { //VR_Precision = theOption[1].asInt (); } else if (theOption[0] == MString ("verbose")) { // DtExt_setDebug ( theOption[1].asInt () ); } else if (theOption[0] == MString ("debug")) { int levelG = DtExt_Debug(); if ( (int) (theOption[1].asInt () ) ) levelG |= DEBUG_GEOMAT; else levelG &= ~DEBUG_GEOMAT; DtExt_setDebug( levelG ); } else if (theOption[0] == MString ("debugC")) { int levelC = DtExt_Debug(); if ( (int) (theOption[1].asInt () ) ) levelC |= DEBUG_CAMERA; else levelC &= ~DEBUG_CAMERA; DtExt_setDebug( levelC ); } else if (theOption[0] == MString ("debugL")) { int levelL = DtExt_Debug(); if ( (int) (theOption[1].asInt () ) ) levelL |= DEBUG_LIGHT; else levelL &= ~DEBUG_LIGHT; DtExt_setDebug( levelL ); } else if (theOption[0] == MString ("reversed")) { DtExt_setWinding( theOption[1].asInt() ); } else if (theOption[0] == MString ("tesselation")) { if ( theOption[1].asInt() == 2 ) { DtExt_setTesselate( kTESSQUAD ); } else { DtExt_setTesselate( kTESSTRI ); } // // Now come the translator specific options // } else if (theOption[0] == MString ("imageformat")) { rtg_output_image_format = theOption[1].asInt(); } else if (theOption[0] == MString ("fileformat")) { rtg_output_file_format = theOption[1].asInt(); } else if (theOption[0] == MString ("vnormals")) { rtg_output_vert_norms = theOption[1].asInt(); } else if (theOption[0] == MString ("vcolors")) { rtg_output_vert_colors = theOption[1].asInt(); } else if (theOption[0] == MString ("tcoords")) { rtg_output_tex_coords = theOption[1].asInt(); } else if (theOption[0] == MString ("pnormals")) { rtg_output_poly_norms = theOption[1].asInt(); } else if (theOption[0] == MString ("idxcnt")) { rtg_show_index_counters = theOption[1].asInt(); } else if (theOption[0] == MString ("anglesdeg")) { rtg_output_degrees = theOption[1].asInt(); } else if (theOption[0] == MString ("materials")) { rtg_output_materials = theOption[1].asInt(); } else if (theOption[0] == MString ("multitexture")) { DtExt_setMultiTexture( theOption[1].asInt() ); } else if (theOption[0] == MString ("mdecomp")) { rtg_output_decomp = theOption[1].asInt(); } else if (theOption[0] == MString ("pivoth")) { rtg_output_pivots = theOption[1].asInt(); } else if (theOption[0] == MString ("transforms")) { rtg_output_transforms = theOption[1].asInt(); } else if (theOption[0] == MString ("ltransforms")) { rtg_output_local = theOption[1].asInt(); } else if (theOption[0] == MString ("animation")) { rtg_output_animation = theOption[1].asInt(); } else if (theOption[0] == MString ("allnodes")) { rtg_output_all_nodes = theOption[1].asInt(); } else if (theOption[0] == MString ("script")) { scriptToRun = theOption[1]; } else if (theOption[0] == MString ("scriptAppend")) { scriptAppend = (int)(theOption[1].asInt() ); } } } } // Lets see how we entered this plug-in, either with the export all // or export selection flag set. if ( mode == MPxFileTranslator::kExportActiveAccessMode ) { DtExt_setWalkMode ( ACTIVE_Nodes ); } // Lets check the TimeSlider control now: if ( TimeSlider ) { MTime start( MAnimControl::minTime().value(), MTime::uiUnit() ); DtFrameSetStart( (int) start.value() ); MTime end( MAnimControl::maxTime().value(), MTime::uiUnit() ); DtFrameSetEnd( (int) end.value() ); } // Now see if the animation is really enabled. // Else we will set the end frame to the beginning frame automatically if ( !AnimEnabled ) { DtFrameSetEnd( DtFrameGetStart() ); } // Find out where the file is supposed to end up. MDt_GetPathName ((char *) (fname.asChar ()), LTmpStr, MAXPATHLEN); LN = (int)strlen (LTmpStr); if (LTmpStr[LN - 1] == '/') LTmpStr[LN - 1] = '\0'; DtSetDirectory (LTmpStr); // Now lets setup some paths to do basic texture file searching // for those textures with relative paths MStringArray wSpacePaths; MStringArray rPaths; MString usePath; MString separator; MGlobal::executeCommand( "workspace -q -rd", wSpacePaths ); MGlobal::executeCommand( "workspace -q -rtl", rPaths ); if ( DtExt_getTextureSearchPath() ) separator.set( "|" ); else separator.set( "" ); for (i = 0; i < wSpacePaths.length (); ++i) { for ( unsigned int j = 0; j < rPaths.length(); j++ ) { usePath = usePath + separator + wSpacePaths[i] + MString( "/" ) + rPaths[j]; separator.set( "|" ); if ( rPaths[j] == MString( "sourceImages" ) ) usePath = usePath + separator + wSpacePaths[i] + MString( "/" ) + MString( "sourceimages" ); } } DtExt_addTextureSearchPath( (char *)usePath.asChar() ); // Now we can setup the database from the wire file geometry. // This is where all the Maya data are retrieved, cached, and processed. // // Say that we want to have camera info DtExt_setOutputCameras( 1 ); //Now we can setup the database from the wire file geometry DtExt_dbInit(); DtFrameSet( DtFrameGetStart() ); // Now do the export rtgExport(); // Now lets see if the user wants something else to be done if ( 0 < scriptToRun.length() ) { if ( scriptAppend ) { scriptToRun += MString( " " ) + MString( LTmpStr ); } system( scriptToRun.asChar() ); } // Clean house. // DtExt_CleanUp(); return MS::kSuccess; }