split loop legacy
import maya.cmds as mc def splitLoop(): mc.ConvertSelectionToContainedEdges() mc.polySplitRing(sma = 180 , wt = 0.5) mc.polyDuplicateEdge(ch = True , of = loopDistance() ) def doubleLoop(): mc.ConvertSelectionToContainedEdges() mc.polySplitRing(sma = 180 , wt = 0.5) mc.polyDuplicateEdge(ch = True , of = loopDistance() ) mc.polyDelEdge(e = False, cv = True,) def splitLoopUI(): if mc.window('splitLoopUI' , exists = True): mc.deleteUI('splitLoopUI') mc.window('splitLoopUI' , wh = (200,100)) mc.rowColumnLayout( numberOfColumns=2 ) mc.frameLayout( label=' set loop distance') mc.floatSliderGrp('LoopDistanceValue' , minValue = 1.00 , maxValue = 99.00 , value = 50.00 , field = True ), mc.flowLayout() mc.text(' ') mc.button(label ='Triple Loop' , command = 'splitLoop()' ), mc.text(' ') mc.button(label ='Double Loop' , command = 'doubleLoop()' ), mc.columnLayout(), mc.flowLayout(), mc.showWindow('splitLoopUI') def loopDistance(): distance = mc.floatSliderGrp('LoopDistanceValue' , query = True, value = True) convertedDistance = distance / 100 return convertedDistance splitLoopUI()
split loop
import pymel.core as pm import pymel.core.runtime as run def splitLoopUI(*pArgs): pde=[] if pm.window('splitLoopUI' , exists = True): pm.deleteUI('splitLoopUI') def splitLoop(*pArgs): run.ConvertSelectionToContainedEdges() sp=pm.polySplitRing(sma = 180 , wt = 0.5) p=pm.polyDuplicateEdge(ch = True , of = loopDistance() ) pde.append(p[0]) pde.append(sp[0]) if pm.optionMenu ( typ , q = 1 , v = 1 ) == "Double Loop": pm.polyDelEdge(e = False, cv = True) def slide(*pArgs): off = pm.floatSliderGrp ( 'LoopDistanceValue' , q = 1 , v = 1 ) pde[-2].setAttr( 'offset' , off/100 ) def close(*pArgs): pm.deleteUI ( 'splitLoopUI' ) def und(*pArgs): pm.delete(pde) def new(*pArgs): close() splitLoopUI() pm.window('splitLoopUI' , wh = (200,300)) pm.rowColumnLayout ( 'splitLoopUI' , adj = 1 ) typ = pm.optionMenu ( w = 150 , l = " " ) pm.menuItem ( l = "Triple Loop" ) pm.menuItem ( l = "Double Loop" ) pm.frameLayout( label='set loop distance') pm.floatSliderGrp('LoopDistanceValue' , minValue = 1.00 , maxValue = 99.00 , value = 50.00 , field = True , s = 1.0 , dc = slide ) pm.button( l = 'Create' , c = splitLoop ) pm.button( l = 'Undo' , c = und ) pm.button( l = 'New' , c = new ) pm.button( l = 'Close' , c = close ) pm.showWindow('splitLoopUI') def loopDistance(): distance = pm.floatSliderGrp('LoopDistanceValue' , query = True, value = True) convertedDistance = distance / 100 return convertedDistance splitLoopUI()