本文整理匯總了Python中maya.cmds.polyListComponentConversion方法的典型用法代碼示例。如果您正苦於以下問題:Python cmds.polyListComponentConversion方法的具體用法?Python cmds.polyListComponentConversion怎麽用?Python cmds.polyListComponentConversion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類maya.cmds
的用法示例。
在下文中一共展示了cmds.polyListComponentConversion方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: conv_comp
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyListComponentConversion [as 別名]
def conv_comp(obj, mode=''):
if mode == 'edge':
comp = cmds.polyListComponentConversion(obj, te=True)
comp = cmds.filterExpand(comp, sm=32)
if mode == 'face':
comp = cmds.polyListComponentConversion(obj, tf=True)
comp = cmds.filterExpand(comp, sm=34)
if mode == 'vtx':
comp = cmds.polyListComponentConversion(obj, tv=True)
comp = cmds.filterExpand(comp, sm=31)
if mode == 'uv':
comp = cmds.polyListComponentConversion(obj, tuv=True)
comp = cmds.filterExpand(comp, sm=35)
if mode == 'vf':
comp = cmds.polyListComponentConversion(obj, tvf=True)
comp = cmds.filterExpand(comp, sm=70)
return comp
示例2: copy_uv
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyListComponentConversion [as 別名]
def copy_uv(self):
sel = cmds.ls(sl=True, l=True)
self.copy_uvs = cmds.polyListComponentConversion(sel, tuv=True)
self.copy_uvs = cmds.filterExpand(self.copy_uvs, sm=35)
if self.copy_uvs:
save_uv_data = {'copy_uv':self.copy_uvs }
with open(self.saveFile, 'w') as f:
json.dump(save_uv_data, f)
示例3: cehck_zero_poly_object
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyListComponentConversion [as 別名]
def cehck_zero_poly_object(mesh=None, pop_msg=True):
#mesh 入力メッシュ
#pop_msg 探索結果を表示するかどうか
if mesh == None:
polyMeshes = common.search_polygon_mesh(cmds.ls(tr=True))
else:
polyMeshes = common.search_polygon_mesh(mesh)
zeroPolyObj = []
if polyMeshes == None:
if pop_msg:
cmds.confirmDialog( title="Check",message='Zero Polygon Object Count : 0')
return zeroPolyObj
for p in polyMeshes:
vtx = cmds.polyListComponentConversion(p, tv=True)
if vtx == []:
zeroPolyObj.append(p)
if not pop_msg:
return zeroPolyObj
if zeroPolyObj == []:
cmds.confirmDialog( title="Check",message='Zero Polygon Object Count : 0')
else:
msg = 'Zero Polygon Object Count : '+str(len(zeroPolyObj))
for p in zeroPolyObj:
msg+='\n[ '+p+' ]'
cmds.confirmDialog( title="Check",message=msg )
cmds.select(zeroPolyObj, r=True)
return zeroPolyObj
#スキニングを保ったままメッシュマージする関數
示例4: conv_comp
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyListComponentConversion [as 別名]
def conv_comp(obj, mode=''):
if mode == 'edge':
comp = cmds.polyListComponentConversion(obj, te=True)
comp = cmds.filterExpand(comp, sm=32)
if mode == 'face':
comp = cmds.polyListComponentConversion(obj, tf=True)
comp = cmds.filterExpand(comp, sm=34)
if mode == 'vtx':
comp = cmds.polyListComponentConversion(obj, tv=True)
comp = cmds.filterExpand(comp, sm=31)
if mode == 'uv':
comp = cmds.polyListComponentConversion(obj, tuv=True)
comp = cmds.filterExpand(comp, sm=35)
return comp
示例5: cehck_zero_poly_object
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyListComponentConversion [as 別名]
def cehck_zero_poly_object(mesh=None, pop_msg=True):
#mesh 入力メッシュ
#pop_msg 探索結果を表示するかどうか
if mesh == None:
polyMeshes = common.search_polygon_mesh(cmds.ls(tr=True))
else:
polyMeshes = common.search_polygon_mesh(mesh)
zeroPolyObj = []
if polyMeshes == None:
if pop_msg:
cmds.confirmDialog( title="Check",message='Zero Polygon Object Count : 0')
return zeroPolyObj
for p in polyMeshes:
vtx = cmds.polyListComponentConversion(p, tv=True)
if vtx == []:
zeroPolyObj.append(p)
if not pop_msg:
return zeroPolyObj
if zeroPolyObj == []:
cmds.confirmDialog( title="Check",message='Zero Polygon Object Count : 0')
else:
msg = 'Zero Polygon Object Count : '+str(len(zeroPolyObj))
for p in zeroPolyObj:
msg+='\n[ '+p+' ]'
cmds.confirmDialog( title="Check",message=msg )
cmds.select(zeroPolyObj, r=True)
return zeroPolyObj
#スキニングを保ったままメッシュマージするクラス
示例6: paste_uv
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyListComponentConversion [as 別名]
def paste_uv(self, mode='component'):
if os.path.exists(self.saveFile):
with open(self.saveFile, 'r') as f:
save_uv_data = json.load(f)
self.copy_uvs = save_uv_data['copy_uv']
else:
return
sel = cmds.ls(sl=True, l=True)
self.paste_uvs = cmds.polyListComponentConversion(sel, tuv=True)
self.paste_uvs = cmds.filterExpand(self.paste_uvs, sm=35)
cmds.select(self.paste_uvs, r=True)
cmds.selectMode(o=True)
target_obj = [obj.split('.')[0] for obj in cmds.ls(sl=True, l=True)]
#print 'get target :', target_obj
freeze_m.main(mesh=target_obj)
if not self.paste_uvs:
return
paste_objects = list(set([uv.split('.')[0] for uv in self.paste_uvs]))
#cmds.bakePartialHistory(paste_objects, pre=True)
#print paste_objects
paste_uvs_dict = {obj:[] for obj in paste_objects}
#print paste_uvs_dict
for uv in map(lambda uv:uv.split('.'), self.paste_uvs):
paste_uvs_dict[uv[0]] += ['.'.join(uv)]
#print paste_uvs_dict
for paste_uvs in paste_uvs_dict.values():
#print paste_uvs
cmds.select(cl=True)
cmds.select(self.copy_uvs, r=True)
cmds.select(paste_uvs, add=True)
if mode == 'component':
sample_space = 4
if mode == 'world':
sample_space = 0
#print mode
cmds.transferAttributes(flipUVs=0, transferPositions=0, transferUVs=2, searchMethod=3,
transferNormals=0, transferColors=0, colorBorders=1, sampleSpace=sample_space)
freeze_m.main(mesh=target_obj)
cmds.select(target_obj, r=True)
#UVセットをリネーム、マルチUVの削除など