本文整理汇总了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の削除など