Created
August 31, 2014 17:42
-
-
Save evitolins/0a324c1392dbd25aaf32 to your computer and use it in GitHub Desktop.
Maya CommandPort methods to assist with MayaSublime package integration.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as cmds | |
def activateCommandPort(host='127.0.0.1', port='7002', language="python"): | |
path = host + ":" + port | |
active = cmds.commandPort(path, q=True) | |
if not active: | |
cmds.commandPort(name=path, sourceType=language) | |
else: | |
print("%s is already active" % path) | |
def deactivateCommandPort(host, port): | |
path = host + ":" + port | |
active = cmds.commandPort(path, q=True) | |
if active: | |
cmds.commandPort(name=path, cl=True) | |
else: | |
print("%s is was not active" % path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Activate | |
activateCommandPort('127.0.0.1', '7001', 'mel') | |
activateCommandPort('127.0.0.1', '7002', 'python') | |
# Deactiviate | |
deactivateCommandPort('127.0.0.1', '7001') | |
deactivateCommandPort('127.0.0.1', '7002') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment