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 pymel.core as pm | |
# look through scriptjobs, which are strings. Find the annoying one and kill it. | |
for each in pm.scriptJob(listJobs=True): | |
if 'syncChannelBoxFcurveEd' in each: | |
index = int(each.split(':')[0]) | |
pm.scriptJob(kill=index) |
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 re | |
for each in nodes: | |
result = re.search('\Acollision_wall', each.name().split('|')[-1]) is not None | |
if result: print each.name() |
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 mc | |
import pymel.core as pm | |
class ProgressBar: | |
def __init__ (self,title,steps): | |
#self.step = 0 | |
self.title=title | |
self.steps = steps | |
self.progressControls = [] | |
self.progressbar = self.makeProgressBarWindow() |
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
# assumes: | |
# from pymel.core import * | |
print 'starting test' | |
system.newFile(force=True) | |
#print len(ls()) | |
def makecubes (count): | |
cubes = [] |
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
print 'maya.py is running!' | |
print 'importing pymel.core' | |
from pymel.core import * | |
import sys | |
sys.path.append('c:\\py') | |
def get (file): |
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
def getNumberStringWithPreZeros(i,m): | |
name = str(i) | |
for i in range(0,max(m-len(name),0)): name = '0'+name | |
return name | |
print getNumberStringWithPreZeros(40,3) |
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
def makePointsOnCurve (c,x,g): | |
select(clear=True) | |
g = group (name=g) | |
count = 300 | |
for i in range(0,count): | |
p = spaceLocator() | |
percentage = ( float(i)/count*100 ) * 0.01 | |
pos = pointOnCurve (c, parameter=percentage, turnOnPercentage=True) | |
p.setTranslation(pos) | |
rename(selected()[0],'node_'+str(i)) |
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
# recurse through parents, building a list as we go | |
def getAllParents (parents): | |
parent = listRelatives(parents[len(parents)-1],allParents=True) | |
if len(parent)>0 : | |
parents.append(parent) | |
getAllParents(parents) | |
return parents | |
ap = getAllParents([selected()[0]]) |
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
# ERRORS AND WARNINGS | |
# maya cmds | |
import maya.cmds as cmds | |
cmds.warning('this is an warning') | |
cmds.error('this is an error') | |
# openmaya mglobal | |
import maya.OpenMaya as om | |
om.MGlobal.displayError('this is a display error - code not interrupted') |
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 sys,os,maya | |
print ('calling maya scripts...') | |
(filepath,filename) = os.path.split(maya.cmds.file(q=True,l=True)[0]) | |
path = open(filepath+'//scripts.path').readline() | |
sys.path.append(path) | |
import init | |
init.path=path |