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 vect(curv, pt2 = 1, pt1 = 0): | |
"""Returns a vector from two cvs on a curve. The argument curv is a PyMEL instance or string. For example:\vect('curve1', pt2 = 5, pt1 = 2) gives you a direction (i.e. vector) from cv[2] to cv[5] in curve1""" | |
if type(curv) == str: | |
curv = pm.ls(curv)[0] | |
if curv.getShape().numCVs() <= pt2: | |
print('\n!! There are {0} cvs. Make sure your pt2 value is less than {0}. !!'.format(curv.getShape().numCVs())) | |
else: | |
return [curv.cv[pt2].getPosition()[0] - curv.cv[pt1].getPosition()[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
import pymel.core as pm | |
def getCurves(tstep, deg=3): | |
"""Generate cv curves from particle paths. | |
Sample the path every tstep in the current time range and generate curve with degree deg. | |
Before executing, select particle in object mode (i.e. curves from all points) or component mode (i.e. curves from selected points).""" | |
global curvesData #FIX! I hate this global variable... find other way to collect data | |
curvesData = {} | |
tmin = int(pm.playbackOptions(q=1, min=1)) | |
tmax = int(pm.playbackOptions(q=1, max=1)) |
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 | |
def chDir(object, *filtr): | |
"""Check methods: Returns a list of methods bound to the instanced object. Filter search with string(s) filtr.""" | |
if not filtr: | |
return [meth for meth in dir(object)] | |
else: | |
return [meth for string in filtr for meth in dir(object) if string in meth] | |
NewerOlder