本文整理汇总了Python中pymel.core.circle函数的典型用法代码示例。如果您正苦于以下问题:Python circle函数的具体用法?Python circle怎么用?Python circle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了circle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createNurbsSphere
def createNurbsSphere(rad = 2, oneName = "sphere_ctrl"):
circ1 = pm.circle(ch = False, o = True, nr = [1,0,0], r = rad, name = oneName)[0]
circ2 = pm.circle(ch = False, o = True, nr = [0,1,0], r = rad, name = oneName)[0]
circ3 = pm.circle(ch = False, o = True, nr = [0,0,1], r = rad, name = oneName)[0]
pm.parent(circ3.getShape(), circ2.getShape(), circ1, s = True, r = True)
pm.delete(circ3, circ2)
return circ1
示例2: create_curveSphere
def create_curveSphere(name, radius):
circGrp = pm.group(n=name, em=True)
circ1 = pm.circle(nr=[1, 0, 0], ch=True)[0]
circ2 = pm.circle(nr=[1, 0, 0], ch=True)[0]
circ3 = pm.circle(nr=[1, 0, 0], ch=True)[0]
circs = [circ1, circ2, circ3]
circGrp.overrideEnabled.set(1)
circGrp.overrideColorRGB.set(1, 1, 0)
circGrp.overrideRGBColors.set(1)
pm.xform(circGrp, s=[radius, radius, radius])
pm.xform(circ2, ro=[0, 90, 0])
pm.xform(circ3, ro=[0, 0, 90])
pm.makeIdentity([circ1, circ2, circ3], a=True, t=True, r=True, s=True, n=False)
circ1_shape = pm.listRelatives(circ1, s=True)[0]
circ2_shape = pm.listRelatives(circ2, s=True)[0]
circ3_shape = pm.listRelatives(circ3, s=True)[0]
pm.parent([circ1_shape, circ2_shape, circ3_shape], circGrp, r=True, s=True)
pm.delete([circ1, circ2, circ3])
return circGrp
示例3: test_clusterPlane
def test_clusterPlane(self):
fr = FollowRibbon.FollowRibbon(name="blah")
plane = pm.nurbsPlane(axis=[0, 1, 0], patchesU=8, patchesV=1, lengthRatio=0.1, ch=0)[0]
ctrls = []
ctrls.append(pm.circle(n="blah_ctrl_01")[0].name())
ctrls.append(pm.circle(n="blah_ctrl_02")[0].name())
mainGrp = pm.group(em=1, name="main")
result = fr._clusterPlane(plane=plane, controls=ctrls, mainGrp="main")
self.testLib.assertListEqual(result, ["blah_cluster_01Handle", "blah_cluster_02Handle"])
self.assertTrue(pm.objExists("blah_cluster_01"))
self.assertTrue(pm.objExists("blah_cluster_02"))
self.assertTrue(pm.listRelatives(result[0], parent=True), "main")
self.assertTrue(pm.listRelatives(result[1], parent=True), "main")
self.assertTrue(pm.listRelatives(result[0], parent=1)[0], "blah_ctrlsGrp")
self.assertTrue(pm.listRelatives(result[1], parent=1)[0], "blah_ctrlsGrp")
hist = pm.listHistory(plane)
hitA = 0
hitB = 0
for each in hist:
if each.name() == "blah_cluster_01":
hitA = 1
if each.name() == "blah_cluster_02":
hitB = 1
self.assertTrue(hitA)
self.assertTrue(hitB)
self.assertTrue(pm.isConnected("blah_ctrl_01.translate", "blah_cluster_01Handle.translate"))
self.assertTrue(pm.isConnected("blah_ctrl_02.translate", "blah_cluster_02Handle.translate"))
示例4: test_match_object
def test_match_object(self):
a = pm.circle()[0]
b = pm.circle()[0]
b.rx.set(75)
b.ry.set(75)
b.rz.set(75)
self.assertFalse(transforms.assertOrientationMatches(a, b))
control.match_object(a, b)
self.assertTrue(transforms.assertOrientationMatches(a, b))
示例5: build_tweek_ctrls
def build_tweek_ctrls(self, follicles):
"""
Args:
None
Returns (None)
"""
base_name = '%s_flexiPlane' % self.flexiPlaneNameField.getText()
follicle_prefix = '%s_flexiPlane_' % self.flexiPlaneNameField.getText()
mainCTRLGRP = self.flexiPlaneNameField.getText() + '_flexiPlane_main_CTRLCon_GRP'
main_crv_name = '%s_main_CTRL' % base_name
tweekCTRLGRP = pm.group( em = True, name = self.flexiPlaneNameField.getText() + '_flexiPlane_tweakCTRL_GRP' )
tweekCTRLGRP.setAttr( 'inheritsTransform', 0 )
pm.parent( tweekCTRLGRP, mainCTRLGRP )
for index,follicle in enumerate(follicles):
tweek_crv_name = self.format_string.format(PREFIX = self.flexiPlaneNameField.getText(),
INDEX = 'flexiPlane_tweak%03d' % (index+1),
SUFFIX = 'CTRL')
pm.circle( c = (0, 0, 0 ), nr = ( 0, 1, 0 ), sw = 360, r = 1, d = 3, ut = 0, tol = 0.000129167, s = 8, n = tweek_crv_name, ch = 0 )
pm.setAttr( tweek_crv_name + '.scaleX', .5 )
pm.setAttr( tweek_crv_name + '.scaleY', .5 )
pm.setAttr( tweek_crv_name + '.scaleZ', .5 )
pm.setAttr( tweek_crv_name + '.overrideEnabled', 1 )
pm.setAttr( tweek_crv_name + '.overrideColor', 17 )
pm.makeIdentity( tweek_crv_name, apply=True, translate=True, rotate=True, scale=True )
pm.setAttr( tweek_crv_name + '.overrideEnabled', 1 )
pm.setAttr( tweek_crv_name + '.overrideColor', 17 )
pm.duplicate( tweek_crv_name, n= tweek_crv_name + 'A' )
pm.setAttr( tweek_crv_name + 'A.rotateZ', -90 )
pm.makeIdentity( tweek_crv_name + 'A', apply=True, translate=True, rotate=True, scale=True )
pm.duplicate( tweek_crv_name, n= tweek_crv_name + 'B' )
pm.setAttr( tweek_crv_name + 'B.rotateZ', -90 )
pm.setAttr( tweek_crv_name + 'B.rotateX', -90 )
pm.makeIdentity( tweek_crv_name + 'B', apply=True, translate=True, rotate=True, scale=True )
pm.parent( tweek_crv_name + 'AShape', tweek_crv_name + 'BShape', tweek_crv_name, add = True, shape = True )
pm.delete( tweek_crv_name + 'A', tweek_crv_name + 'B')
pm.select(tweek_crv_name, r=True)
offSetGRP.add_offset_grps()
conGRP.add_con_grps()
pm.select(clear = True)
pm.connectAttr( follicle + '.translate', tweek_crv_name + 'Offset_GRP.translate' )
pm.connectAttr( follicle + '.rotate', tweek_crv_name + 'Offset_GRP.rotate' )
pm.parent( tweek_crv_name + 'Offset_GRP', tweekCTRLGRP )
pm.scaleConstraint( main_crv_name, tweek_crv_name + 'Offset_GRP' )
pm.select( clear = True)
示例6: makeFk
def makeFk(sel, inputRoot):
currentChain = pm.ls(selection = True, dag = True)
if sel == False:
currentChain = pm.ls(inputRoot, dag = True)
controlList = []
primeList = []
createPad(currentChain[0])
for j, item in enumerate(currentChain):
if j != len(currentChain) - 1:
index = item.rfind('_')
newName = item[:index] + '_ctrl'
newControl = pm.circle(nr = [1,0,0], r = 1, n = newName)[0]
newPrime = createPrime(item, newControl)
pm.orientConstraint(newControl, item, mo = False)
controlList.append(newControl)
primeList.append(newPrime)
for x, item in enumerate(primeList):
if x != len(primeList) - 1:
pm.parent(primeList[x + 1], controlList[x])
示例7: strokePath
def strokePath(node, radius=.1):
"""
Create a nurbs surface from a curve control
"""
curveNodes = separateShapes(node)
for curveNode in curveNodes:
shape = curveNode.listRelatives(type='nurbsCurve')[0]
t = pm.pointOnCurve(shape, p=0, nt=1)
pos = pm.pointOnCurve(shape, p=0)
cir = pm.circle(r=radius)[0]
pm.xform(cir, t=pos, ws=1)
#align the circule along the curve
l = pm.spaceLocator()
pm.xform(l, t=[pos[0]+t[0], pos[1]+t[1], pos[2]+t[2]], ws=1)
pm.delete(pm.aimConstraint(l, cir, aimVector=[0,0,1]))
pm.delete(l)
newxf = pm.extrude(cir, curveNode, rn=False, po=0, et=2, ucp=1,
fpt=1, upn=1, scale=1, rsp=1, ch=1)[0]
pm.delete(cir)
pm.delete(curveNode.listRelatives(type='nurbsCurve'))
parentShape(curveNode, newxf)
if len(curveNodes) > 1:
for i in range(1, len(curveNodes)):
parentShape(curveNodes[0], curveNodes[i])
return curveNodes[0]
示例8: addJacketCollarRig
def addJacketCollarRig():
# jacket collar rig
collarjnts = pm.ls(sl=True)
# add hm, grp and auto nulls
for jnt in collarjnts:
ctl = pm.circle(r=0.5, sweep=359, normal=(1,0,0), n=jnt.replace('_jnt', '_ctl'))
auto = pm.group(ctl, n=jnt.replace('_jnt', '_auto'))
grp = pm.group(auto, n=jnt.replace('_jnt', '_grp'))
hm = pm.group(grp, n=jnt.replace('_jnt', '_hm'))
wMat = jnt.getMatrix(worldSpace=True)
hm.setMatrix(wMat, worldSpace=True)
collarparent = jnt.getParent()
collarparent | hm
auto | jnt
# auto
import rigger.modules.poseReader as poseReader
reload(poseReader)
xfo = nt.Joint(u'Mathilda_neck_jnt')
poseReader.radial_pose_reader(xfo, (1,0,0), (1,0,0))
# connect auto to sdks
import utils.rigging as rt
import rigger.utils.modulate as modulate
angleMult = pm.PyNode('Mathilda_neck_jnt.vectorAngle')
# Left collar A
rt.connectSDK('Mathilda_neck_jnt.param', 'LT_collarA_auto.rz',
{3.25:0, 4.6:50, 5.5:0})
mod = modulate.multiplyInput(pm.PyNode('LT_collarA_auto.rz'), 0, '_angle')
angleMult >> mod
# Letf collar B
rt.connectSDK('Mathilda_neck_jnt.param', 'LT_collarB_auto.rz',
{4:0, 5:180, 6:180, 7:0})
mod = modulate.multiplyInput(pm.PyNode('LT_collarB_auto.rz'), 0, '_angle')
angleMult >> mod
# Letf collar C
rt.connectSDK('Mathilda_neck_jnt.param', 'LT_collarC_auto.rz',
{0:200, 1.4:0, 4:0, 5.5:200, 6.6:280, 8:0})
mod = modulate.multiplyInput(pm.PyNode('LT_collarC_auto.rz'), 0, '_angle')
angleMult >> mod
# center collar
rt.connectSDK('Mathilda_neck_jnt.param', 'CT_collar_auto.rz',
{0:320, 2.5:0, 5.5:0, 8:320})
mod = modulate.multiplyInput(pm.PyNode('CT_collar_auto.rz'), 0, '_angle')
angleMult >> mod
# right collar A
rt.connectSDK('Mathilda_neck_jnt.param', 'RT_collarA_auto.rz',
{4.75:0, 3.4:50, 2.5:0})
mod = modulate.multiplyInput(pm.PyNode('RT_collarA_auto.rz'), 0, '_angle')
angleMult >> mod
# right collar B
rt.connectSDK('Mathilda_neck_jnt.param', 'RT_collarB_auto.rz',
{4:0, 3:180, 2:180, 1:0})
mod = modulate.multiplyInput(pm.PyNode('RT_collarB_auto.rz'), 0, '_angle')
angleMult >> mod
# right collar C
rt.connectSDK('Mathilda_neck_jnt.param', 'RT_collarC_auto.rz',
{0:200, 6.6:0, 4:0, 2.5:200, 1.4:280, 8:0})
mod = modulate.multiplyInput(pm.PyNode('RT_collarC_auto.rz'), 0, '_angle')
angleMult >> mod
pm.select(pm.PyNode(u'Mathilda_neck_jnt.param').outputs())
示例9: create_control
def create_control(control, module):
""" Creates a control for the rig, checking for existing controls or creating
Args:
control (str, pm.nt.Transform): can be anything really, just as long as it exists
Returns:
(pm.nt.Transform): the resulting transform of the control
"""
is_new = False
# Check if default control was created
if pm.objExists('grow_CTRL') and not pm.objExists(control):
control = pm.PyNode('grow_CTRL')
# Create the control if control doesn't exist
elif not pm.objExists(control):
control = pm.circle(n='grow_CTRL')
# Flat control in Y...
control[1].normalY.set(1)
control[1].normalZ.set(0)
control = control[0]
is_new = True
# If it's a string and we weren't passed a PyNode we need to check existing nodes
elif isinstance(control, basestring):
control = pm.PyNode(control)
setup_control_global_attrs(control, module)
return control, is_new
示例10: bdCreateCircleCon
def bdCreateCircleCon(self):
print 'Circle Controller'
test = mui.MQtUtil.findControl('createConBtn1')
print test
animConName = self.bdGetConName()
if animConName != '':
conSize = self.inputConSize.text()
overrideColor = self.conColors[str(self.inputConSide.currentText())]
if not conSize:
conSize=1
selection = pm.ls(sl = True)
selPos = [0,0,0]
selRot = [0,0,0]
if selection:
selPos = selection[0].getTranslation(space='world')
selRot = selection[0].getRotation(space='world')
circleCon = pm.circle(n = animConName ,nr=(0, 1, 0), c=(0, 0, 0),radius=float(conSize) ) [0]
circleCon.getShape().overrideEnabled.set(1)
circleCon.getShape().overrideColor.set(overrideColor)
circleConGrp = pm.group(circleCon,name = circleCon.name() + '_GRP')
circleConGrp.setTranslation(selPos)
circleConGrp.setRotation(selRot)
else:
pm.warning('Need a name, aborting')
示例11: __createNode__
def __createNode__(self, size=None, normal=(1,0,0), multiplier=1.0, refs=None, offset=None, geometries=None, *args, **kwargs):
"""
Create a simple circle nurbsCurve.
size: The maximum dimension of the controller.
"""
# Hack: Ensure geometries are hashable
if isinstance(geometries, list):
geometries = tuple(geometries)
# Resolve size automatically if refs are provided.
ref = next(iter(refs), None) if isinstance(refs, collections.Iterable) else refs
if size is None:
if ref is not None:
size = libRigging.get_recommended_ctrl_size(ref, geometries=geometries) * multiplier
else:
size = 1.0
transform, make = pymel.circle()
make.radius.set(size)
make.normal.set(normal)
# Expose the rotateOrder
# transform.rotateOrder.setKeyable(True)
return transform
示例12: build_upper_halfbox
def build_upper_halfbox(type, label=[], connections=True):
if not pm.objExists(type + "_Prnt"):
mainDict = {}
squareShape = [[-1.0, 1.0, 0.0],
[-1.0, 0.0043876273513161479, 0.0],
[1.0, 0.0043876273513161479, 0.0],
[1.0, 1.0, 0.0],
[-1.0, 1.0, 0.0]]
box = pm.curve(d=1, p=squareShape, n=type + "_Prnt")
boxShape = box.getShape()
boxShape.overrideEnabled.set(1)
boxShape.overrideDisplayType.set(1)
ctrl = pm.circle(nr=[0, 0, 0], r=0.2, ch=0, n=type + "_Ctrl")[0]
pm.parent(ctrl, box)
pm.transformLimits(ctrl, tx=[-1, 1], etx=[1, 1], ety=[1, 1], ty=[0, 1])
libUtilities.lockAttr(str(ctrl), ["tz", "rx", "ry", "rz", "sx", "sy", "sz", "v"])
mainDict["border"] = box
mainDict["ctrl"] = ctrl
if connections:
connect_dict = {}
connect_dict["TopLeftCorner"] = build_left_top_corner(type, ctrl)
connect_dict["TopRightCorner"] = build_right_top_corner(type, ctrl)
mainDict["connections"] = connect_dict
if label:
mainDict["label"] = build_label(label, box)
return mainDict
else:
raise Exception(type + " setup already exists")
示例13: vis_orbits
def vis_orbits(self):
global vis_orbGrp
vis_orbGrp = pm.group(n='olp_visOrbits', em=True)
intervValue = self.interv_int.value()
distValue = self.distance_float.value()
orbitValue = self.orbit_int.value()
global all_orbitObjs
all_orbitObjs = []
for orbit in range(orbitValue):
orbitRot = orbit * 360/float(orbitValue*2)
orbit_visObject = pm.circle(n='olp_orbCircle{0}'.format(orbit+1), r=distValue, s=intervValue*2, nr=[1, 0, 0], ch=True)[0]
pm.parent(orbit_visObject, vis_orbGrp)
orbit_visObject.overrideEnabled.set(1)
orbit_visObject.overrideColorRGB.set(0, 1, 1)
orbit_visObject.overrideRGBColors.set(1)
pm.xform(orbit_visObject, ro=[0, 0, orbitRot])
all_orbitObjs.append(orbit_visObject)
pm.xform(vis_orbGrp, a=True, t=sel_center)
pm.parent(vis_orbGrp, vis_mainGrp)
pm.select(sel_objects, r=True)
return vis_orbGrp
示例14: FTV_createMainFluidTextViewControl
def FTV_createMainFluidTextViewControl( inputsGrp , fluidSpaceTransform):
''' creation of the main control for the viewer'''
circle = pm.circle( n='fluidTextureViewerCtrl#', c=(0,0,0), nr=(0,1,0), sw=360, r=1, ut=False,s=8, ch=False )
pm.parent(circle[0],fluidSpaceTransform,r=True)
size = 0.5
ptList = [(-size,-size,-size), (size,-size,-size), (size,-size,size), (-size,-size,size), (-size,-size,-size), (-size,size,-size), (size,size,-size), (size,size,size), (-size,size,size), (-size,size,-size), (size,size,-size),(size,-size,-size),(size,-size,size),(size,size,size),(-size,size,size),(-size,-size,size)]
cube = pm.curve( p = ptList, d=1, n='tempNameCubeNurbs#')
grpDummyTransform = pm.group(em=True,n='dummyFluidSizeToMatrix#')
pm.connectAttr( inputsGrp+'.dimensionsW', grpDummyTransform+'.scaleX')
pm.connectAttr( inputsGrp+'.dimensionsH', grpDummyTransform+'.scaleY')
pm.connectAttr( inputsGrp+'.dimensionsD', grpDummyTransform+'.scaleZ')
FTV_lockAndHide( grpDummyTransform, ['tx','ty','tz','rx','ry','rz','sx','sy','sz','v'])
circleShape = FTV_createTransformedGeometry(circle,'local', 'create',grpDummyTransform)
cubeShape = FTV_createTransformedGeometry(cube,'local', 'create',grpDummyTransform)
pm.setAttr(cubeShape+'.template',True)
allCubeShapes = pm.listRelatives(cube,s=True)
parentShapeRes = pm.parent(allCubeShapes, circle, add=True, s=True)
pm.delete(cube)
pm.rename( parentShapeRes[0],'BBFluidShapeSrc#' )
retShape = pm.rename( parentShapeRes[1],'BBFluidShape#' )
FTV_lockAndHide(circle[0], ['rx','ry','rz','sx','sy','sz','v'])
# attributes connections
addMainAttributesToObject(circle[0],True)
FTV_multiConnectAutoKeyableNonLocked( circle[0], inputsGrp, ['translateX','translateY','translateZ'])
pm.parent(grpDummyTransform,fluidSpaceTransform,r=True)
return circle[0], retShape
示例15: test_create_heirarchy
def test_create_heirarchy(self):
# Test on object with parent
jnts = []
jnts.append(pm.joint(p=(1, 1, 1)))
jnts.append(pm.joint(p=(2, 2, 2)))
crv = pm.circle()[0]
pm.delete(pm.parentConstraint(jnts[-1], crv, mo=0))
pm.parent(crv, jnts[-1])
grps = control.create_heirarchy('temp', crv, 5)
count = 0
for g in grps:
self.assertTrue(
transforms.assertLocationsMatch(g, crv))
self.assertTrue(
transforms.assertDefaultScale(g))
if count > 0:
self.assertTrue(
transforms.assertAllZero(g))
self.assertTrue(
transforms.assertParentIs(g, grps[count-1]))
count += 1
self.assertEqual(grps[0].name(), 'temp_top_node')
self.assertEqual(grps[-1].name(), 'temp_btm_node')
self.assertTrue(transforms.assertParentIs(crv,
grps[-1]))
self.assertTrue(transforms.assertParentIs(grps[0],
jnts[-1]))
self.assertTrue(transforms.assertAllZero(crv))
self.assertTrue(transforms.assertDefaultScale(crv))