Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew AndrewtConroy

View GitHub Profile
View show joints 2
import maya.cmds as cmds
import maya.mel as mel
def jointDisplay(show=0):
jnts = cmds.ls(type="joint")
if show:
display = 0
else:
display = 2
for j in jnts:
cmds.setAttr("%s.drawStyle" % j, display)
View RFX_AddCheeks
import maya.cmds as cmds
d = cmds.ls(sl=1)[0]
ns = d.split(':')[0] + ':'
print ns
actualName = d.split(':')[1]
side = actualName[:2]
print side
View ShowJoints.py
import maya.cmds as cmds
jnts = cmds.ls(type="joint")
show = 1
if show:
@AndrewtConroy
AndrewtConroy / download.py
Created Jun 22, 2017
this is a download from url script. It's been customized to fit inside maya and with a UI.
View download.py
def download(self):
gMainProgressBar = mel.eval('$tmp = $gMainProgressBar')
try:
hdr = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
'Accept-Encoding': 'none',
'Accept-Language': 'en-US,en;q=0.8',
'Connection': 'keep-alive'}
View LWS_LicenseUI.py
from maya import OpenMaya, OpenMayaUI, OpenMayaAnim, cmds
from PySide import QtCore, QtGui
import shiboken, sys, os
import urllib2
import json
import time
pointer = long(OpenMayaUI.MQtUtil.mainWindow())
maya_window = shiboken.wrapInstance(pointer, QtGui.QMainWindow)
class LockDialog (QtGui.QDialog):
def __init__ (self, parent=maya_window):
View gist:7932c68213b7a2b1a83d548c9a634c62
# select two objects. First, the one with a skinCluster you like. Second, an object you want to have a matching skin.
# Once selected, hit the button. This will make matching skingCluster influences.
#Once this is done, select the objects again and use maya's copy skinweights tool.
import maya.cmds as cmds
import maya.mel as mel
selected = cmds.ls(sl=1)
skinnedMesh = selected[0]
newMesh = selected[1]
View gist:666b9d8219ac5851465b6145104463a0
import maya.cmds as cmds
selected = cmds.ls(sl=1)
for item in selected:
override = cmds.getAttr(item + '.overrideEnabled')
display = cmds.getAttr(item + '.overrideDisplayType')
if override == 0 :
cmds.setAttr(item + '.overrideEnabled', 1)
View gist:b95e3c4af2458264589f7acb66f0f5cf
import maya.cmds as cmds
import maya.mel as mel
selected = cmds.ls(sl=1)
skinnedMesh = selected[0]
skinCluster = mel.eval('findRelatedSkinCluster ' + skinnedMesh)
skinnedJoints = cmds.skinCluster(skinCluster,query=True,inf=True)
cmds.select(skinnedJoints)
@AndrewtConroy
AndrewtConroy / gist:540c77fb638fd37ea3d14912ce489901
Created May 16, 2016
Selects joints with 'jnt' prefix - python
View gist:540c77fb638fd37ea3d14912ce489901
import maya.cmds as cmds
pfx ='jnt'
jointList = []
fullList = cmds.ls(type='joint')
for item in fullList:
if item.startswith(pfx ):
jointList.append(item)
View gist:3fddcd82d47e7543d33d
def buildIK() :
obj = 'Leg'
side = 'LF'
list = ['jntLeg01LF','jntLeg02LF','jntLeg03LF']
srtJoint = list[0]
midJoint = list[1]
endJoint = list[2]
parent = ''
You can’t perform that action at this time.