MStatus initializePlugin (MObject obj) { MStatus status; char version[256]; strcpy( version, rtgVersion ); strcat( version, "." ); strcat( version, DtAPIVersion() ); MFnPlugin plugin (obj, "RTG Translator for Maya", version, "Any"); //Register the translator with the system status = plugin.registerFileTranslator ("rtg", "rtgTranslator.rgb", rtgTranslator::creator, "rtgTranslatorOpts", "", true); if (!status) { status.perror ("registerFileTranslator"); //return status; } return status; }
//----------------------------------------------------------------------------- // Register //----------------------------------------------------------------------------- MStatus CVsMayaMPxFileTranslator::Register( MFnPlugin &pluginFn, const MString &name, const MString &guiName, MCreatorFunction creatorFunction ) { const MString pixmapName( name + ".xpm" ); const MString optionsScriptName( name + "TranslatorOptions" ); return pluginFn.registerFileTranslator( guiName, const_cast<char *>( pixmapName.asChar() ), creatorFunction, const_cast<char *>( optionsScriptName.asChar() ), "", false ); }
MStatus initializePlugin (MObject obj) { MFnPlugin plug (obj, "Rk", "0.1"); plug.registerFileTranslator ("Adventure", nullptr, Ad::create_trans); return MS::kSuccess; }
// // Description: // this method is called when the plug-in is loaded into Maya. // It registers all of the services that this plug-in provides with Maya. // // Arguments: // obj - a handle to the plug-in object (use MFnPlugin to access it) // MStatus MLL_EXPORT initializePlugin ( MObject obj ) { //_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); MStatus status; #ifdef _DEBUG // Activate the error logging MGlobal::startErrorLogging(); #endif // The default name of this file is OpenMayaErrorLog located in the // current directory. This can be changed, however, by calling: //MGlobal::setErrorLogPathName("..."); std::ostringstream stream; stream << MAYA_API_VERSION; COLLADAMaya::String revision ( COLLADAMaya::TRANSLATOR_VERSION ); revision += "." + COLLADAMaya::CURRENT_REVISION; if (COLLADAMaya::CURRENT_SHA1.compare("undefined") != 0) { revision += "__sha1__" + COLLADAMaya::CURRENT_SHA1; } MFnPlugin plugin ( obj, COLLADAMaya::TRANSLATOR_VENDOR, revision.c_str (), stream.str ().c_str () ); // -------------------------------------------------------------- // Register the import and the export file translator plug-ins. // Export plug-in status = plugin.registerFileTranslator ( COLLADAMaya::COLLADA_EXPORTER, "", // pathname of the icon used in file selection dialogs COLLADAMaya::FileTranslator::createExporter, // this class implements the new file type (char*)COLLADAMaya::MEL_EXPORT_OPTS, // name of a MEL script that will be used to display the contents of the options dialog during file open and save NULL ); // defaultOptionsString if ( !status ) { status.perror ( "registerFileTranslator" ); MGlobal::displayWarning ( MString ( "Unable to register OpenCOLLADA exporter: " ) + status ); return status; } // Import plug-in status = plugin.registerFileTranslator ( COLLADAMaya::COLLADA_IMPORTER, "", COLLADAMaya::FileTranslator::createImporter, (char*)COLLADAMaya::MEL_IMPORT_OPTS, NULL ); if ( !status ) { status.perror ( "registerFileTranslator" ); MGlobal::displayWarning ( MString ( "Unable to register OpenCOLLADA importer: " ) + status ); } // TODO MString UserClassify("shader/surface/utility"); #if MAYA_API_VERSION >= 700 // Don't initialize swatches in batch mode if (MGlobal::mayaState() != MGlobal::kBatch) { const MString& swatchName = MHWShaderSwatchGenerator::initialize(); UserClassify = MString("shader/surface/utility/:swatch/"+swatchName); } #endif // MAYA_API_VERSION >= 700 return status; }