def uninitializePlugin(mobject): pmc.commandPort(n=':1923', cl=True) mplugin = OpenMaya.MFnPlugin(mobject) try: mplugin.deregisterCommand(ConnectAttributeCommand.commandName) except: sys.stderr.write('Failed to unregister command: ' + ConnectAttributeCommand.commandName) raise try: mplugin.deregisterCommand(ConnectTimeCommand.commandName) except: sys.stderr.write('Failed to unregister command: ' + ConnectTimeCommand.commandName) raise try: mplugin.deregisterCommand(UpdateChannelCommand.commandName) except: sys.stderr.write('Failed to unregister command: ' + UpdateChannelCommand.commandName) raise try: mplugin.deregisterCommand(GUIControlsCommand.commandName) except: sys.stderr.write('Failed to unregister command: ' + GUIControlsCommand.commandName) raise
def open_port(lang="python"): port = Config.get(LunaVars.command_port, default=7221) if not pm.commandPort("127.0.0.1:{0}".format(port), n=1, q=1): try: pm.commandPort(name="127.0.0.1:{0}".format(port), stp="python", echoOutput=True) Logger.info("Command port opened: Python - {0}".format(port)) except Exception as e: Logger.exception("Failed to open command port", exc_info=e)
def startup_deferred(): logger.info("Backspace Deferred Startup Procedure") import pymel.core as pmc pipe_path = pmc.Path(__file__).parent.parent maya_project_path = "//am-ca-fs02/cg2/04_workflow" #maya_project_path = pmc.Path(__file__).splitdrive()[0] / "/04_workflow" # DragnDrop Feature dragndrop_script_path = pipe_path / "backspace_pipe" / "mel" / "performFileDropAction.mel" pmc.mel.evalDeferred('source "{}"'.format( dragndrop_script_path.replace("\\", "/"))) # Set Project global project_setup if not project_setup: try: pmc.mel.eval('setProject "{}"'.format(maya_project_path)) except RuntimeError as e: logger.warning( "Could not set project at {}".format(maya_project_path)) # Port Setup global port_setup if not port_setup: try: pmc.commandPort(name=":7002", sourceType="python") except RuntimeError as e: pmc.warning(e) port_setup = True # Hotkey Setup global hotkeys_setup if not hotkeys_setup: if pmc.hotkeySet("BackspaceHotkeys", query=True, exists=True): pmc.hotkeySet("BackspaceHotkeys", edit=True, current=True) else: pmc.hotkeySet(edit=True, ip=pipe_path + "/BackspaceHotkeys.mhk") hotkeys_setup = True
def OpenCommandPort(): #srcType='mel' pm.commandPort(n=(":"+str(KinectTest_IntFieldGrp_CmdPort.getValue1())))
def tearDown(self): pm.commandPort(n=':54321', cl=True)
def setUp(self): pm.commandPort(n=':54321', stp='python')
from PySide import QtGui, QtCore import pymel.core as pm # PyCharm if not pm.commandPort(':4434', q=True): pm.commandPort(n=':4434') def removeInvalidClipboardData(): oldMimeData = QtGui.qApp.clipboard().mimeData() newMimeData = QtCore.QMimeData() for format in oldMimeData.formats(): if 'text/uri-list' in format: #This breaks maya paste continue data = oldMimeData.data(format) newMimeData.setData(format, data) clipboard = QtGui.qApp.clipboard() clipboard.blockSignals(True) clipboard.setMimeData(newMimeData) clipboard.blockSignals(False) QtGui.qApp.clipboard().dataChanged.connect(removeInvalidClipboardData)
def tearDown(self): pm.commandPort(n=":54321", cl=True)
def setUp(self): pm.commandPort(n=":54321", stp="python")
def OpenCommandPort(): #srcType='mel' pm.commandPort(n=(":" + str(KinectTest_IntFieldGrp_CmdPort.getValue1())))
import os import sys import pymel.core as pm # tomcommandport try: pm.commandPort(name=":7005", sourceType="python") print 'commandport to atom open...' except: print 'could not open port to atom' if not pm.about(batch=1): #gui mode only # import some python modules # pm.evalDeferred("import zhcg_polytools") pm.evalDeferred("import marvolo_maya") pm.evalDeferred("import cosmos") # append path where GitPython lives sys.path.append("/usr/lib/python2.7/site-packages/") print "marvolo userSetup finish" # ------------------------- # load geowizard on startup # ------------------------- import maya.cmds as cmds cmds.evalDeferred("import geowizard")