Skip to content

Instantly share code, notes, and snippets.

View AndrewtConroy's full-sized avatar

Andrew AndrewtConroy

View GitHub Profile
@AndrewtConroy
AndrewtConroy / UV_transfer.py
Last active October 20, 2015 19:22
UV transfer
import maya.cmds as cmds
import maya.mel as mel
'''
What is this:
This is a simple script that will copy UV's from one mech to another. The meshes should be simular for best results.
It will copy the UV's to a rigged mesh or a non rigged mesh.
Instructions:
In order to run this script correctly, just select the mesh with the good UV's, then select the mesh with bad UV's.
@AndrewtConroy
AndrewtConroy / 0_reuse_code.js
Created October 20, 2015 19:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
import maya.cmds as cmds
import maya.mel as mel
'''
list = ['Leg_MoveLF','KneeJposLF','AnkleJposLF']
nameSpace = ''
# 'jntLeg01LF'
obj = 'jntLeg'
side = 'LF'
chain = True
@AndrewtConroy
AndrewtConroy / gist:3fddcd82d47e7543d33d
Created March 22, 2016 04:17
stretchy IK Handle - Rough
def buildIK() :
obj = 'Leg'
side = 'LF'
list = ['jntLeg01LF','jntLeg02LF','jntLeg03LF']
srtJoint = list[0]
midJoint = list[1]
endJoint = list[2]
parent = ''
@AndrewtConroy
AndrewtConroy / gist:540c77fb638fd37ea3d14912ce489901
Created May 16, 2016 16:16
Selects joints with 'jnt' prefix - python
import maya.cmds as cmds
pfx ='jnt'
jointList = []
fullList = cmds.ls(type='joint')
for item in fullList:
if item.startswith(pfx ):
jointList.append(item)
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)
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)
# 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]
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):
@AndrewtConroy
AndrewtConroy / download.py
Created June 22, 2017 22:40
this is a download from url script. It's been customized to fit inside maya and with a UI.
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'}