本文整理汇总了Python中pymel.core.curve函数的典型用法代码示例。如果您正苦于以下问题:Python curve函数的具体用法?Python curve怎么用?Python curve使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了curve函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _createCurves
def _createCurves(self, objs=None, axis=None, num=None):
'''
Create two curves using .getTranslation() of passed in objects
'''
_name = '_createCurves'
pymelLogger.info('Started: %s' % _name)
positions = []
for obj in objs:
loc = pm.spaceLocator()
pm.parentConstraint(obj, loc, mo=0)
positions.append(pm.PyNode(loc).getTranslation())
pm.delete(loc)
crv1 = pm.PyNode(pm.curve(p=positions, d=1))
crv2 = pm.PyNode(pm.curve(p=positions, d=1))
move = 0.05
if axis == 1:
pm.move(crv1, move, r=1, moveX=1)
pm.move(crv2, -move, r=1, moveX=1)
elif axis == 2:
pm.move(crv1, move, r=1, moveY=1)
pm.move(crv2, -move, r=1, moveY=1)
elif axis == 3:
pm.move(crv1, move, r=1, moveZ=1)
pm.move(crv2, -move, r=1, moveZ=1)
pm.rebuildCurve( crv1, rt=0, s=num )
pm.rebuildCurve( crv2, rt=0, s=num )
pymelLogger.info('Ended: %s' % _name)
return crv1, crv2
示例2: make_stabilized_node
def make_stabilized_node(nodeName=None, centered=True):
'''
Very simple proc to generate a Stabilized node for
raw MoCap tracking purposes... First selected node
is used as the Aim axis, second selected is used as this
aim's worldUp
'''
RequiredMarkers = pm.ls(sl=True, l=True)
#pos = pm.xform(WorldUpObj, q=True, ws=True, t=True)
curve = pm.curve(ws=True, d=1, p=(0, 0, 0), k=0)
if centered:
AimAt = RequiredMarkers[0]
WorldUpObj = RequiredMarkers[1]
pm.pointConstraint(RequiredMarkers, curve)
else:
AimAt = RequiredMarkers[1]
WorldUpObj = RequiredMarkers[2]
pm.pointConstraint(RequiredMarkers[0], curve)
pm.aimConstraint((AimAt, curve),
weight=1,
aimVector=(0, 0, 1),
upVector=(0, 1, 0),
worldUpType="object",
worldUpObject=WorldUpObj)
#Snap a curveKnot to the pivot of all referenceMarkers
for node in RequiredMarkers:
pm.curve(curve, a=True, ws=True, p=(pm.xform(node, q=True, ws=True, t=True)))
pm.curve(curve, a=True, ws=True, p=(pm.xform(AimAt, q=True, ws=True, t=True)))
return curve
示例3: createSrf
def createSrf(self):
#calculate the witdth of the surface as a fraction of the total joint chain length
jntChainLength = 0
crvPoints = []
for i in range(1,self.numJnt):
pos1 = self.ikJntList[i-1].getTranslation(space='world')
crvPoints.append(pos1)
pos2 = self.ikJntList[i].getTranslation(space='world')
jntChainLength += (pos2 - pos1).length()
if i == self.numJnt - 1:
crvPoints.append(pos2)
jntChainLength = math.ceil(jntChainLength )
self.width = jntChainLength * self.widthMult
crv1 = pm.curve(n=self.name + '_crv1',d=1,p=crvPoints)
pm.move(crv1,self.width / 2.0,0,0,r=1)
pm.parent(crv1,self.mainGrp)
crv2 = pm.curve(n=self.name + '_crv2',d=1,p=crvPoints)
pm.move(crv2,self.width / -2.0,0,0,r=1)
pm.parent(crv2,self.mainGrp)
pm.select(cl=1)
loftSrf = pm.loft(crv2,crv1,ch=1,u=1,c= 0,ar= 1,d=3,ss= 1,rn=0,po=0,rsn=1,n=self.name + "_srf")[0]
rebuiltLoftSrf = pm.rebuildSurface(loftSrf,ch=1, rpo=1, rt=0, end=1, kr=0, kcp=0, kc=0, su=self.numCtrl-1, du=3, sv=0, dv=3, tol=0, fr=0, dir=2 )[0]
self.srf = loftSrf
pm.parent(self.srf,self.mainGrp)
示例4: circle
def circle(self, joint):
a = 0.25
b = 0.3432
p0 = Point(a + 0.005,0 , -a - 0.005)
p1 = Point(b + 0.05, 0, 0)
p2 = Point(a + 0.005, 0, a + 0.005)
p3 = Point(0, 0, b)
p4 = Point(-a - 0.005, 0, a + 0.005)
p5 = Point(-b - 0.05, 0, 0)
p6 = Point(-a - 0.005, 0, -a - 0.005)
p7 = Point(0, 0, - b)
points = [p0, p1, p2, p3, p4, p5, p6, p7, p0, p1, p2]
pts = []
for point in points:
pts.append(point.getPoint())
pm.curve(per = True, d = 3, p = pts, k = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
pm.parent("%s" % str(pm.ls(sl = True)[0]), "%s" % str(joint), relative = True)
pm.parent("%s" % str(pm.ls(sl = True)[0]), world = True)
pm.makeIdentity(r = True)
curve = "%s" % str(pm.ls(sl = True)[0])
g = 0
while g < 8:
pm.moveVertexAlongDirection(curve + ".cv[" + str(g) + "]", d = [0,1,0], m = -0.08)
g += 1
group = pm.group(curve)
pm.orientConstraint(curve, joint, mo = True)
handle = joint + "IK"
pm.pointConstraint(curve, handle, mo = True)
示例5: setStyle
def setStyle(self, style):
self._deleteShape()
#Circle
if style == Control.Circle:
tempA = pm.circle(nr=[1, 0, 0], sw=360, r=5, d=3, ch=False)[0]
pm.parent([tempA.getShape()], self.node, r=True, s=True)
pm.delete([tempA])
#Sphere
if style == Control.Sphere:
tempA = pm.mel.eval("curve -d 1 -p 0 5 0 -p 1.545085 4.755283 0 -p 2.938926 4.045085 0 -p 4.045085 2.938926 0 -p 4.755283 1.545085 0 -p 5 0 0 -p 4.755283 -1.545085 0 -p 4.045085 -2.938926 0 -p 2.938926 -4.045085 0 -p 1.545085 -4.755283 0 -p 0 -5 0 -p -1.545085 -4.755283 0 -p -2.938927 -4.045085 0 -p -4.045086 -2.938926 0 -p -4.755284 -1.545085 0 -p -5.000001 0 0 -p -4.755284 1.545085 0 -p -4.045086 2.938926 0 -p -2.938927 4.045085 0 -p -1.545085 4.755283 0 -p 0 5 0 -p -4.60471e-08 4.755283 1.545085 -p -8.75868e-08 4.045085 2.938926 -p -1.20553e-07 2.938926 4.045085 -p -1.41718e-07 1.545085 4.755283 -p -1.49012e-07 0 5 -p -1.545085 0 4.755283 -p -2.938927 0 4.045085 -p -4.045086 0 2.938927 -p -4.755284 0 1.545085 -p -5.000001 0 0 -p -4.755284 0 -1.545085 -p -4.045086 0 -2.938927 -p -2.938927 0 -4.045086 -p -1.545086 0 -4.755285 -p 0 0 -5.000002 -p 1.545086 0 -4.755285 -p 2.938928 0 -4.045087 -p 4.045088 0 -2.938928 -p 4.755286 0 -1.545086 -p 5 0 0 -p 4.755283 0 1.545085 -p 4.045085 0 2.938926 -p 2.938926 0 4.045085 -p 1.545085 0 4.755283 -p -1.49012e-07 0 5 -p -1.41718e-07 -1.545085 4.755283 -p -1.20553e-07 -2.938926 4.045085 -p -8.75868e-08 -4.045085 2.938926 -p -4.60471e-08 -4.755283 1.545085 -p 0 -5 0 -p 0 -4.755283 -1.545086 -p 0 -4.045085 -2.938928 -p 0 -2.938926 -4.045087 -p 0 -1.545085 -4.755285 -p 0 0 -5.000002 -p 0 1.545085 -4.755285 -p 0 2.938926 -4.045087 -p 0 4.045085 -2.938928 -p 0 4.755283 -1.545086 -p 0 5 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 -k 17 -k 18 -k 19 -k 20 -k 21 -k 22 -k 23 -k 24 -k 25 -k 26 -k 27 -k 28 -k 29 -k 30 -k 31 -k 32 -k 33 -k 34 -k 35 -k 36 -k 37 -k 38 -k 39 -k 40 -k 41 -k 42 -k 43 -k 44 -k 45 -k 46 -k 47 -k 48 -k 49 -k 50 -k 51 -k 52 -k 53 -k 54 -k 55 -k 56 -k 57 -k 58 -k 59 -k 60 ;")
pm.parent([pm.nt.Transform(tempA).getShape()], self.node, r=True, s=True)
pm.delete(tempA)
#Cube
if style == Control.Cube:
tempA = pm.mel.eval("curve -d 1 -p -5 5 5 -p 5 5 5 -p 5 -5 5 -p -5 -5 5 -p -5 5 5 -p -5 5 -5 -p 5 5 -5 -p 5 -5 -5 -p -5 -5 -5 -p -5 5 -5 -p -5 5 5 -p -5 -5 5 -p -5 -5 -5 -p 5 -5 -5 -p 5 -5 5 -p 5 5 5 -p 5 5 -5 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 ;")
pm.parent([pm.nt.Transform(tempA).getShape()], self.node, r=True, s=True)
pm.delete(tempA)
#Square
if style == Control.Square:
tempA = pm.mel.eval("curve -d 1 -ch 0 -p 0 0 0 -p 0 15 0 -k 0 -k 1 ;")
pm.parent([pm.nt.Transform(tempA).getShape()], self.node, r=True, s=True)
pm.delete([tempA])
#Handle
if style == Control.Handle:
tempA = pm.mel.eval("curve -d 1 -p 0 15 0 -p 1.545085 15.244717 0 -p 2.938926 15.954915 0 -p 4.045085 17.061074 0 -p 4.755283 18.454915 0 -p 5 20 0 -p 4.755283 21.545085 0 -p 4.045085 22.938926 0 -p 2.938926 24.045085 0 -p 1.545085 24.755283 0 -p 0 25 0 -p -1.545085 24.755283 0 -p -2.938927 24.045085 0 -p -4.045086 22.938926 0 -p -4.755284 21.545085 0 -p -5.000001 20 0 -p -4.755284 18.454915 0 -p -4.045086 17.061074 0 -p -2.938927 15.954915 0 -p -1.545085 15.244717 0 -p 0 15 0 -p -4.60471e-08 15.244717 1.545085 -p -8.75868e-08 15.954915 2.938926 -p -1.20553e-07 17.061074 4.045085 -p -1.41718e-07 18.454915 4.755283 -p -1.49012e-07 20 5 -p 1.545085 20 4.755283 -p 2.938926 20 4.045085 -p 4.045085 20 2.938926 -p 4.755283 20 1.545085 -p 5 20 0 -p 4.755286 20 -1.545086 -p 4.045088 20 -2.938928 -p 2.938928 20 -4.045087 -p 1.545086 20 -4.755285 -p 0 20 -5.000002 -p -1.545086 20 -4.755285 -p -2.938927 20 -4.045086 -p -4.045086 20 -2.938927 -p -4.755284 20 -1.545085 -p -5.000001 20 0 -p -4.755284 20 1.545085 -p -4.045086 20 2.938927 -p -2.938927 20 4.045085 -p -1.545085 20 4.755283 -p -1.49012e-07 20 5 -p -1.41718e-07 21.545085 4.755283 -p -1.20553e-07 22.938926 4.045085 -p -8.75868e-08 24.045085 2.938926 -p -4.60471e-08 24.755283 1.545085 -p 0 25 0 -p 0 24.755283 -1.545086 -p 0 24.045085 -2.938928 -p 0 22.938926 -4.045087 -p 0 21.545085 -4.755285 -p 0 20 -5.000002 -p 0 18.454915 -4.755285 -p 0 17.061074 -4.045087 -p 0 15.954915 -2.938928 -p 0 15.244717 -1.545086 -p 0 15 0 -p 0 0 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 -k 17 -k 18 -k 19 -k 20 -k 21 -k 22 -k 23 -k 24 -k 25 -k 26 -k 27 -k 28 -k 29 -k 30 -k 31 -k 32 -k 33 -k 34 -k 35 -k 36 -k 37 -k 38 -k 39 -k 40 -k 41 -k 42 -k 43 -k 44 -k 45 -k 46 -k 47 -k 48 -k 49 -k 50 -k 51 -k 52 -k 53 -k 54 -k 55 -k 56 -k 57 -k 58 -k 59 -k 60 -k 61 ;")
pm.parent(pm.nt.Transform(tempA).getShape(), self.node, r=True, s=True)
pm.delete(tempA)
#Arrow
if style == Control.Arrow:
tempA = pm.mel.eval("curve -d 1 -p 1 0 -4 -p -1 0 -4 -p -1 0 1 -p -2 0 1 -p 0 0 4 -p 2 0 1 -p 1 0 1 -p 1 0 -4 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 ;")
pm.parent(pm.nt.Transform(tempA).getShape(), self.node, r=True, s=True)
pm.delete(tempA)
#Moveall
if style == Control.MoveAll:
tempA = pm.curve(d = 1, p = [(0, 0, -6.314364), (1.952926, 0, -4.7925),(1.05164, 0, -4.792499),
(1.952926, 0, -1.952926), (4.7925, 0, -1.594463), (4.7925, 0, -1.952926),
(6.725978, 0, 0), (4.7925, 0, 1.952926), (4.7925, 0, 1.594463), (1.952926, 0, 1.952926),
(1.261715, 0, 4.699687), (1.952926, 0, 4.7925), (0, 0, 7.08783), (-1.952926, 0, 4.7925),
(-1.261715, 0, 4.699687), (-1.952926, 0, 1.952926), (-4.7925, 0, 1.594463), (-4.7925, 0, 1.952926),
(-6.725978, 0, 0), (-4.7925, 0, -1.952926), (-4.7925, 0, -1.594463), (-1.952926, 0, -1.952926),
(-1.05164, 0, -4.792499), (-1.952926, 0, -4.7925), (0, 0, -6.314364)],
k = [0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24],
n = newName, ch=0)[0]
pm.parent(tempA.getShape(), self.node, r=True, s=True)
pm.delete(tempA)
#Pyramid
if style == Control.Arrow:
tempA = pm.curve(n = name, d = 1,p = [(0,0,0.5), (-0.5, 0.5, -0.5), (0.5,0.5,-0.5), (0.5,-0.5,-0.5), (-0.5,-0.5,-0.5), (-0.5,0.5,-0.5), (0,0,0.5), (0.5,0.5,-0.5), (0.5,-0.5,-0.5), (0,0,0.5), (-0.5,-0.5,-0.5)], k = [0,1,2,3,4,5,6,7,8,9,10])
pm.parent(pm.nt.Transform(tempA).getShape(), self.node, r=True, s=True)
pm.delete(tempA)
示例6: bdBuildSrf
def bdBuildSrf(self,name):
selected = pm.ls(sl=1)
if selected:
if len(selected) == 1:
if selected[0].type() == 'joint':
print 'start srf'
self.startJnt = selected[0]
children = self.startJnt.getChildren(type='joint')
print children
#need to implement a case with more joint chidren
#build the one degree curves for lofting
self.endJnt = children[0]
startPos1,endPos1 = self.bdGetPos(-0.05)
startPos2,endPos2 = self.bdGetPos( 0.05)
pm.spaceLocator(p=startPos1)
pm.spaceLocator(p=startPos2)
pm.spaceLocator(p=endPos1)
pm.spaceLocator(p=endPos2)
dif1 = (endPos1 - startPos1)
dif2 = (endPos2 - startPos2)
crv1Points = []
crv2Points = []
for i in range(self.segmentsRbn):
pos = dif1 * (i/(self.segmentsRbn*1.0)) + startPos1
crv1Points.append(pos )
pos = dif2 * (i/(self.segmentsRbn*1.0)) + startPos2
crv2Points.append(pos)
crv1Points.append(endPos1)
crv2Points.append(endPos2)
print 'building curve'
tmp = pm.curve(n=name + '_crv1',d=1,p=crv1Points)
crv1 = pm.ls(tmp)[0]
print crv1
#crv1.setScalePivot(startPos1)
#crv1.setRotatePivot(startPos1)
crv2 = pm.curve(n=name + '_crv2',d=1,p=crv2Points)
#crv2.setScalePivot(startPos2)
#crv2.setRotatePivot(startPos2)
drvGrp = self.bdCreateDrvJnt(crv1,crv2)
#loft the curves
loftSrf = pm.loft(crv1,crv2,ch=1,u=1,c= 0,ar= 1,d=1,ss= 1,rn=0,po=0,rsn=1,n=name + "_lft_srf")[0]
#loftSrf.setScalePivot(startPos2)
#loftSrf.setRotatePivot(startPos2)
rebuiltLoftSrf = pm.rebuildSurface(ch=1, rpo = 0, rt = 0, end = 1, kr=1, kcp=0,kc=0, su=0, du=3, sv=0, dv=1, fr=0, dir=2 , n=name + "_srf")[0]
self.rbnSrf = rebuiltLoftSrf
crvGrp = pm.group([crv1,crv2],name=name+'_crv_grp')
crvGrp.centerPivots()
srfGrp = pm.group([loftSrf,rebuiltLoftSrf],name=name+'_srf_grp')
srfGrp.centerPivots()
self.rbnGrp = pm.group([crvGrp,srfGrp],n=name+"_grp")
pm.parent(drvGrp,self.rbnGrp)
示例7: create_radian_trigger
def create_radian_trigger(prefix):
prefix = ("%s_radianTrigger") %prefix
display = pm.group(empty=True, name="%s_display" %prefix)
display.overrideEnabled.set(1)
display.overrideDisplayType.set(2)
grp = pm.group(empty=True, name="%s_grp" %prefix)
loc = pm.spaceLocator(name = "%s_target" %prefix)
pm.addAttr(loc, at='double', ln="radical", k=True)
pm.addAttr(loc, at='double', ln="angle", k=True)
pos = pm.spaceLocator(name = "%s_pos" %prefix)
loc.ty.set(1)
loc.tz.set(1)
pos.tz.set(1)
radical_exp = '%s.radical = rad_to_deg( atan2( %s.translateY , %s.translateX ) )' %(loc.name(), loc.name(), loc.name())
angle_exp = "%s.angle = rad_to_deg( acos( %s.translateZ / (sqrt( pow(%s.translateX, 2) + pow(%s.translateY, 2) + pow(%s.translateZ, 2) ) ) ) )" %(loc.name(), loc.name(), loc.name(), loc.name(), loc.name())
pm.expression( o=loc, s= radical_exp, name="%s_radical_exp" %prefix)
pm.expression( o=loc, s= angle_exp, name="%s_angle_exp" %prefix)
planer_curve = "curve -d 1 -p 0 0 0 -p -1 0 0 -p -0.965926 0.258819 0 -p -0.765926 0.258819 0 -p -0.865926 0.258819 0 -p -0.865926 0.358819 0 -p -0.865926 0.158819 0 -p -0.865926 0.258819 0 -p -0.965926 0.258819 0 -p -0.866025 0.5 0 -p -0.707107 0.707107 0 -p -0.353553 0.353553 0 -p -0.707107 0.707107 0 -p -0.5 0.866025 0 -p -0.258819 0.965926 0 -p 0 1 0 -p 0 0.5 0 -p 0 1 0 -p 0.258819 0.965926 0 -p 0.5 0.866025 0 -p 0.707107 0.707107 0 -p 0.353553 0.353553 0 -p 0.707107 0.707107 0 -p 0.866025 0.5 0 -p 0.965926 0.258819 0 -p 1 0 0 -p 0.5 0 0 -p 1 0 0 -p 0.965926 -0.258819 0 -p 0.866025 -0.5 0 -p 0.707107 -0.707107 0 -p 0.353553 -0.353553 0 -p 0.707107 -0.707107 0 -p 0.5 -0.866025 0 -p 0.258819 -0.965926 0 -p 0 -1 0 -p 0 -0.5 0 -p 0 -1 0 -p -0.258819 -0.965926 0 -p -0.5 -0.866025 0 -p -0.707107 -0.707107 0 -p -0.353553 -0.353553 0 -p -0.707107 -0.707107 0 -p -0.866025 -0.5 0 -p -0.965926 -0.258819 0 -p -0.765926 -0.258819 0 -p -0.965926 -0.258819 0 -p -1 0 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 -k 17 -k 18 -k 19 -k 20 -k 21 -k 22 -k 23 -k 24 -k 25 -k 26 -k 27 -k 28 -k 29 -k 30 -k 31 -k 32 -k 33 -k 34 -k 35 -k 36 -k 37 -k 38 -k 39 -k 40 -k 41 -k 42 -k 43 -k 44 -k 45 -k 46 -k 47"
planer = pm.PyNode(pm.mel.eval(planer_curve))
planer.rename("%s_planer" %prefix)
arrow_curve = 'curve -d 1 -p 0 0 0 -p 0 0.377909 0 -p -0.0449662 0.378085 0 -p 0 0.460303 0 -p 0.0449662 0.378085 0 -p 0 0.377909 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 ;'
arrow = pm.PyNode(pm.mel.eval(arrow_curve))
pm.makeIdentity(arrow, apply=True, t=True, r=True, s=True)
arrow.rename("%s_arrow" %prefix)
angle_curves = pm.circle(name="%s_angleCurve" %prefix, r=0.5)
pm.aimConstraint(pos, angle_curves[0], mo=False, aimVector=[0,1,0], upVector=[-1,0,0], worldUpType='object', worldUpObject=loc)
pm.parent(arrow, angle_curves)
loc.angle >> angle_curves[-1].sweep
posPointer = pm.curve(name='%s_posPointer'%prefix, d = 1, p = [(0,0,0), (0,0,1)])
pointer = pm.curve(name='%s_targetPointer'%prefix, d = 1, p = [(0,0,0), (0,0,0)])
pointer.inheritsTransform.set(0)
cls1 = pm.cluster(pointer.cv[0], name='%s_pointerClusterStart' %prefix)
cls2 = pm.cluster(pointer.cv[1], name='%s_pointerClusterEnd' %prefix)
pm.parent(pos, planer, angle_curves[0], cls1, pointer, posPointer, display)
pm.parent(display, loc, grp)
pm.parent(cls2, loc, r=True)
cls1[1].v.set(0)
cls2[1].v.set(0)
pos.v.set(0)
示例8: _create_ribbon
def _create_ribbon(self):
"""Create the ribbon spine based on the guides."""
ribboncrv = pm.curve(p=[ctl.position() for ctl in self.guides.spine],
n='%s_%sRibbon_CRV' % (self.side, self.name), d=3)
ribboncrv.listRelatives(ad=True)[0].rename('%sShape' % ribboncrv)
crva = pm.curve(d=1, p=[ctl.position() for ctl in self.guides.spine])
crvb = crva.duplicate()[0]
crva.tx.set(-1)
crvb.tx.set(1)
nrbname = '%s_%sRibbon_NRB' % (self.side, self.name)
loft = pm.loft(crva, crvb, n=nrbname, ch=False)[0]
self.ribbon = pm.rebuildSurface(loft, su=0, sv=0, ch=False)
pm.delete(crva, crvb)
示例9: createCurve
def createCurve(positions=[], degree=2):
"""
@param positions: Point positions
@param degree: The degree of the curve that should be
@return: The curve pynode
"""
if len(positions) < degree:
# Force the degree to least number of points required
degree = min(degree - 1, len(positions) - 1)
curve = pm.curve(d=degree, p=positions[0])
for i in range(1, len(positions)):
pm.curve(curve, a=1, p=positions[i])
return curve
示例10: _setCtrlerShape
def _setCtrlerShape(self, transformNode, shape='helper', scale=[1,1,1] ):
curveShape = None
if shape=='helper': # hexagon2D
curveShape = pm.curve( d=1, p=[ (4.063704928114475e-17, 0.433013, 0.25), (-1.1102230246251565e-16, 0.0, 0.5), (-1.516593517436604e-16, -0.433013, 0.25), (-4.063704928114475e-17, -0.433013, -0.25), (1.1102230246251565e-16, 0.0, -0.5), (1.516593517436604e-16, 0.433013, -0.25), (4.063704928114475e-17, 0.433013, 0.25) ], k=[ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] )
elif shape =='up': # diamond
curveShape = pm.curve( d=1, p=[ (0.0, 0.0, 0.5), (0.5, 0.0, 0.0), (0.0, 0.0, -0.5), (-0.5, 0.0, 0.0), (0.0, 0.0, 0.5), (0.0, 0.5, 0.0), (0.0, 0.0, -0.5), (0.0, -0.5, 0.0), (0.0, 0.0, 0.5), (0.0, 0.5, 0.0), (0.5, 0.0, 0.0), (0.0, -0.5, 0.0), (-0.5, 0.0, 0.0), (0.0, 0.5, 0.0) ], k=[ 0.0, 0.707106781187, 1.41421356237, 2.12132034356, 2.82842712475, 3.53553390593, 4.24264068712, 4.94974746831, 5.65685424949, 6.36396103068, 7.07106781187, 7.77817459305, 8.48528137424, 9.19238815543 ] )
curveShape.s.set(scale)
pm.makeIdentity( curveShape, apply=True, t=True, r=True, s=True )
pm.parent( curveShape.getShape(), transformNode, s=True, r=True)
pm.delete( curveShape )
示例11: triangle
def triangle(self, joint):
p0 = Point(-1, 0, -0.5)
p1 = Point(0, 0, 1)
p2 = Point(1, 0, -0.5)
points = [p0, p1, p2, p0]
pts = []
for point in points:
pts.append(point.getPoint())
pm.curve(per = True, d = 1, p = pts, k = [0, 1, 2, 3])
pos = pm.PyNode("%s" % joint).getTranslation()
pm.move(pos)
pm.pointConstraint(pm.ls(sl = True)[0], joint)
pm.orientConstraint("%s" % str(pm.ls(sl = True)[0]), joint)
示例12: arrows4
def arrows4(name, radius, normal, color):
r = radius
points = [(0.25*r, 0*r, 0.75*r),
(0*r, 0*r, 1*r),
(-.25*r, 0*r, 0.75*r),
(0.25*r, 0*r, 0.75*r),
(0*r, 0*r, 1*r),
(0*r, 0*r, -1*r),
(0.25*r, 0*r, -.75*r),
(-.25*r, 0*r, -.75*r),
(0*r, 0*r, -1*r),
(0*r, 0*r, 0*r),
(-1*r, 0*r, 0*r),
(-.75*r, 0*r, 0.25*r),
(-.75*r, 0*r, -.25*r),
(-1*r, 0*r, 0*r),
(1*r, 0*r, 0*r),
(0.75*r, 0*r, -.25*r),
(0.75*r, 0*r, 0.25*r),
(1*r, 0*r, 0)]
a = pm.curve(point=points, name=name, degree=1, worldSpace=True)
u.aimNormal(a, normal=normal)
pm.makeIdentity(a,apply=True)
a.getShape().overrideEnabled.set(True)
a.getShape().overrideColor.set(color)
return a
示例13: box
def box(name, radius, normal, color):
r = radius
points = [(-1*r, -1*r,-1*r),
(-1*r, -1*r, 1*r),
( 1*r, -1*r, 1*r),
( 1*r, -1*r,-1*r),
(-1*r, -1*r,-1*r),
(-1*r, 1*r,-1*r),
(-1*r, 1*r, 1*r),
(-1*r, -1*r, 1*r),
(-1*r, 1*r, 1*r),
( 1*r, 1*r, 1*r),
( 1*r, -1*r, 1*r),
( 1*r, 1*r, 1*r),
( 1*r, 1*r,-1*r),
( 1*r, -1*r,-1*r),
( 1*r, 1*r,-1*r),
(-1*r, 1*r,-1*r)]
b = pm.curve(
point=points,
name=name,
degree=1,
worldSpace=True)
u.aimNormal(b, normal=normal)
pm.makeIdentity(b,apply=True)
b.getShape().overrideEnabled.set(True)
b.getShape().overrideColor.set(color)
return b
示例14: GuideCrv
def GuideCrv ( startGuider=None , endGuider=None ):
if startGuider==None or endGuider==None:
startGuider,endGuider = pm.ls(sl=True)
pm.select(clear=True)
startJnt = pm.joint ( n = startGuider.name()+"_guideCrvJnt")
pm.parent (startJnt , startGuider)
startJnt.translate.set (0,0,0)
startJnt.visibility.set (0)
pm.setAttr ( startJnt.visibility , lock=True )
endJnt = pm.joint ( n = endGuider.name()+"_guideCrvJnt" )
pm.parent (endJnt , endGuider)
endJnt.translate.set (0,0,0)
endJnt.visibility.set (0)
pm.setAttr ( endJnt.visibility , lock=True )
startJntPos = pm.xform ( startJnt , q=True , ws=True , t=True)
endJntPos = pm.xform ( endJnt , q=True , ws=True , t=True)
guideCrv = pm.curve ( degree=1 , p = (startJntPos ,endJntPos) , k=(1,2) )
pm.rename ( guideCrv , startGuider.name()+"_guideCrv")
pm.skinCluster ( guideCrv , startJnt , endJnt )
guideCrv.inheritsTransform.set(0)
guideCrv.template.set(1)
pm.select(clear=True)
return guideCrv
示例15: build
def build(self):
"""builds it self
"""
self.curve = curve(d=1, p=[(1, 0, 0), (-1, 0, 0)], k=(0, 1))
self.corner1_locator = spaceLocator()
self.corner2_locator = spaceLocator()
select(self.curve)
ClusterCurve()
# try to find the clusterHandles
curve_shape = curve.getShape()
clusters = []
handles = []
for node in curve_shape.listHistroy():
if isinstance(node, ClusterHandle):
handles.append(node)
elif isinstance(node, Cluster):
clusters.append(node)
self.cluster1 = clusters[0]
self.cluster2 = clusters[0]
self.cluster_handle1 = handles[0]
self.cluster_handle2 = handles[1]
# set clusters to absolute
self.cluster1.setAttr('relative', 0)
self.cluster2.setAttr('relative', 0)