反向Smoth工具
界面
反向Smoth(平滑) 工具来源于羊盒。进行了界面上面的优化和修改。支持Maya2022版本,相比Maya的减少功能还是这个比较好用。记录一下。
源码
直接在Maya的Python面板粘贴运行即可。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| import maya.cmds as cmds
def smoothReduce(): sel=cmds.ls(sl=True) if sel: pointNum=cmds.polyEvaluate(v=True) vertexId = sel[0]+'.vtx[{}]'.format(str(pointNum)) lastEdgeGroup=cmds.polyListComponentConversion(vertexId,fv=True,te=True)[0] cmds.select(lastEdgeGroup)
while 1: calcu = cmds.ls(sl=True) cmds.SelectEdgeLoopSp() edge = cmds.ls(sl=True,fl=True) edges = [int(ii.split('[')[1].split(']')[0]) for ii in edge] cmds.polySelect(er=edges,en=2) pp = cmds.ls(sl=True) if pp == calcu: break cmds.polyDelEdge( cv=True ) else: cmds.warning('not selected!')
if cmds.window("WSmooths", exists=True): cmds.deleteUI("WSmooths", window=True)
sizeX = 280
WSmooth = cmds.window( "WSmooths",title="三岁豆Er", iconName='Short Name', widthHeight=(sizeX, 150),mnb = True, mxb = False, sizeable = False ) cmds.columnLayout( columnAttach=('both', 10), rowSpacing=10, columnWidth=sizeX ) cmds.text(l='',h=20) cmds.text(fn="plainLabelFont",l='选择需要反向smooth的模型') cmds.text(fn="plainLabelFont",l='记得删历史') cmds.text(l='',h=5) cmds.button(l="反向Smooth",c="smoothReduce()",h=40,w=10 ) cmds.setParent( '..' ) cmds.showWindow( WSmooth )
|