_pluginUnloadedCB = True # BUG: autodesk still has not add python callback support, and calling this as MEL is not getting the plugin name passed to it # mel.unloadPlugin( addCallback='''python("import pymel; pymel._pluginUnloaded('#1')")''' ) if _versions.current() >= _versions.v2009: _logger.debug("Adding pluginUnloaded callback") id = _api.MSceneMessage.addStringArrayCallback( _api.MSceneMessage.kAfterPluginUnload, _pluginUnloaded) if hasattr(id, 'disown'): id.disown() else: _logger.debug("PluginUnloaded callback already exists") # add commands and nodes for plugins loaded prior to importing pymel preLoadedPlugins = cmds.pluginInfo(q=1, listPlugins=1) if preLoadedPlugins: _logger.info("Updating pymel with pre-loaded plugins: %s" % ', '.join(preLoadedPlugins)) for plugin in preLoadedPlugins: _pluginLoaded(plugin) _installCallbacks() # run userSetup.py / initialize MEL... # ...userStartup.py / .mel may try to add plugins and then use their commands / # nodes with pymel... so do the plugin stuff first _startup.finalize()
# BUG: autodesk still has not add python callback support, and calling this as MEL is not getting the plugin name passed to it #mel.unloadPlugin( addCallback='''python("import pymel; pymel._pluginUnloaded('#1')")''' ) if _versions.current() >= _versions.v2009: _logger.debug("Adding pluginUnloaded callback") id = _api.MSceneMessage.addStringArrayCallback( _api.MSceneMessage.kAfterPluginUnload, _pluginUnloaded ) if hasattr(id, 'disown'): id.disown() else: _logger.debug("PluginUnloaded callback already exists") # add commands and nodes for plugins loaded prior to importing pymel preLoadedPlugins = cmds.pluginInfo( q=1, listPlugins=1 ) if preLoadedPlugins: _logger.info("Updating pymel with pre-loaded plugins: %s" % ', '.join( preLoadedPlugins )) for plugin in preLoadedPlugins: _pluginLoaded( plugin ) _installCallbacks() # run userSetup.py / initialize MEL... # ...userStartup.py / .mel may try to add plugins and then use their commands / # nodes with pymel... so do the plugin stuff first _startup.finalize()