本文整理汇总了Python中maya.cmds.duplicate函数的典型用法代码示例。如果您正苦于以下问题:Python duplicate函数的具体用法?Python duplicate怎么用?Python duplicate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了duplicate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: bdRigEye
def bdRigEye(side):
#create IK handles for the bind joints, for now getting the joints based on the name
bindJoints = cmds.ls(side + "*Lid_jnt_*")
eyeJoint = cmds.ls(side + "*eye*jnt")[0]
eyeAnim = cmds.ls(side + '_eye_anim')
cmds.aimConstraint(eyeAnim[0],eyeJoint,offset = [0, 0, 0] ,weight=1 , aimVector =[1 ,0 ,0] ,upVector=[0, 1, 0] ,worldUpType="vector" ,worldUpVector= [0,1,0])
blinkUpJnt = cmds.duplicate(eyeJoint,name = side + '_eye_upLid_blink_jnt',po=True)
blinkLowJnt = cmds.duplicate(eyeJoint,name = side + '_eye_lowLid_blink_jnt',po=True)
baseLidsJnt = cmds.ls(side + '*lids*base')
cmds.parent([blinkUpJnt[0],blinkLowJnt[0]],baseLidsJnt[0])
for joint in bindJoints:
print joint
endJoint = cmds.listRelatives(joint,c=True,type='joint')
ikName = endJoint[0].replace('bnd_jnt','ikHandle')
ctrlName = endJoint[0].replace('bnd_jnt','anim')
bdRigUtils.bdAddIk(joint,endJoint[0],'ikSCsolver',ikName)
bdRigUtils.bdBuildBoxController(endJoint[0],ctrlName,0.2)
bdRigUtils.bdAddAttributeMinMax(ctrlName,['BlinkPosition'],'double',-5,5,1)
cmds.parent(ikName,ctrlName)
bdBuildJointStructure(joint,ctrlName,ikName)
allAnimsGrps = cmds.ls(side + '*eye*CON_??',type='transform')
globalAnimGrp = cmds.ls('controllers')
cmds.parent(allAnimsGrps,globalAnimGrp[0])
bdAddEyeAttr(eyeAnim[0])
bdCreateVerticalFollow(side)
bdCreateSideFollow(side)
bdCreateBlink(side)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:31,代码来源:bdRigEye.py
示例2: prepare
def prepare(self):
""" preparing mirror corretiveShape """
# default pose
self.setDefaultPose()
meshName = (name.getSide(self.mesh)+ "_" + name.getDescription(self.mesh) + "DUP" + "_" + name.getType(self.mesh))
#make hierachy
if not cmds.objExists(meshName):
dup = cmds.duplicate(self.mesh, rr=True, n=meshName)
attribute.lockAll(dup[0], True)
cmds.setAttr(dup[0] + ".visibility", 0)
cmds.parent(dup, self.DupsName)
self.wrapDeformer(dup, self.mesh)
xform.zeroOut(dup[0], t = 1, r = 1, s = 1)
self.dups.append(dup)
#END if
else:
dup = meshName
print "%s already exists!!!" % meshName
#END else
#pose copy
eachPoseName = (name.getSide(self.mesh)+ "_" + name.getDescription(self.mesh) + self.description + "_" + name.getType(self.mesh))
cmds.setAttr(self.control + ".rotate" + self.axis, self.angle)
self.eachPose = cmds.duplicate(dup, rr=True, n=eachPoseName)
cmds.parent(self.eachPose, self.TransName)
xform.zeroOut(self.eachPose[0], t = 1, r = 1, s = 1)
#neutral pose.
self.setDefaultPose()
开发者ID:blackoz,项目名称:jun,代码行数:29,代码来源:poseDeformer.py
示例3: triangulateMesh
def triangulateMesh(isObj, simplify, smoothe):
if isObj and not cmds.objExists('triObj'):
cmds.select(baseObject)
cmds.duplicate(baseObject, name = "triObj")
cmds.select('triObj')
if smoothe:
cmds.polySmooth('triObj', c=smoothe)
cmds.polyReduce(ver = 1)
cmds.polyReduce(ver = 1)
if simplify > 0:
cmds.polyReduce(ver = 1, p = simplify)
num_faces = cmds.polyEvaluate('triObj', f=True)
print "Triangulating faces..."
#iterate over faces
face_i = 0
while face_i < num_faces:
if ((num_faces - face_i) % 5 == 0):
print "Triangulate check: Approximately " + str(num_faces - face_i) + " faces remaining...."
face = cmds.select('triObj.f['+ str(face_i)+']')
verts = getCorners(isObj,face_i)
if not isCoplanar(verts):
cmds.polyTriangulate('triObj.f['+ str(face_i)+']')
num_faces = cmds.polyEvaluate('triObj', f=True)
face_i +=1
开发者ID:ahamburger,项目名称:bedazzler,代码行数:28,代码来源:bedazzle.py
示例4: duplicate_button
def duplicate_button( self, *args ):
self.original_selected_objects = cmds.ls( selection=True )
if( len(self.original_selected_objects) == 0 ):
print "Nothing selected"
return 0
elif( len(self.original_selected_objects) == 1 ):
self.relatives = cmds.listRelatives( children=True )
if( len(self.relatives) == 1 ):
print "Skip combine"
cmds.duplicate( self.original_selected_objects, name=self.original_selected_objects[0] + "_Copy" )
cmds.delete( constructionHistory=True )
the_parent = cmds.listRelatives( parent=True )
if( the_parent != None ):
cmds.parent( self.original_selected_objects[0] + "_Copy", world=True )
else:
self.combine()
else:
self.combine()
self.newOriginCopy = cmds.ls( selection=True )[0]
self.bbox = cmds.exactWorldBoundingBox( self.newOriginCopy )
cmds.move((self.bbox[0] + self.bbox[3])/2, self.bbox[1], (self.bbox[2] + self.bbox[5])/2, self.newOriginCopy + ".scalePivot", self.newOriginCopy + ".rotatePivot", absolute=True)
cmds.move( 0, 0, 0, self.newOriginCopy, rpr=True )
cmds.makeIdentity( apply=True, t=1, r=1, s=1 )
cmds.delete( constructionHistory=True )
开发者ID:cwilmot,项目名称:maya-bulge-deformer-tool,代码行数:30,代码来源:MayaBulgeTool.py
示例5: makeRobot
def makeRobot():
MayaCmds.polyCube(name="head")
MayaCmds.move(0, 4, 0, r=1)
MayaCmds.polyCube(name="chest")
MayaCmds.scale(2, 2.5, 1)
MayaCmds.move(0, 2, 0, r=1)
MayaCmds.polyCube(name="leftArm")
MayaCmds.move(0, 3, 0, r=1)
MayaCmds.scale(2, 0.5, 1, r=1)
MayaCmds.duplicate(name="rightArm")
MayaCmds.select("leftArm")
MayaCmds.move(1.25, 0, 0, r=1)
MayaCmds.rotate(0, 0, 32, r=1, os=1)
MayaCmds.select("rightArm")
MayaCmds.move(-1.25, 0, 0, r=1)
MayaCmds.rotate(0, 0, -32, r=1, os=1)
MayaCmds.select("rightArm", "leftArm", "chest", r=1)
MayaCmds.group(name="body")
MayaCmds.polyCube(name="bottom")
MayaCmds.scale(2, 0.5, 1)
MayaCmds.move(0, 0.5, 0, r=1)
MayaCmds.polyCube(name="leftLeg")
MayaCmds.scale(0.65, 2.8, 1, r=1)
MayaCmds.move(-0.5, -1, 0, r=1)
MayaCmds.duplicate(name="rightLeg")
MayaCmds.move(1, 0, 0, r=1)
MayaCmds.select("rightLeg", "leftLeg", "bottom", r=1)
MayaCmds.group(name="lower")
MayaCmds.select("head", "body", "lower", r=1)
MayaCmds.group(name="robot")
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:33,代码来源:AlembicNodeName_test.py
示例6: tip
def tip(ref):
selection = cmds.ls(sl=True)
for tip in selection:
bind = tip
name = tip.replace("bind_", "")
old_name = "old_%s" % name
old_bind = "old_%s" % bind
cmds.rename(name, old_name)
cmds.rename(bind, old_bind)
cmds.duplicate(ref, rr=True, un=True, name=bind)
cmds.duplicate(bind, name=name)
bs = cmds.blendShape(bind, name, origin="world")
cmds.setAttr(bs[0] + ".w[0]", 1)
joint = cmds.listConnections(cmds.parentConstraint(old_bind, q=True), type="joint")[0]
cmds.parentConstraint(joint, bind, maintainOffset=False)
cmds.parent(name, cmds.listRelatives(old_name, p=True)[0])
cmds.parent(bind, cmds.listRelatives(old_bind, p=True)[0])
cmds.delete(old_name, old_bind)
开发者ID:adamfok,项目名称:afok_toolset,代码行数:25,代码来源:venom_claw_replace.py
示例7: CreateCamera
def CreateCamera(self):
print "Creating camera"
#Array to store all objects in the scene
cmds.select(None)
#Copy from the current active camera
cmds.duplicate( self.GetActiveCamera(), name = self.Camera)
try:cmds.delete(self.Camera + "|CMForegroundPlane")
except:pass
try:cmds.delete(self.Camera + "|CMBackgroundPlane")
except:pass
i = 0
while(cmds.objExists("shot_" + str(i))):
try:cmds.delete(self.Camera + "|" + "shot_" + str(i) + "_ImagePlane")
except:pass
i = i + 1
#Make the camera startup so that the user may not delete it directly
#Enable the resolution gate
cmds.camera(self.Camera, edit = True, startupCamera = True, displayResolution = True)
#Make the camera hidden
cmds.setAttr(self.Camera + ".visibility", False)
#Add the attributes to define range and renderability
cmds.select(self.Camera)
cmds.addAttr(longName = 'CMRenderable', attributeType = 'bool', defaultValue = True)
cmds.addAttr(longName = 'StartRange', attributeType = 'short', defaultValue = 0, min = 0, max = 35)
cmds.addAttr(longName = 'StopRange' , attributeType = 'short', defaultValue = 35, min = 0, max = 35)
cmds.select(None)
开发者ID:Kif11,项目名称:turbosquid_maya_publisher,代码行数:32,代码来源:TurntableFile.py
示例8: extractSplits
def extractSplits():
splits = cmds.ls(sl=True)
bshp = "{0}_BSHP".format(splits[0])
# first target should be set to 1, but just in case reset them all
targets = getTargets(bshp)
for target in targets:
blendName = "{0}.{1}".format(bshp, target)
cmds.setAttr( blendName, 0 )
for target in targets:
blendName = "{0}.{1}".format(bshp, target)
cmds.setAttr( blendName, 1 )
# duplicate each split
for i, split in enumerate(splits):
cmds.select(split)
# name extraction
extract = target.split("_")
name = ("{0}_{1}{2}_{3}".format(extract[0], extract[1], str(i+1), extract[2]))
cmds.duplicate(n=name)
cmds.setAttr( blendName, 0)
开发者ID:jdynamite,项目名称:autorigger,代码行数:26,代码来源:blendShapes.py
示例9: splitShapeSetup
def splitShapeSetup():
# create 3 splitOutput meshes that will be painted
# start with creating the splitters
selection = cmds.ls(sl=True)
meshList = selection[:-1]
base = selection[-1]
splitters = []
blends = []
meshes = ["A", "B", "C"]
inputMeshList = meshList
# first target plays an important role, this is the one we're going to default turn on and align to in tx
first = meshList[0]
for i, letter in enumerate(meshes):
# create splitters
split = "{0}_split{1}".format(base, letter)
cmds.duplicate(base, n=split)
cmds.delete(cmds.parentConstraint(first, split))
# how far to move the dup
dist = (int(i) + 1) * 10
cmds.move(dist, 0, 0, split, r=True)
blend = "{0}_BSHP".format(split)
cmds.select(split)
cmds.blendShape(n=blend)
splitters.append(split)
blends.append(blend)
# add blends and set them too yada yada
blendDrivers = []
blendDrivers = blendDrivers + meshList
for i, split in enumerate(splitters):
# connections?
cmds.select(blendDrivers)
cmds.select(split, tgl=True)
mel.eval("performBlendShapeAdd 0;")
blendDrivers.append(split)
# if a splitter, set to -1
for s in splitters:
splitBshp = "{0}.{1}".format(blends[i], s)
if cmds.objExists(splitBshp):
cmds.setAttr(splitBshp, -1)
# Turn on the first. Just as a default
for blend in blends:
cmds.setAttr("{0}.{1}".format(blend, first), 1)
# connect all meshList input shapes to each other
for i, target in enumerate(inputMeshList):
print inputMeshList
if blend != blends[0]:
cmds.connectAttr(
"{0}.{1}".format(blends[0], target),
"{0}.{1}".format(blend, target)
)
开发者ID:jdynamite,项目名称:autorigger,代码行数:60,代码来源:blendShapes.py
示例10: getMeshVertexData
def getMeshVertexData( mesh ):
returnData = []
exportObject = 'bwExportObject'
cmds.duplicate( mesh, n=exportObject )
cmds.polyTriangulate(exportObject)
numOfFaces = cmds.polyEvaluate(exportObject, f=True )
for i in xrange(0, numOfFaces):
faceSelect = exportObject + '.f[' + str(i) + ']'
fVertices = []
fVertices = cmds.polyListComponentConversion(faceSelect, ff = True, tvf = True)
fVertices = cmds.filterExpand(fVertices, sm = 70, ex = True)
print fVertices
for vertex in fVertices:
faceDict = {}
vName = cmds.polyListComponentConversion(vertex, fvf = True, tv = True)
xyz = []
xyz = cmds.xform(vName, q = True, os = True, t = True)
faceDict['x'] = round(xyz[0], 2)
faceDict['y'] = round(xyz[1], 2)
faceDict['z'] = round(xyz[2], 2)
normal = []
normal = cmds.polyNormalPerVertex(vertex, q = True, xyz = True)
faceDict['xN'] = round(normal[0], 2)
faceDict['yN'] = round(normal[1], 2)
faceDict['zN'] = round(normal[2], 2)
# vuv = []
# vuv = cmds.polyListComponentConversion(vertex, fvf = True, tuv = True)
# uvCoords = []
# uvCoords = cmds.polyEditUV(vuv[0], q = True, u = True, v = True)
# faceDict['u'] = round(uvCoords[0], 2)
# faceDict['v'] = round(uvCoords[0], 2)
returnData.append(faceDict)
cmds.delete(exportObject)
return json.dumps(returnData)
开发者ID:buba447,项目名称:mayaMidiConnect,代码行数:34,代码来源:bw.py
示例11: mirror_shape
def mirror_shape(path):
"""In addition to mirroring transforms, also mirror shapes
Arguments:
path (str): Path to transform with shapes to mirror
Returns:
Path to mirrored transform
"""
mirrored_transform = mirror_transform(path)
mirrored_original = cmds.duplicate(path,
name=path + "_duplicate")
mirrored_group = cmds.createNode('transform',
name=path + "_transform")
cmds.parent(mirrored_original[0], mirrored_group)
cmds.setAttr(mirrored_group + ".sx", -1)
blendshape = cmds.blendShape((mirrored_original[0], mirrored_transform),
origin='world')
cmds.setAttr(blendshape[0] + "." + mirrored_original[0], 1)
mirrored_with_shape = cmds.duplicate(mirrored_transform,
inputConnections=True,
returnRootsOnly=True)
cmds.delete([mirrored_transform, mirrored_group])
cmds.select(mirrored_with_shape, replace=True)
return mirror_transform
开发者ID:pyblish,项目名称:pyblish-napoleon,代码行数:31,代码来源:mirroring.py
示例12: buildPlanes
def buildPlanes(block):
buildings = []
faces = block.faceList
drop = block.dropRate
i = 0
sidewalkHeight = max(block.heightRange)/160.0
for f in faces:
if(random.random() >= block.dropRate):
height = 1.0*random.choice(block.heightRange)
levels = random.choice(block.levelRange)
#get the midpoint of the current face
verts = makeVertList(cmds.xform(f, q=True, t=True))
midpoint = getMidpoint(verts, True)
#make a duplicate of the parent plane
cmds.select(block.parentPlane)
dupName = block.name + "building_"+str(i)
dupFace = dupName + ".f[0]"
cmds.duplicate(name=dupName)
cmds.xform(t=midpoint)
#create building and add it to building list
makeBuilding(dupFace, levels, height, sidewalkHeight)
buildings += [dupName]
i += 1
if(not updateProgressWindow(i, len(faces))):
break
cmds.group(buildings, name=block.name + "_buildings")
killProgressWindow()
开发者ID:agentqwerty,项目名称:python_scripts,代码行数:27,代码来源:city_builder.py
示例13: duplicateObject
def duplicateObject(self, objName, modifiedName, *args):
# ベースオブジェクトを選択
cmds.select(str(objName), r=True)
# 複製しXMLと合致しなかった名前にリネーム
cmds.duplicate(n=modifiedName, rr=True)
开发者ID:Polytrash,项目名称:Unity_script,代码行数:7,代码来源:SyncUnityTransform.py
示例14: LoadDelta
def LoadDelta(Args):
global adress
# Open dialog window to choose directory to load delta
folder = cmds.fileDialog2( cap='Choose directory to load Delta', fm=3, dialogStyle=1 )
adress = folder[0]+"\\"
pathList_cleared = []
targetBlendDict = {}
named_targetBlendDict = {}
print "Loading Delta :)"
# Getting .bsp files from choosen folder
pathList = os.listdir( adress )
if len(pathList) == 0:
print "Folder is empty"
for element in pathList:
if '.bsp' in element:
pathList_cleared.append( element )
else:
print 'wrong type - ', element
pathList = pathList_cleared
headObj = cmds.ls( sl=True )
object_qnty_check(headObj)
headObject = headObj[0]
step = 25
for i in range( len(pathList) ):
start_time = timeit.default_timer()
named_targetBlendDict.clear()
path_name = open( adress+pathList[i],'r' )
DeltaDict = pickle.load( path_name )
targetBlendDict.clear()
new_name = pathList[i].split('.')[0]
cmds.duplicate( headObj[0], n=headObject+'_' + new_name )
cmds.select( headObject+'_'+new_name )
cmds.move( step, 0, 0 )
step += 25
for key in compOpacities:
weight = compOpacities.get(key)
x = baseVertDict[key][0] + (DeltaDict[key][0] * weight)
y = baseVertDict[key][1] + (DeltaDict[key][1] * weight)
z = baseVertDict[key][2] + (DeltaDict[key][2] * weight)
targetBlendDict[key] = [x, y, z]
copy_headObj = cmds.ls( sl=True )
for head in copy_headObj:
for i in targetBlendDict:
named_targetBlendDict[head+'.vtx' + str(i)] = targetBlendDict[i]
for head in copy_headObj:
for vert, value in named_targetBlendDict.iteritems():
cmds.xform( vert, t=value )
print "Loading time - ", head, ( timeit.default_timer() - start_time )
cmds.softSelect( sse=1 )
names = cmds.listAttr( "blendShape1", m=True, k=True )[1:]
fullNames = []
for i in names:
fullNames.append( headObj[0] + '_' + i )
cmds.blendShape( fullNames, headObj )
cmds.delete( fullNames )
return adress
开发者ID:AndreySibiryakov,项目名称:coding,代码行数:60,代码来源:softselection_save_load_on_blendshapes.py
示例15: __init__
def __init__(self, curve_sel, vertex_list):
self.curve_sel = curve_sel
self.verts = vertex_list
self.find_length = Find_Out()
self.link_length = self.find_length.edge_length(self.verts)
self.chain_length = self.find_length.curve_length(self.curve_sel)
self.link_total = int(self.chain_length/self.link_length)
cmds.duplicate(self.curve_sel, n = 'buildCurve')
cmds.rebuildCurve('buildCurve', ch = 1, rpo = 1, rt = 0, end = 1, kr = 2, kep = 1, kt = 0, kcp = 0, s = self.link_total/2, d = 3, tol = 0.01 )
self.num_cv = int(cmds.getAttr ('buildCurve.degree'))+ (cmds.getAttr ('buildCurve.spans'))
for dummy_cv in range(self.num_cv):
dummy_cv_pos = (cmds.getAttr ('buildCurve.cv['+ str(dummy_cv) +']'))
if dummy_cv == 0:
cmds.joint(n=self.curve_sel+'_jointRoot',p = dummy_cv_pos[0])
elif dummy_cv == self.num_cv - 1:
cmds.joint(n=self.curve_sel+'_jointEnd', p = dummy_cv_pos[0])
else:
cmds.joint(n=self.curve_sel+'_joint_'+(str(dummy_cv)),p = dummy_cv_pos[0])
cmds.delete('buildCurve')
cmds.ikHandle( sj = (self.curve_sel+'_jointRoot'), ee = (self.curve_sel+'_jointEnd'), c = self.curve_sel,
sol = 'ikSplineSolver', scv = 0, pcv = 0, ccv = 0, ns = 4)
开发者ID:XJZeng,项目名称:ChainMaker,代码行数:27,代码来源:chain_maker.py
示例16: ctrl_pointer
def ctrl_pointer():
mel.eval('curve -d 1 -p -1 0 0 -p 1 0 0 -p 1 1 0 -p 1 2 0 -p 1 3 0 -p 2 3 0 -p 0 5 0 -p -2 3 0 -p -1 3 0 -p -1 2 0 -p -1 1 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')
ctrl = cmds.ls(sl=True)
cmds.duplicate(rr=True)
ctrl2 = cmds.ls(sl=True)
cmds.setAttr(ctrl2[0] + '.rotateY', 90)
print 'Curves have been positioned.'
cmds.makeIdentity(apply=True, t=1, r=1, s=1, n=0)
print 'Freezing transforms on curves.'
cmds.select(ctrl, r=True)
cmds.pickWalk(d='Down')
cmds.select(ctrl2, add=True)
cmds.parent(r=True, s=True)
print 'Curves have been parented into single curve.'
cmds.select(ctrl, r=True)
mel.eval('doDelete')
print 'Unsuded groups have been deleted.'
cmds.select(ctrl2)
mel.eval('CenterPivot')
print 'Curve has been selected and its pivot has been centered.'
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:25,代码来源:ctrl_crv_tool.py
示例17: claw
def claw(ref):
# duplicate geo
selection = cmds.ls(sl=True)
for locator in selection:
split = locator.split("section_")
name = "%sclaw_%s" % (split[0], split[1].replace("locator", "C"))
bind = "bind_%s" % name
old_name = "old_%s" % name
old_bind = "old_%s" % bind
cmds.rename(name, old_name)
cmds.rename(bind, old_bind)
cmds.duplicate(ref, rr=True, un=True, name=bind)
cmds.duplicate(bind, name=name)
shape = cmds.listRelatives(bind, s=True)[0]
claw_bs = cmds.listConnections(shape, type="blendShape", s=True)[0]
cmds.connectAttr(locator + ".parameter", claw_bs + ".tentacle_claw")
cmds.scaleConstraint(locator, bind, maintainOffset=False)
cmds.parentConstraint(locator, bind, maintainOffset=False)
bs = cmds.blendShape(bind, name, origin="world")
cmds.setAttr(bs[0] + ".w[0]", 1)
cmds.parent(name, cmds.listRelatives(old_name, p=True)[0])
cmds.parent(bind, cmds.listRelatives(old_bind, p=True)[0])
cmds.delete(old_name, old_bind)
开发者ID:adamfok,项目名称:afok_toolset,代码行数:31,代码来源:venom_claw_replace.py
示例18: buildPlanes
def buildPlanes(self):
"""
Creates buildings on new planes with probability of 1-SPAWN_CHANCE
"""
buildings = []
i = 0
sidewalkHeight = self.maxHeight/160.0
for f in self.faceList:
if(random.random() >= self.dropRate):
height = self.minHeight +\
random.random()*(self.maxHeight-self.minHeight)
levels = random.choice(self.levelRange)
#get the midpoint of the current face
verts = makeVertList(cmds.xform(f, q=True, t=True))
midpoint = getMidpoint(verts, True)
#make a duplicate of the parent plane
dupName = self.name + "building_"+str(i)
dupFace = dupName + ".f[0]"
cmds.duplicate(self.sourcePlane, name=dupName)
cmds.xform(t=midpoint)
#create building and add it to building list
self.makeBuilding(dupFace, levels, height, sidewalkHeight)
buildings += [dupName]
i += 1
if(not updateProgressWindow(i, len(self.faceList))):
break
cmds.group(buildings, name=self.name + "_buildings")
killProgressWindow()
开发者ID:agentqwerty,项目名称:python_scripts,代码行数:31,代码来源:quickCity.py
示例19: geoCrowd
def geoCrowd() :
# Import referenced characters
# select geometries then run script
sels = mc.ls( sl=True )
ctrls = []
for sel in sels :
ns = sel.split( ':' )[0]
if not ns in ctrls :
ctrl = mc.circle( nr=(0,1,0) , ch=False )[0]
grp = mc.group( ctrl )
root = '%s:Root_Ctrl' % ns
mc.delete( mc.parentConstraint( root , grp ) )
ctrl = mc.rename( ctrl , ns )
mc.rename( grp , '%s_grp' % ns )
ctrls.append( ns )
attrs = ('tx','ty','tz','rx','ry','rz','sx','sy','sz')
for attr in attrs :
if mc.getAttr( '%s.%s' % ( sel , attr ) , l=True ) :
mc.setAttr( '%s.%s' % ( sel , attr ) , l=False )
mc.select( sel , r=True )
mc.duplicate( sel , rr=True )
geo = mc.ls( sl=True , l=True )[0]
mc.parent( geo , ctrl )
开发者ID:myCodeTD,项目名称:pkmel,代码行数:32,代码来源:pkTools.py
示例20: runTest
def runTest(self):
try:
import maya.cmds as cmds
def getShape(trans):
return cmds.listRelatives(trans, children=True, shapes=True)[0]
cmds.file(new=1, f=1)
shapeTransform = cmds.polyCube(name='singleShapePoly')[0]
origShape = getShape(shapeTransform)
dupeTransform1 = cmds.duplicate(origShape, parentOnly=1)[0]
cmds.parent(origShape, dupeTransform1, shape=True, addObject=True, relative=True)
dupeTransform2 = cmds.duplicate(dupeTransform1)[0]
cmds.delete(dupeTransform1)
dupeShape = getShape(dupeTransform2)
# In maya 2014, this raises:
# Error: Connection not made: 'singleShapePolyShape2.instObjGroups[1]' -> 'initialShadingGroup.dagSetMembers[2]'. Source is not connected.
# Connection not made: 'singleShapePolyShape2.instObjGroups[1]' -> 'initialShadingGroup.dagSetMembers[2]'. Destination attribute must be writable.
# Connection not made: 'singleShapePolyShape2.instObjGroups[1]' -> 'initialShadingGroup.dagSetMembers[2]'. Destination attribute must be writable.
# Traceback (most recent call last):
# File "<maya console>", line 13, in <module>
# RuntimeError: Connection not made: 'singleShapePolyShape2.instObjGroups[1]' -> 'initialShadingGroup.dagSetMembers[2]'. Source is not connected.
# Connection not made: 'singleShapePolyShape2.instObjGroups[1]' -> 'initialShadingGroup.dagSetMembers[2]'. Destination attribute must be writable.
# Connection not made: 'singleShapePolyShape2.instObjGroups[1]' -> 'initialShadingGroup.dagSetMembers[2]'. Destination attribute must be writable. #
cmds.parent(dupeShape, shapeTransform, shape=True, addObject=True, relative=True)
except Exception:
pass
else:
self.fail("ShapeParentInstance bug fixed!")
开发者ID:assumptionsoup,项目名称:pymel,代码行数:31,代码来源:test_mayaBugs.py
注:本文中的maya.cmds.duplicate函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论