本文整理汇总了Python中maya.cmds.polyUnite函数的典型用法代码示例。如果您正苦于以下问题:Python polyUnite函数的具体用法?Python polyUnite怎么用?Python polyUnite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了polyUnite函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: generate
def generate(cls, *args):
components = []
boolean = []
width = cmds.intSliderGrp(cls.get_prefix() + Labels["width_label"], query=True, value=True)
rgb = cmds.colorSliderGrp(cls.get_prefix() + Labels["color_label"], query=True, rgbValue=True)
block_width = width * Constants["block_width_unit"]
block_height = Constants["block_height_unit"]
block_depth = Constants["block_depth_unit"]
for x in range(0, width):
stub = cmds.polyCylinder(name=get_unique_name(cls.get_prefix(), "Stub"), radius=Constants["stub_radius"], height = Constants["stub_height"])
components.append(stub[0])
cmds.move(Constants["block_width_unit"] * x + half(Constants["block_width_unit"]), half(Constants["block_height_unit"]) + half(Constants["stub_height"]), half(Constants["block_depth_unit"]), stub[0])
for x in range(0, width-1):
hole = cmds.polyCylinder(name=get_unique_name(cls.get_prefix(), "Hole"), radius=Constants["perforation_radius"], height=Constants["block_depth_unit"] + 0.2)
boolean.append(hole[0])
cmds.rotate('90deg', 0, 0, hole[0])
cmds.move(Constants["block_width_unit"] * x + Constants["block_width_unit"], 0, half(Constants["block_depth_unit"]), hole[0])
cube = cmds.polyCube(sx=5,sy=2,sz=2,name=get_unique_name(cls.get_prefix(), "block"), width=block_width, height=block_height, depth=block_depth)
components.append(cube[0])
cmds.move(half(width * Constants["block_width_unit"]), 0, half(Constants["block_depth_unit"]), cube)
solid = cmds.polyUnite(components, name=get_unique_name(cls.get_prefix(), ""))
boolean_group = cmds.polyUnite(boolean, name=get_unique_name(cls.get_prefix(),"boolean"))
final = cmds.polyBoolOp( solid[0], boolean_group[0], op=2, n=get_unique_name(cls.get_prefix(), "") )
shader = cmds.shadingNode('blinn', asShader=True, name=get_unique_name(cls.get_prefix(),"mat"))
cmds.setAttr(shader + ".color", rgb[0],rgb[1],rgb[2], type='double3')
cmds.select(final[0], r=True)
cmds.hyperShade(assign=shader)
开发者ID:JakeCataford,项目名称:3dcg-tutorials,代码行数:32,代码来源:LegoBuilder.py
示例2: generate_kink_peice
def generate_kink_peice(cls, block_width):
components = []
boolean = []
for x in range(0, block_width + 1):
hole = cmds.polyCylinder(name=get_unique_name(cls.get_prefix(), "Hole"), radius=Constants["perforation_radius"], height=Constants["block_depth_unit"] + 0.2)
boolean.append(hole[0])
cmds.rotate('90deg', 0, 0, hole[0])
cmds.move(Constants["block_width_unit"] * x , 0, half(Constants["block_depth_unit"]), hole[0])
cube = cmds.polyCube(sx=5,sy=2,sz=2,name=get_unique_name(cls.get_prefix(), "block"), width=block_width, height=Constants["block_height_unit"], depth=Constants["block_depth_unit"])
components.append(cube[0])
cmds.delete(cube[0] + ".f[40:47]")
cmds.move(half(block_width * Constants["block_width_unit"]), 0, half(Constants["block_depth_unit"]), cube)
#caps
cap_one = cmds.polyCylinder(sc=1, sy=2, radius=half(Constants["block_height_unit"]), height=Constants["block_depth_unit"],name=get_unique_name(cls.get_prefix(), "cap"))
cmds.rotate('90deg',0,0,cap_one[0])
cmds.move(0,0,half(Constants["block_depth_unit"]),cap_one[0])
cmds.delete(cap_one[0] + ".f[0:3]", cap_one[0] + ".f[14:23]", cap_one[0] + ".f[34:43]", cap_one[0] + ".f[54:63]", cap_one[0] + ".f[74:79]")
components.append(cap_one[0])
#caps
cap_two = cmds.polyCylinder(sc=1, sy=2, radius=half(Constants["block_height_unit"]), height=Constants["block_depth_unit"])
cmds.rotate('90deg','180deg',0,cap_two[0])
cmds.delete(cap_two[0] + ".f[0:3]", cap_two[0] + ".f[14:23]", cap_two[0] + ".f[34:43]", cap_two[0] + ".f[54:63]", cap_two[0] + ".f[74:79]")
cmds.move(block_width,0,half(Constants["block_depth_unit"]),cap_two[0])
components.append(cap_two[0])
solid = cmds.polyUnite(components, name=get_unique_name(cls.get_prefix(), ""))
boolean_group = cmds.polyUnite(boolean, name=get_unique_name(cls.get_prefix(),"boolean"))
cmds.polyMergeVertex( solid[0], d=0.15 )
cmds.delete(solid[0],ch=1)
return cmds.polyBoolOp( solid[0], boolean_group[0], op=2, n=get_unique_name(cls.get_prefix(), "") )
开发者ID:JakeCataford,项目名称:3dcg-tutorials,代码行数:33,代码来源:LegoBuilder.py
示例3: dup
def dup(*args):
neg = cmds.checkBox("negChck", q=True, v=True)
mrge = cmds.checkBox("mrgChck", q=True, v=True)
dupAx = cmds.radioButtonGrp("axChck", q=True, sl=True)
selected = cmds.ls(sl=True)
print(mrge)
if(dupAx==1):
scaD = ".scaleX"
if(dupAx==2):
scaD = ".scaleY"
if(dupAx==3):
scaD = ".scaleZ"
if(neg==1):
scaVal = -1
else:
scaVal = 1
newDup = cmds.duplicate(rr=True)
cmds.setAttr(newDup[0] + scaD, scaVal)
if (mrge==1):
cmds.polyUnite(selected, newDup[0])
cmds.polyMergeVertex(d=1)
else:
None
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:27,代码来源:proModTool.py
示例4: makeStreetTree
def makeStreetTree(shaders):
'''
Creates a tree on a circular platform and with a circular fence around it.
shaders: A list of shaders for the tree crowns.
On exit: A tree has been created using makeTree(...), a circular platform
has been created underneath it and a fence around it. Appropriate
shaders have been assigned. Everything is united into one polygonal
object and returned as a tuple with the object name and the node
name.
'''
tree = makeTree(shaders)
platform = cmds.polyCylinder(name = "platform",h = 0.1, r = 0.8)
cmds.move(0.25, y = True)
cmds.sets(platform[0], edit=True, forceElement="fountainMaterialGroup")
pole = cmds.polyCube(name = "pole", h = 0.6, w = 0.04, d = 0.04)
cmds.xform(pole, t = (0.7,0.45,0))
angle = 360/10.0
for i in range(1,10):
pole1 = cmds.polyCube(name = "pole", h = 0.6, w = 0.04, d = 0.04)
cmds.rotate(angle * i, y = True)
cmds.move(0.7,0.45,0, os = True)
pole = cmds.polyUnite(pole, pole1)
bar = cmds.polyPipe(name = "bar", h = 0.1, r = 0.65, t = 0.04)
cmds.move(0.65, y = True)
bar1 = cmds.duplicate(bar[0])
cmds.move(-0.2, y = True, r = True)
fence = cmds.polyUnite(pole, bar, bar1)
cmds.sets(fence[0], edit=True, forceElement="blackMetalGroup")
streetTree = cmds.polyUnite(tree,platform, fence)
cmds.delete(streetTree, ch = True)
return streetTree
开发者ID:hcbsundberg,项目名称:City_Generator,代码行数:32,代码来源:park.py
示例5: chipFacesTool
def chipFacesTool(self):
# cuts faces off of the poly and then seperates the faces to it's own polygon object, also ungroups them
selectedFaces = self.getSelection()
selectionParent = cmds.listRelatives(selectedFaces[0], p=True)
cmds.polyChipOff( selectedFaces, dup=True)
seperated = cmds.polySeparate(selectionParent[0])
allSeperated = [i for i in seperated if 'Separate' not in i]
if len(allSeperated) > 2:
cmds.polyUnite(allSeperated[1:])
new = self.getSelection()
else:
new = allSeperated[1]
old = []; old.append(allSeperated[0])
oldParent = cmds.listRelatives(old[0], p=True)
oldParentChildren = cmds.listRelatives(oldParent[0], c=True)
oldNodesToDelete = set(old) ^ set(oldParentChildren)
print oldNodesToDelete, ' this is old nodes to delete'
cmds.ungroup( oldParent )
cmds.delete(new, ch=1)
cmds.delete(old, ch=1)
cmds.rename(old, oldParent )
cmds.select(new)
self.assignRandomMaterial() # assigns random lambert to newly created poly
cmds.delete(selectedFaces)
cmds.select(old)
cmds.xform(centerPivots = True)
cmds.select(new) # reselect it after material assign
cmds.xform(centerPivots = True) # Center pivot of new article.
JR_rename_tool.UI('exit') # to rename the freshly branched poly
开发者ID:jricker,项目名称:JR_Maya,代码行数:29,代码来源:JR_tool_class.py
示例6: combine
def combine( self ):
cmds.duplicate( self.original_selected_objects, name="special_copy" )
self.selected_objects = cmds.ls( selection=True )
self.duplicate_name = self.original_selected_objects[0] + "_Combined_Copy"
cmds.polyUnite( self.selected_objects, name=self.duplicate_name )
cmds.delete( constructionHistory=True )
if( len(cmds.ls( "special_copy" )) == 1 ):
cmds.delete( self.selected_objects )
开发者ID:cwilmot,项目名称:maya-bulge-deformer-tool,代码行数:8,代码来源:MayaBulgeTool.py
示例7: getRevolveValues
def getRevolveValues():
# select all geometry, Unite and duplicate it
cmds.select(cmds.listRelatives(cmds.ls(geometry=True), p=True, path=True), r=True)
cmds.polyUnite(n='set')
cmds.duplicate('set')
lor = cmds.intSliderGrp(LevelsOfRevolution,q=True,v=True)
rot = cmds.floatSliderGrp(rotationDistance,q=True,v=True)
revolve(lor,rot)
开发者ID:njculpin,项目名称:maya_scripts,代码行数:8,代码来源:make_mandlebulb_shape.py
示例8: fnCreateFactor
def fnCreateFactor(lstChunkedUp, intFactor):
lstTranches = []
for intChunkNum in range(0, len(lstChunkedUp)):
strPolyName = cmds.polyCube(sx=1, sy=1,sz=1, cuv=0, w=fltSize, h=fltSize, d=fltSize, name='STVPolyBase')[0] #create the shape
strTrancheName = fnUniteMesh(lstChunkedUp[intChunkNum], intChunkNum, strPolyName)
lstTranches.append(strTrancheName)
strFactor = 'STVPoly_Factor_' + str(intFactor)
cmds.polyUnite(lstTranches, n=strFactor)
cmds.delete(strFactor, ch=True)
return(strFactor)
开发者ID:thefactmachine,项目名称:3D-Histogram-MayaAPI-Python-R,代码行数:10,代码来源:histMain.py
示例9: fnUniteMesh
def fnUniteMesh(lstChunk, intChunkNumber, strPName):
lstSelectedObjects = cmds.ls('STVPoly*')
lstTranche = []
for lstObj in lstChunk:
fltAdjTemp = fnTempScalar(float(lstObj[2]))
strInts = fnCreateCylinder(int(lstObj[1]), int(lstObj[0]), fltAdjTemp, str(lstObj[3]), strPName) #NEED to add function here for temp
lstTranche.append(strInts)
lstSelectedObjects = cmds.ls('STVPoly*')
if len(lstTranche) > 1:
strPolyMeshName = 'STVPolyMesh_Factor' + str(lstObj[3]) + '_Tranche_' + str(intChunkNumber)
cmds.polyUnite(lstTranche, n=strPolyMeshName)
cmds.delete(strPolyMeshName, ch=True)
cmds.delete(lstTranche)
return(strPolyMeshName)
开发者ID:thefactmachine,项目名称:3D-Histogram-MayaAPI-Python-R,代码行数:14,代码来源:histMain.py
示例10: os_mergeGroups
def os_mergeGroups():
sel = mc.ls(sl = True)
for each in sel:
c = mc.listRelatives(each,c = True, ad = True, type = 'transform')
geoArr = []
for child in c:
if '_geo' in child:
geoArr.append(child)
print each+' : '+str(len(geoArr)) + ' geos combined.'
if len(geoArr) == 1:
mc.parent(geoArr[0], w=True)
else:
mc.polyUnite (each, ch = 0, mergeUVSets = 1, centerPivot = True, name = each)
开发者ID:oscarsick,项目名称:mayaPython,代码行数:14,代码来源:modellingTools.py
示例11: __init__
def __init__(self, name_, height, width, depth, shader):
'''
Initializes a BoxHouse object, and creates a polygonal house object based on a
box primitive.
self: Object that is to be initialized.
name_: name_: A string with the name the polygonal house object will have.
height: The height of the house.
width: The width of the house.
depth: The depth of the house.
shader: Shader that will be assigned to the house.
On exit: A BoxHouse object has been initialized and a polygonal house has
been created out of a box primitive. A foundation for the house has
also been created and united with the box. The given shader has been
assigned to the house.
'''
House.__init__(self, name_, "box", height, width, depth)
n = cmds.polyCube(n = "house_", w = width, h = height, d = depth, sy = height)
cmds.xform(n[0], translation = (0, height/2.0, 0))
f = cmds.polyCube(n = "foundation", w = width + 0.3, h = 0.8, d = depth + 0.3)
cmds.xform(f[0], translation = (0,0.4,0))
n = cmds.polyUnite(n[0],f[0], n = name_)
self.name = n[0]
cmds.sets(n[0], edit=True, forceElement= shader[1])
cmds.delete(self.name, ch = True)
开发者ID:hcbsundberg,项目名称:City_Generator,代码行数:25,代码来源:cityGenerator.py
示例12: pointFaceMesh
def pointFaceMesh(pointList,scale=0.05,combine=True,prefix='pointFace'):
'''
'''
# Get encoded point list
ptList = []
for point in pointList:
ptList.append(glTools.utils.base.getPosition(point))
# Create face for each point
faceList = []
vscale = scale * 0.5
hscale = scale * 0.866
for pt in ptList:
face = mc.polyCreateFacet(p=[(pt[0],pt[1]+scale,pt[2]),(pt[0]+hscale,pt[1]-vscale,pt[2]),(pt[0]-hscale,pt[1]-vscale,pt[2])])[0]
face = mc.rename(face,prefix+'_mesh')
faceList.append(face)
# Define return list
mesh = faceList
# Combine faces to single mesh
if combine:
mesh = mc.polyUnite(faceList,ch=False)
mesh = [mc.rename(mesh[0],prefix+'_mesh')]
# Return result
return mesh
开发者ID:auqeyjf,项目名称:glTools,代码行数:27,代码来源:pointFaceMesh.py
示例13: combine
def combine():
"""
a cleaner combine
"""
selection = cmds.ls(sl=True, type='mesh', dag=True)
if not selection or selection < 2:
cmds.warning('Please select at least 2 meshes!')
# get full path
meshFull = cmds.listRelatives(selection[0], p=True, f=True)
# get parent
meshParent = cmds.listRelatives(meshFull, p=True, f=True)
meshInWorld = []
if meshParent:
meshParent0 = meshParent[0]
meshInWorld.append(cmds.parent(meshFull, world=True)[0])
else:
meshInWorld = meshFull
# replace 1st mesh in sel by mesh in world
selection[0] = meshInWorld[0]
# get pivots
pivots = cmds.xform(meshInWorld[0], q=True, ws=True, a=True, rotatePivot=True)
# combine & rename
newMesh = cmds.polyUnite(selection, o=True)
newMeshName = cmds.rename(newMesh[0], meshInWorld[0])
# set pivot
cmds.xform(newMeshName, rotatePivot=pivots)
# reparent
if meshParent:
newMeshName = cmds.parent(newMeshName, meshParent, a=True)
# delete history
cmds.delete(newMeshName, ch=True, hi='none')
开发者ID:shrimo,项目名称:dmptools,代码行数:33,代码来源:modeling.py
示例14: makeTree
def makeTree(shaders):
'''
Creates a tree.
shaders: A list of shaders for the tree crown.
On exit: A tree has been modeled, and is returned as a tuple
containing the object name and the node name. Some of the
variables are chosen randomly to create different results.
'''
height = random.uniform(0.3,1.5)
trunk = cmds.polyCylinder(name = "trunk", h = height, r = 0.07)
cmds.sets(trunk[0], edit=True, forceElement="trunkMaterialGroup")
cmds.xform(trunk, translation = (0,height/2.0 + 0.2,0))
crown = cmds.polySphere(name = "crown", r = 0.5)
cmds.xform(crown, translation = (0,height + 0.6,0))
cmds.softSelect(sse = True, ssd = 0.86)
cmds.select(crown[0] + ".vtx[381]")
translation = random.uniform(0.3,1.5)
cmds.move(translation, y = True, r = True)
cmds.softSelect(sse = False)
shader = random.choice(shaders)
scale_ = random.uniform(0.7,1.8)
cmds.select(crown)
cmds.scale(scale_, scale_, scale_, pivot = (0,height,0))
cmds.sets(crown[0], edit=True, forceElement= shader[1])
tree = cmds.polyUnite(trunk[0],crown[0])
cmds.delete(tree[0], ch = True)
return tree
开发者ID:hcbsundberg,项目名称:City_Generator,代码行数:28,代码来源:park.py
示例15: movePolysFromObj
def movePolysFromObj():
"""
# 1. Select faces
# 2. Shift-select targetObj
# 3. Run
"""
selFaces = mc.ls(os=1, fl=1)[:-1]
selFacesIds = [int(faceName.split("[")[1][:-1]) for faceName in selFaces]
# target object is the last selected item
targetObj = mc.ls(os=1, fl=1)[-1]
targetObjParent = mc.listRelatives(targetObj, p=1)[0]
# delete the parentConstraint if necessary
targetObjChildren = mc.listRelatives(targetObj, c=1, type="parentConstraint")
if not targetObjChildren == None:
mc.delete(targetObjChildren)
srcObj = selFaces[0].split(".")[0]
tempObj = mc.duplicate(srcObj, n="tempObj")[0]
mc.delete(selFaces)
facesToCopy = [faceName.replace(srcObj, tempObj) for faceName in selFaces]
mc.select(facesToCopy, r=1)
meval("InvertSelection;")
mc.delete()
combinedGeo = mc.polyUnite(tempObj, targetObj, ch=0, n="combinedGeo")[0]
mc.rename(combinedGeo, targetObj)
mc.parent(targetObj, targetObjParent)
mc.polyMergeVertex(targetObj, d=0.001, ch=0)
mc.delete(tempObj)
mc.select(srcObj, r=1)
开发者ID:sayehaye3d,项目名称:ls-rigging-tools,代码行数:33,代码来源:proxy.py
示例16: makeFountain
def makeFountain():
'''
Creates a fountain.
On exit: A fountain shaped polygonal object has been created, assigned a shader
and is returned as a tuple with the object name and node name. The
procedure uses random numbers in order to create different looking fountains
every time it is called.
'''
steps = random.randint(1,3)
fountain = cmds.polyCylinder(name = "Fountain", h = 0.1)
cmds.xform(fountain, translation = (0, 0.25, 0))
cmds.select(fountain[0] + ".f[40:59]")
for i in range(steps):
scale_ = random.uniform(0.6, 0.95)
cmds.polyExtrudeFacet(scale = (scale_, scale_, scale_))
translation = random.uniform(0.1, 0.6)
cmds.polyExtrudeFacet(translate = (0, translation, 0))
cmds.polyExtrudeFacet(scale = (0.9,0.9,0.9))
cmds.polyExtrudeFacet(translate = (0, -0.3,0))
scale_ = random.uniform(0.3,0.6)
cmds.polyExtrudeFacet(scale = (scale_,scale_,scale_))
translation = random.uniform(0.2,0.4)
cmds.polyExtrudeFacet(translate = (0,translation,0))
stepsUp = random.randint(1,3)
for i in range(stepsUp):
scale_ = random.uniform(0.4,0.9)
cmds.polyExtrudeFacet(scale = (scale_,scale_,scale_))
translation = random.uniform(0.05,1)
cmds.polyExtrudeFacet(translate = (0,translation,0))
top = fountainTop(fountain) # Create a top for the fountain.
fountain = cmds.polyUnite(top[0],fountain)
cmds.sets(fountain[0], edit=True, forceElement="fountainMaterialGroup")
return fountain
开发者ID:hcbsundberg,项目名称:City_Generator,代码行数:34,代码来源:park.py
示例17: roundPlate
def roundPlate():
#get values from UI
rgb = cmds.colorSliderGrp('brickColour', query=True, rgbValue=True)
transparent = cmds.checkBox('makeTransparent', query = True, value = True)
base = cmds.polyCylinder( h = 0.18, r = 0.3 )
cmds.rotate( 90, rotateY = True )
cmds.move( 0.18/2, moveY = True)
wide = cmds.polyCylinder( h = 0.14, r = 0.4 )
cmds.rotate( 90, rotateY = True )
cmds.move( 0.18 + (0.14/2), moveY = True)
stud = cmds.polyCylinder( h = 0.18, r = 0.24 )
cmds.rotate( 90, rotateY = True )
cmds.move( 0.18 + 0.14 + (0.18/2), moveY = True)
rp = cmds.polyUnite( base, wide, stud )
myShader = cmds.shadingNode( 'phong', asShader=True )
cmds.setAttr( myShader+".color", rgb[0], rgb[1], rgb[2], type='double3')
cmds.setAttr( myShader+".reflectivity", 0 )
if( transparent == True ):
cmds.setAttr( myShader+".transparency", 0.5, 0.5, 0.5, type = 'double3' )
cmds.select( rp )
cmds.hyperShade( assign = myShader )
cmds.delete( ch = True )
开发者ID:stephonatron,项目名称:LegoTechnicGenerator,代码行数:31,代码来源:LegoTechnicGenerator.py
示例18: combine
def combine(self, objs=[], new_name="", keepHistory=0):
'''
Combines the geometry and stores the names.
This is useful for speeding up the rigs and seperating in a predictible way.
@param objs: Mesh objects to combine
@type objs: list
@param new_name: New name for the combined mesh
@type new_name: str
@param keepHistory: Maintain history after function has completed
@type keepHistory: bool
'''
# Check input arguments
if not objs:
raise Exception('Input list "objs" is not a valid list!')
for obj in objs:
if not mc.objExists(obj):
raise Exception('Object '+obj+' does not exist!')
if mc.objExists(new_name):
raise Exception('An object of name '+new_name+' already exists! Please choose another name!')
# Combine multiple mesh objects to a single mesh
new_obj = mc.polyUnite(objs, n=new_name)
mc.addAttr( new_obj[0], ln='origNames', dt='string', multi=True)
# Recond original names list on new mesh transform
for i in range(len(objs)):
mc.setAttr( new_obj[0]+'.origNames['+str(i)+']', objs[i], type='string')
# Delete history
if not keepHistory : mc.delete(new_obj[1])
mc.delete(objs)
return new_obj[0]
开发者ID:auqeyjf,项目名称:glTools,代码行数:31,代码来源:meshCombine.py
示例19: fxCombine
def fxCombine(merge=False):
targets = m.ls(sl=True, l=True)
if not targets:
return
parent = m.listRelatives(targets[0], p=True, pa=True)
try:
combineResult = m.polyUnite(targets)
except RuntimeError:
m.error('Invalid selection for combine operation.')
return
if parent:
combineResult = m.parent(combineResult[0], parent[0])
m.delete(combineResult[0], ch=True)
for t in targets:
if m.objExists(t):
m.delete(t)
finalObject = m.rename(combineResult[0], getShortName(targets[0]))
m.select(finalObject)
if merge:
meval('performPolyMerge 0')
m.polyOptions(finalObject, displayBorder=True, sizeBorder=4)
m.select(finalObject)
开发者ID:Italic-,项目名称:maya-prefs,代码行数:30,代码来源:fx_combine.py
示例20: separateMeshsBySkinWeight2
def separateMeshsBySkinWeight2( meshObjs ):
import sgBFunction_connection
import sgBFunction_dag
meshObjs = sgBFunction_dag.getChildrenMeshExists( meshObjs )
meshs = []
for meshObj in meshObjs:
meshs += separateMeshBySkinWeight2( meshObj )
jntAndBindTargets = {}
appendedJnts = []
for sel in meshs:
mmdc = cmds.listConnections( sel, s=1, d=0 )[0]
bindObj = cmds.listConnections( mmdc, s=1, d=0 )[0]
bindObjP = cmds.listRelatives( bindObj, p=1, f=1 )[0]
if not bindObjP in appendedJnts:
appendedJnts.append( bindObjP )
jntAndBindTargets.update( {bindObjP:[]} )
jntAndBindTargets[ bindObjP ].append( sel )
for jnt, bindObjs in jntAndBindTargets.items():
if len( bindObjs ) == 1: continue
bindObj, polyUnite = cmds.polyUnite( bindObjs, n=bindObjs[0] )
bindObj = cmds.rename( bindObj, jnt.split( '|' )[-1]+'_mesh' )
sgBFunction_connection.bindConnect( bindObj, jnt )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:33,代码来源:sgBRig_character.py
注:本文中的maya.cmds.polyUnite函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论