def __init__(self, mObj): self.mObject = mObj plugin_queue = [i for i in self.KNOWN if i not in (CommandBase, UndoableBase)] for plugin in plugin_queue: MGlobal.displayInfo("deregistering plugin %s" % plugin) plugin_obj = MFnPlugin(mObj) try: plugin_obj.deregisterCommand(plugin.NAME) except: MGlobal.displayError("Unable to unload plugin %s" % plugin) finally: self.KNOWN.remove(plugin)
def __init__(self, mObj): self.mObject = mObj plugin_queue = [i for i in self.KNOWN if i not in (CommandBase, UndoableBase)] for plugin in plugin_queue: MGlobal.displayInfo("registering plugin %s" % plugin) vendor = getattr(plugin, 'VENDOR', 'plugger module') version = getattr(plugin, 'VERSION', "0.9") apiversion = getattr(plugin, "API_VERSION", "Any") plugin_obj = MFnPlugin(mObj, vendor, version, apiversion) try: plugin_obj.registerCommand(plugin.NAME, plugin.creator, plugin.syntax) except RuntimeError as e: MGlobal.displayError("Unable to load plugin %s" % plugin) MGlobal.displayError(traceback.format_exc(e)) finally: self.KNOWN.remove(plugin)