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 uninitializePlugin(mObj): fnPlugin = MFnPlugin(mObj) #-------------------------------------------------------------------------# # CLEANUP #-------------------------------------------------------------------------# # DELETE WIRE TOOLS MENU ITEM global g_wireToolsMenuItemID if (g_wireToolsMenuItemID != ""): cmds.deleteUI(g_wireToolsMenuItemID, menuItem=True) #-------------------------------------------------------------------------# # DATA #-------------------------------------------------------------------------# # WIRE PROFILE DATA try: fnPlugin.deregisterData(WireProfileData.dataID) except: MGlobal.displayError("Failed to deregister " + WireProfileData.dataName + " data!") #-------------------------------------------------------------------------# # COMMANDS #-------------------------------------------------------------------------# # WIRE MESH FROM CURVE try: fnPlugin.deregisterCommand(WireMeshFromCurveCommand.commandName) except: MGlobal.displayError("Failed to deregister " + WireMeshFromCurveCommand.commandName + " command!") #-------------------------------------------------------------------------# # NODES #-------------------------------------------------------------------------# # WIRE MESH CREATOR NODE try: fnPlugin.deregisterNode(WireMeshCreatorNode.nodeID) except: MGlobal.displayError("Failed to deregister " + WireMeshCreatorNode.nodeName + " node!")