CTB shelf

customCTB

 

global proc shelf_customCTB () {
global string $gBuffStr;
global string $gBuffStr0;
global string $gBuffStr1;


shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "Delete construction history on the selected object(s)" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "History" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "DeleteHistory.png" 
-image1 "DeleteHistory.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "DeleteHistory" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "Select an object(s)" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "Center Pivot" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "CP" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "menuIconModify.png" 
-image1 "menuIconModify.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "CenterPivot" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "Select the deformed object(s) to delete all the history except deformers" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "Non-Deformer History" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "NH" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "menuIconEdit.png" 
-image1 "menuIconEdit.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "BakeNonDefHistory" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "Freeze Transformations" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "Freeze Transformations" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "FreezeTransform.png" 
-image1 "FreezeTransform.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "FreezeTransformations" 
-sourceType "mel" 
-doubleClickCommand "FreezeTransformationsOptions;" 
-commandRepeatable 1
-flat 1
-mi "Freeze Translate" ( "makeIdentity -apply true -t 1 -r 0 -s 0 -n 0 -pn 1;\n" )
-mi "Freeze Rotate" ( "makeIdentity -apply true -t 0 -r 1 -s 0 -n 0 -pn 1;" )
-mi "Freeze Scale" ( "makeIdentity -apply true -t 0 -r 0 -s 1 -n 0 -pn 1;" )
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 3
-flexibleWidthValue 32
-enable 1
-width 35
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "Toggle rotation pivot visibility" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "Rotate Pivots" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "RP" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "menuIconDisplay.png" 
-image1 "menuIconDisplay.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "ToggleRotationPivots" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 3
-flexibleWidthValue 32
-enable 1
-width 35
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "Select an object(s)" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "Reset Transformations" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "RT" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "menuIconModify.png" 
-image1 "menuIconModify.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "ResetTransformations" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
$gBuffStr = `toolButton -style iconOnly -doubleClickCommand "toolPropertyWindow" -cl toolCluster `;
$gBuffStr1 = ` curveCVCtx
-image1 "curveCV.png" 
-image2 "vacantCell.png" 
-image3 "vacantCell.png" 
-degree 1
-rational 0
-uniform 1
-bezier 0
-multEndKnots 1
`;
toolButton -edit -tool $gBuffStr1 -toolImage1 $gBuffStr1 "curveCV.png" $gBuffStr;
toolButton -edit -tool $gBuffStr1 $gBuffStr;

shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "curve 3D extrude" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "import maya.cmds as mc\nimport maya.mel as mel\n\n'''\ncreated by [w..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "C:/Users/Al One TR3/Documents/maya/2018/prefs/icons/curve3D.png" 
-image1 "C:/Users/Al One TR3/Documents/maya/2018/prefs/icons/curve3D.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import maya.cmds as mc\nimport maya.mel as mel\n\n'''\ncreated by [www.] maxloegler [.com] // not the repeatable-function\n'''\n\ndef repeatable(function):\n '''A decorator that will make commands repeatable in maya'''\n def decoratorCode(*args, **kwargs):\n functionReturn = None\n argString = ''\n if args:\n for each in args:\n argString += str(each)+', '\n \n if kwargs:\n for key, item in kwargs.items():\n argString += str(key)+'='+str(item)+', '\n\n commandToRepeat = 'python(\"'+function.__name__+'('+argString+')\")'\n \n functionReturn = function(*args, **kwargs)\n try:\n cmds.repeatLast(ac=commandToRepeat, acl=function.__name__)\n except:\n pass\n\n return functionReturn\n return decoratorCode\n\n@repeatable\t\ndef create():\n\tsoftS = 0\n\tif mc.softSelect(q=1, sse=1) == 1:\n\t\tmc.softSelect(e=1, sse=0)\n\t\tsoftS=1\n\tsetter = 0\n\tif mc.selectMode(q=1, co=1) == 1:\n\t\tif mc.selectMode(q=1, co=1) == 1 and mc.ls(sl=1,fl=1) != []:\n\t\t\tif mc.ls(sl=1, fl=1)[0].split('.')[1].split('[')[0] == 'cv':\n\t\t\t\tsetter = 1\n\t\t\telif mc.ls(sl=1, fl=1)[0].split('.')[1].split('[')[0] == 'vtx':\n\t\t\t\tsetter = 0\n\t\t\telse:\n\t\t\t\tsetter = 2\n\t\t\t\tmc.warning('Select an object/vertex.')\t\n\t\telse:\n\t\t\tsetter=2\n\t\t\tmc.warning('Select OGLU!')\t\t\t\n\tif setter == 0:\n\t\tselCurve = mc.curve(d=3, p=mc.xform(q=1,ws=1,t=1), name='tmp_CRV')\n\t\tmc.select(clear=1)\n\t\tmc.select(selCurve)\n\t\tmc.selectMode(co=1)\n\t\tmc.selectType(cv=1)\n\t\t\n\t\tmainGrp = mc.group(em=1, name='tmp_GRP')\n\t\tmc.parent(selCurve, mainGrp)\n\n\t\tmc.select(selCurve+'.cv['+str(mc.getAttr(selCurve +'.spans') +2)+']')\n\t\tmc.curve(selCurve, ws=1, a=1, p=mc.xform(q=1,ws=1,t=1))\n\t\t\n\n\t\tmc.addAttr(selCurve, ln='TUBE_CTRLS', at='enum', en='__________', k=True)\n\t\tmc.setAttr(selCurve + '.TUBE_CTRLS', lock=True)\n\t\tmc.addAttr(selCurve, ln='Radius', at='float', min=0, dv=1)\n\t\tmc.setAttr(selCurve+'.Radius',k=1)\n\t\tmc.addAttr(selCurve, ln='SubD_Length',nn='SubD Length', at='float', min=0, max=100, dv=1 )\n\t\tmc.setAttr(selCurve+'.SubD_Length',k=1)\n\t\tmc.addAttr(selCurve, ln='SubD_Axis',nn='SubD Axis', at='long', min=3, max=12, dv=8)\n\t\tmc.setAttr(selCurve+'.SubD_Axis',k=1)\n\t\tmc.addAttr(selCurve, ln='Twist',nn='Twist', at='float', min=0, max=1, dv=0)\n\t\tmc.setAttr(selCurve+'.Twist',k=1)\n\t\tmc.addAttr(selCurve, ln='Smoothing', at='float', min=0, max=10, dv=0)\n\t\tmc.setAttr(selCurve+'.Smoothing',k=1)\n\t\tmc.addAttr(selCurve, ln='Show_Tube',nn='Show_Tube', at='bool', dv=1)\n\t\tmc.setAttr(selCurve+'.Show_Tube',k=1)\n\n\n\t\tmc.select(selCurve+'.cv['+str(mc.getAttr(selCurve +'.spans') +2)+']')\n\t\tmc.rename(mainGrp,'tube_GRP_1')\n\t\tmc.rename(selCurve,'tube_CRV')\n\telif setter == 1:\n\t\tselCurve = mc.ls(sl=1, fl=1)[0].split('.')[0]\n\t\tselCV = mc.ls(sl=1, fl=1)[0]\n\t\tcvIndex = int(mc.ls(sl=1, fl=1)[0].split('[')[1].split(']')[0])\n\t\tamount = mc.getAttr(selCurve +'.spans') +2\n\t\t\n\t\tmc.select(clear=1)\n\t\tmc.select(selCurve+'.cv['+str(mc.getAttr(selCurve +'.spans') +2)+']')\n\t\tmc.curve(selCV,os=1, a=1, p=mc.xform(q=1,wd=1,t=1))\n\t\t\n\t\tif cvIndex == amount:\n\t\t\tmc.select(selCurve+'.cv['+str(mc.getAttr(selCurve +'.spans') +2)+']')\n\t\telse:\n\t\t\tfor i in range(amount-1, cvIndex-1, -1):\n\t\t\t\tmc.select(selCurve+'.cv['+str(i)+']')\n\t\t\t\ttmpPos = mc.xform(q=1,wd=1,t=1)\n\t\t\t\tmc.move(tmpPos[0], tmpPos[1], tmpPos[2], selCurve+'.cv['+str(i+1)+']', xyz=1)\n\t\t\t\tmc.select(selCurve+'.cv['+str(i+1)+']')\n\t\n\tif softS == 1:\n\t\tprint(mc.softSelect(e=1, sse=1))\n\ndef makeTube():\n\t\n\tif mc.ls(sl=1, fl=1) == []:\n\t\tmc.warning('Select a curve.')\n\telif mc.selectMode(q=1, co=1) == 1:\n\t\tmc.warning('Select a curve.')\n\telif mc.nodeType(mc.listRelatives(mc.ls(sl=1, fl=1), s=1)) != 'nurbsCurve':\n\t\tmc.warning('Select a curve.')\n\telse:\n\t\tselCurve = mc.ls(sl=1, fl=1)[0]\n\t\tmc.select(selCurve)\n\n\t\tmel.eval('AttachBrushToCurves;')\n\t\tmel.eval('doPaintEffectsToPoly( 1,0,1,1,100000);')\n\n\t\tstroke = mc.listConnections(mc.listRelatives(selCurve, s=1))\n\t\tstrokeShape = mc.listRelatives(stroke, s=1)[0]\n\t\tmesh = mc.listConnections(strokeShape)[2]\n\t\tbrush = mc.listConnections(strokeShape)[0]\n\t\tmeshGrp = mc.listRelatives(mesh, p=1)\n\n\t\tmc.connectAttr(selCurve+'.Radius', brush+'.globalScale', f=1)\n\t\tmc.connectAttr(selCurve+'.SubD_Axis', brush+'.tubeSections', f=1)\n\t\tmc.connectAttr(selCurve+'.SubD_Length', strokeShape+'.sampleDensity', f=1)\n\t\tmc.connectAttr(selCurve+'.Twist', brush+'.twist', f=1)\n\t\tmc.connectAttr(selCurve+'.Smoothing', strokeShape+'.smoothing', f=1)\n\t\tmc.connectAttr(selCurve+'.Show_Tube', mesh+'.visibility', f=1)\n\n\n\n\t\tmainGrp = mc.listRelatives(selCurve, p=1)[0]\n\t\tmc.parent(stroke, mesh, mainGrp)\n\t\tmc.rename(stroke, 'tube_PFX')\n\t\tmc.rename(mesh, 'tube_GEO')\n\n\t\tmc.delete(meshGrp)\n\t\tmc.select(selCurve)\n\n\n# create window\n\nwindow = mc.window(title='mx // CURVE_TUBE / V0.02',sizeable=0, height=90)\n\nbuttonBGC = (0.3,0.3,0.3) \nbuttonHEIGHT = 40 \n\nmxFormLayout = mc.formLayout()\n\n\nsetNLYT = mc.columnLayout( adjustableColumn=True, rowSpacing=0 ) \nsetfLYT = mc.formLayout()\n\nsnText = mc.text(label='Start curve blank or with object/VTX selected', font='obliqueLabelFont')\ncreateBTN = mc.button( label='CREATE (repeatable)', command='create()', bgc=(0.70,0.70,0.70) )\ntubeBTN = mc.button( label='TUBE', command='makeTube()', bgc=buttonBGC )\n\nmc.formLayout( setfLYT, e=True, af=((createBTN, 'top', 20), (createBTN, 'left', 0),\n (tubeBTN, 'top', 20), (tubeBTN, 'left', 0)),\n ac=((tubeBTN, 'left', 0, createBTN)),\n ap=((createBTN, 'right', 0, 70),\n (tubeBTN, 'right', 0, 100))\n )\nmc.setParent( '..' )\n\n\nmc.formLayout( mxFormLayout, e=True, af=((setNLYT, 'top', 20),(setNLYT, 'right', 10), (setNLYT, 'left', 10)\n )\n )\n\nmc.showWindow( window )\n\n" 
-sourceType "python" 
-doubleClickCommand "import maya.cmds as mc\nimport maya.mel as mel\n\n'''\ncreated by [www.] maxloegler [.com] // not the repeatable-function\n'''\n\ndef repeatable(function):\n '''A decorator that will make commands repeatable in maya'''\n def decoratorCode(*args, **kwargs):\n functionReturn = None\n argString = ''\n if args:\n for each in args:\n argString += str(each)+', '\n \n if kwargs:\n for key, item in kwargs.iteritems():\n argString += str(key)+'='+str(item)+', '\n\n commandToRepeat = 'python(\"'+function.__name__+'('+argString+')\")'\n \n functionReturn = function(*args, **kwargs)\n try:\n cmds.repeatLast(ac=commandToRepeat, acl=function.__name__)\n except:\n pass\n\n return functionReturn\n return decoratorCode\n\n@repeatable\t\ndef create():\n\tsoftS = 0\n\tif mc.softSelect(q=1, sse=1) == 1:\n\t\tmc.softSelect(e=1, sse=0)\n\t\tsoftS=1\n\tsetter = 0\n\tif mc.selectMode(q=1, co=1) == 1:\n\t\tif mc.selectMode(q=1, co=1) == 1 and mc.ls(sl=1,fl=1) != []:\n\t\t\tif mc.ls(sl=1, fl=1)[0].split('.')[1].split('[')[0] == 'cv':\n\t\t\t\tsetter = 1\n\t\t\telif mc.ls(sl=1, fl=1)[0].split('.')[1].split('[')[0] == 'vtx':\n\t\t\t\tsetter = 0\n\t\t\telse:\n\t\t\t\tsetter = 2\n\t\t\t\tmc.warning('Select an object/vertex.')\t\n\t\telse:\n\t\t\tsetter=2\n\t\t\tmc.warning('Select OGLU!')\t\t\t\n\tif setter == 0:\n\t\tselCurve = mc.curve(d=3, p=mc.xform(q=1,ws=1,t=1), name='tmp_CRV')\n\t\tmc.select(clear=1)\n\t\tmc.select(selCurve)\n\t\tmc.selectMode(co=1)\n\t\tmc.selectType(cv=1)\n\t\t\n\t\tmainGrp = mc.group(em=1, name='tmp_GRP')\n\t\tmc.parent(selCurve, mainGrp)\n\n\t\tmc.select(selCurve+'.cv['+str(mc.getAttr(selCurve +'.spans') +2)+']')\n\t\tmc.curve(selCurve, ws=1, a=1, p=mc.xform(q=1,ws=1,t=1))\n\t\t\n\n\t\tmc.addAttr(selCurve, ln='TUBE_CTRLS', at='enum', en='__________', k=True)\n\t\tmc.setAttr(selCurve + '.TUBE_CTRLS', lock=True)\n\t\tmc.addAttr(selCurve, ln='Radius', at='float', min=0, dv=1)\n\t\tmc.setAttr(selCurve+'.Radius',k=1)\n\t\tmc.addAttr(selCurve, ln='SubD_Length',nn='SubD Length', at='float', min=0, max=100, dv=1 )\n\t\tmc.setAttr(selCurve+'.SubD_Length',k=1)\n\t\tmc.addAttr(selCurve, ln='SubD_Axis',nn='SubD Axis', at='long', min=3, max=12, dv=8)\n\t\tmc.setAttr(selCurve+'.SubD_Axis',k=1)\n\t\tmc.addAttr(selCurve, ln='Twist',nn='Twist', at='float', min=0, max=1, dv=0)\n\t\tmc.setAttr(selCurve+'.Twist',k=1)\n\t\tmc.addAttr(selCurve, ln='Smoothing', at='float', min=0, max=10, dv=0)\n\t\tmc.setAttr(selCurve+'.Smoothing',k=1)\n\t\tmc.addAttr(selCurve, ln='Show_Tube',nn='Show_Tube', at='bool', dv=1)\n\t\tmc.setAttr(selCurve+'.Show_Tube',k=1)\n\n\n\t\tmc.select(selCurve+'.cv['+str(mc.getAttr(selCurve +'.spans') +2)+']')\n\t\tmc.rename(mainGrp,'tube_GRP_1')\n\t\tmc.rename(selCurve,'tube_CRV')\n\telif setter == 1:\n\t\tselCurve = mc.ls(sl=1, fl=1)[0].split('.')[0]\n\t\tselCV = mc.ls(sl=1, fl=1)[0]\n\t\tcvIndex = int(mc.ls(sl=1, fl=1)[0].split('[')[1].split(']')[0])\n\t\tamount = mc.getAttr(selCurve +'.spans') +2\n\t\t\n\t\tmc.select(clear=1)\n\t\tmc.select(selCurve+'.cv['+str(mc.getAttr(selCurve +'.spans') +2)+']')\n\t\tmc.curve(selCV,os=1, a=1, p=mc.xform(q=1,wd=1,t=1))\n\t\t\n\t\tif cvIndex == amount:\n\t\t\tmc.select(selCurve+'.cv['+str(mc.getAttr(selCurve +'.spans') +2)+']')\n\t\telse:\n\t\t\tfor i in range(amount-1, cvIndex-1, -1):\n\t\t\t\tmc.select(selCurve+'.cv['+str(i)+']')\n\t\t\t\ttmpPos = mc.xform(q=1,wd=1,t=1)\n\t\t\t\tmc.move(tmpPos[0], tmpPos[1], tmpPos[2], selCurve+'.cv['+str(i+1)+']', xyz=1)\n\t\t\t\tmc.select(selCurve+'.cv['+str(i+1)+']')\n\t\n\tif softS == 1:\n\t\tprint mc.softSelect(e=1, sse=1)\n\ndef makeTube():\n\t\n\tif mc.ls(sl=1, fl=1) == []:\n\t\tmc.warning('Select a curve.')\n\telif mc.selectMode(q=1, co=1) == 1:\n\t\tmc.warning('Select a curve.')\n\telif mc.nodeType(mc.listRelatives(mc.ls(sl=1, fl=1), s=1)) != 'nurbsCurve':\n\t\tmc.warning('Select a curve.')\n\telse:\n\t\tselCurve = mc.ls(sl=1, fl=1)[0]\n\t\tmc.select(selCurve)\n\n\t\tmel.eval('AttachBrushToCurves;')\n\t\tmel.eval('doPaintEffectsToPoly( 1,0,1,1,100000);')\n\n\t\tstroke = mc.listConnections(mc.listRelatives(selCurve, s=1))\n\t\tstrokeShape = mc.listRelatives(stroke, s=1)[0]\n\t\tmesh = mc.listConnections(strokeShape)[2]\n\t\tbrush = mc.listConnections(strokeShape)[0]\n\t\tmeshGrp = mc.listRelatives(mesh, p=1)\n\n\t\tmc.connectAttr(selCurve+'.Radius', brush+'.globalScale', f=1)\n\t\tmc.connectAttr(selCurve+'.SubD_Axis', brush+'.tubeSections', f=1)\n\t\tmc.connectAttr(selCurve+'.SubD_Length', strokeShape+'.sampleDensity', f=1)\n\t\tmc.connectAttr(selCurve+'.Twist', brush+'.twist', f=1)\n\t\tmc.connectAttr(selCurve+'.Smoothing', strokeShape+'.smoothing', f=1)\n\t\tmc.connectAttr(selCurve+'.Show_Tube', mesh+'.visibility', f=1)\n\n\n\n\t\tmainGrp = mc.listRelatives(selCurve, p=1)[0]\n\t\tmc.parent(stroke, mesh, mainGrp)\n\t\tmc.rename(stroke, 'tube_PFX')\n\t\tmc.rename(mesh, 'tube_GEO')\n\n\t\tmc.delete(meshGrp)\n\t\tmc.select(selCurve)\n\n\n# create window\n\nwindow = mc.window(title='mx // CURVE_TUBE / V0.02',sizeable=0, height=90)\n\nbuttonBGC = (0.3,0.3,0.3) \nbuttonHEIGHT = 40 \n\nmxFormLayout = mc.formLayout()\n\n\nsetNLYT = mc.columnLayout( adjustableColumn=True, rowSpacing=0 ) \nsetfLYT = mc.formLayout()\n\nsnText = mc.text(label='Start curve blank or with object/VTX selected', font='obliqueLabelFont')\ncreateBTN = mc.button( label='CREATE (repeatable)', command='create()', bgc=(0.70,0.70,0.70) )\ntubeBTN = mc.button( label='TUBE', command='makeTube()', bgc=buttonBGC )\n\nmc.formLayout( setfLYT, e=True, af=((createBTN, 'top', 20), (createBTN, 'left', 0),\n (tubeBTN, 'top', 20), (tubeBTN, 'left', 0)),\n ac=((tubeBTN, 'left', 0, createBTN)),\n ap=((createBTN, 'right', 0, 70),\n (tubeBTN, 'right', 0, 100))\n )\nmc.setParent( '..' )\n\n\nmc.formLayout( mxFormLayout, e=True, af=((setNLYT, 'top', 20),(setNLYT, 'right', 10), (setNLYT, 'left', 10)\n )\n )\n\nmc.showWindow( window )\n" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "dati 2 locator crea cavi penzoloni" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "#\tLunar Animation Ltd : Copyright 2015-2016 #\n#\tSelect two point..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "wireGen" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "pythonFamily.png" 
-image1 "pythonFamily.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "#\tLunar Animation Ltd : Copyright 2015-2016 #\n#\tSelect two points select and required amount of slack. Then hit 'Generate Wire' #\nimport maya.cmds as cmds\nimport random\n\ndef genCurve():\n \n list = cmds.ls(sl=True)\n \n print(list.__len__())\n \n if list.__len__() == 2:\n \n p1X = (cmds.getAttr(list[0]+\".translateX\"))\n p1Y = (cmds.getAttr(list[0]+\".translateY\"))\n p1Z = (cmds.getAttr(list[0]+\".translateZ\"))\n \n p2X = (cmds.getAttr(list[1]+\".translateX\"))\n p2Y = (cmds.getAttr(list[1]+\".translateY\"))\n p2Z = (cmds.getAttr(list[1]+\".translateZ\"))\n \n \n nCurve = cmds.curve( p=[(p1X, p1Y, p1Z),(p1X, p1Y, p1Z), (p2X, p2Y, p2Z), (p2X, p2Y, p2Z)] )\n \n cmds.rebuildCurve( rt=0, s=1 )\n \n cmds.select(nCurve+\".cv[1:2]\")\n \n global dropAmount\n\n global randomAmount\n\n amount = cmds.floatSliderGrp(dropAmount, q=True,value=True)\n \n rndAmount = cmds.floatSliderGrp(randomAmount, q=True,value=True)\n \n amount = (amount*-1.0)+((random.random()*rndAmount)*-1.0)\n \n cmds.move(0,amount,0,r=True,ls=True,wd=True)\n \n cmds.select(nCurve)\n \n cmds.rebuildCurve( rt=0, s=3 )\n \n cmds.select(list)\n else:\n print(\"Select two objects\")\n \n \ndef openCurveWindow():\n \n print(\"openCurveWindow\")\n\n curveWindow = 'curveWindow_'\n \n if cmds.window(curveWindow, exists=1):\n cmds.deleteUI( curveWindow , window=True ) \n \n cmds.window(curveWindow,title=\" Lunar Animation - Hanging Wire Generator Basic - v0.1\", menuBar=True)\n\n cmds.rowColumnLayout(numberOfColumns=1)\n \n cmds.separator(style='in' )\n \n global dropAmount\n\n dropAmount = cmds.floatSliderGrp( field=True, label='Slack Amount', minValue=0, maxValue=100, fieldMinValue=0, fieldMaxValue=2000, value=1 )\n\n global randomAmount\n\n randomAmount = cmds.floatSliderGrp( field=True, label='Random Slack', minValue=0, maxValue=100, fieldMinValue=0, fieldMaxValue=2000, value=1)\n \n cmds.separator(style='in' )\n\n createButton = cmds.button(label=\"Generate Wire\", c=\"genCurve()\")\n\n cmds.menu( label='Help ', helpMenu=True )\n \n cmds.menuItem( 'Application...\"', label=\"Select two points select and required amount of slack. Then hit 'Generate Wire'.\")\n \n cmds.menuItem( divider=True )\n\n cmds.menuItem( 'Application...\"', label='LunarAnimation.com', command='cmds.launch(web=\"http://www.lunaranimation.com\")' )\n\n cmds.separator(style='in' )\n\n cmds.showWindow()\n\n \nopenCurveWindow()" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 3
-flexibleWidthValue 32
-enable 1
-width 35
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "create spiral alonge curve" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "'''\nSpiral Along Curve version 1.5\nThis script can draw multiple..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "sipral" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "pythonFamily.png" 
-image1 "pythonFamily.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "'''\nSpiral Along Curve version 1.5\nThis script can draw multiple spiral curves along the curve you selected\nCopyright (C) 2014 James.N\n\nwritten by James.N\ntitle: spiral along curve\nfile: JR_Spiral_Along_Curve\nversion: 1.5\ncreate:\t 2014-10-13\tv1.0\nupdate: 2014-11-04\tv1.5\nmailbox: averst.nj@gmail.com\n'''\n\nimport pymel.core as pm\nimport pymel.util as util\nimport math as math\n\nclass spiralAlongCurve(object):\n\tdef __init__(self):\n\t\tself.curveCount = 1\n\t\tself.ratioStep = 1.0\n\t\tself.radius = 1.0\n\t\tself.radiusMap = None\n\t\tself.step = 0.05\n\t\tself.newCurveName = \"spiral\"\n\t\tself.grpName = \"spiral_grp\"\n\t\tself.__reference = None\n\t\tself.__targetGrp = None\n\n\t@property\n\tdef spine(self):\n\t\treturn self.__reference\n\t@spine.setter\n\tdef spine(self, value):\n\t\ttry:\n\t\t\tcurNode = pm.PyNode(value)\n\t\t\tif pm.nodeType(value) == 'transform':\n\t\t\t\tshape = curNode.getShape()\n\t\t\t\tif str(pm.nodeType(shape)) == 'nurbsCurve':\n\t\t\t\t\tself.__reference = shape\n\t\t\t\telse:\n\t\t\t\t\tprint \"this object is not a curve\"\n\t\t\telif str(pm.nodeType(value)) == 'nurbsCurve':\n\t\t\t\tself.__reference = curNode\n\t\t\telse:\n\t\t\t\tprint \"invalid node type\"\n\t\texcept pm.MayaObjectError:\n\t\t\tprint \"object doesn't exists\"\n\n\tdef curveGroup(self):\n\t\tif not pm.objExists(self.grpName):\n\t\t\tif len(self.grpName):\n\t\t\t\tself.__targetGrp = pm.group(name = self.grpName, empty = True, world = True)\n\t\t\telse:\n\t\t\t\tself.__targetGrp = None\n\t\telse:\n\t\t\tself.__targetGrp = pm.PyNode(self.grpName)\n\n\tdef drawSpiral(self, count = 0.0):\n\t\tminU = self.__reference.attr('min').get()\n\t\tmaxU = self.__reference.attr('max').get()\n\t\tangle = count\n\t\tparm = minU+0.00001\n\t\t#initial curve\n\t\tmyCurve = pm.curve(name = self.newCurveName, ws=True, p = [(0.0,0.0,0.0)], degree = 3)\n\t\tif self.__targetGrp != None and self.__targetGrp != \"\":\n\t\t\tpm.parent(myCurve, self.__targetGrp)\n\t\t#append curve\n\t\twhile parm <= maxU:\n\t\t\tpos = pm.pointOnCurve(self.__reference, pr = parm, position = True)\n\t\t\ttan = pm.pointOnCurve(self.__reference, pr = parm, normalizedTangent = True)\n\t\t\tlookup = util.linstep(minU, maxU, parm)\n\n\t\t\tradiusScale = (pm.gradientControlNoAttr(self.radiusMap, q=True, valueAtPoint=lookup)) if (self.radiusMap is not None) else 1.0\n\t\t\ttangent = pm.datatypes.Vector(tan)\n\t\t\tnormal = tangent.cross(pm.datatypes.Vector([0.0,-1.0,0.0]))\n\t\t\tdirection = normal.rotateBy(tangent,angle)\n\t\t\tdirection.normalize()\n\t\t\tnewPos = pm.datatypes.Vector(pos) + self.radius * radiusScale * direction\n\t\t\tpm.curve(myCurve, append = True, p = [(newPos.x, newPos.y, newPos.z)])\n\n\t\t\tparm += self.step\n\t\t\tangle += self.ratioStep\n\t\tpm.delete(myCurve.cv[0])\n\n\tdef drawSpiralSet(self):\n\t\t#caculate angle\n\t\tincre = (2*math.pi)/float(self.curveCount)\n\t\tself.curveGroup()\n\t\tfor i in range(self.curveCount):\n\t\t\tiniAngle = incre * i\n\t\t\tself.drawSpiral(count = iniAngle)\n\nclass splineGradientGrp():\n\tdef __init__(self, layout):\n\t\tpm.optionVar(clearArray = 'spiralRadiusFalloff')\n\t\tpm.optionVar(stringValueAppend=['spiralRadiusFalloff', '1,1,2'])\n\t\tpm.optionVar(stringValueAppend=['spiralRadiusFalloff', '1,0,2'])\n\n\t\tself.mainGradient = pm.gradientControlNoAttr(h=90, optionVar='spiralRadiusFalloff', parent = layout, dragCommand = pm.Callback(self.gradient_cmd), changeCommand = pm.Callback(self.gradient_cmd))\n\t\tself.posField = pm.floatFieldGrp(label = \"Key Position\", numberOfFields = 1, parent = layout, pre = 3, step = 0.1, cw = [1, 80], changeCommand = pm.Callback(self.field_cmd))\n\t\tself.valField = pm.floatFieldGrp(label = \"Key Value\", numberOfFields = 1, parent = layout, pre = 3, step = 0.1, cw = [1, 80], changeCommand = pm.Callback(self.field_cmd))\n\t\tself.interpMenu = pm.optionMenuGrp(label = \"Interpolation\", columnWidth=[1, 80], parent = layout, changeCommand = pm.Callback(self.field_cmd))\n\t\tpm.menuItem(label = \"Linear\")\n\t\tpm.menuItem(label = \"Smooth\")\n\t\tpm.menuItem(label = \"Spline\")\n\t\tpm.menuItem(label = \"None\")\n\t\tself.interpMenu.setSelect(3)\n\t\tself.gradient_cmd()\n\n\tdef field_cmd(self):\n\t\trampKey = self.mainGradient.getCurrentKey()\n\t\tpos = self.posField.getValue1()\n\t\tval = self.valField.getValue1()\n\t\tinterp = self.interpMenu.getSelect()\n\t\tgradientStr = self.mainGradient.getAsString()\n\n\t\topv = gradientStr.split(',')\n\t\topv[rampKey * 3] = str(val)\n\t\topv[rampKey * 3 + 1] = str(pos)\n\t\topv[rampKey * 3 + 2] = str(interp)\n\t\tnewOpv = \",\".join(opv)\n\n\t\tself.mainGradient.setAsString(newOpv)\n\n\tdef gradient_cmd(self):\n\t\trampKey = self.mainGradient.getCurrentKey()\n\t\tgradientStr = self.mainGradient.getAsString()\n\n\t\topv = gradientStr.split(',')\n\t\tself.valField.setValue1(float(opv[rampKey * 3]))\n\t\tself.posField.setValue1(float(opv[rampKey * 3 + 1]))\n\t\tself.interpMenu.setSelect(int(opv[rampKey * 3 + 2]))\n\nclass spiralAlongCurveUI():\n\tdef __init__(self):\n\t\t#ui list\n\t\tself.uiList = {}\n\t\t#window\n\t\tif pm.window('spiralMainWindow', ex=True): pm.deleteUI('spiralMainWindow')\n\n\t\tself.mainWindow = pm.window('spiralMainWindow', title = \"Spiral Along Curve\", width = 420, height = 450)\n\t\tself.mainWindow.setWidthHeight([420,450])\n\t\t#layout\n\t\tself.mainForm = pm.formLayout(numberOfDivisions=100)\n\t\t#widgits\n\t\tself.curveNameField = pm.textFieldGrp(label = \"Spiral Name\", text = \"spiral\", cw = [1, 80], adj = 2)\n\t\tself.uiList[\"nameField\"] = str(self.curveNameField)\n\t\tself.curveCountSli = pm.intSliderGrp(label = \"Spiral Count\", field = True, min = 1, fmn = 1, max = 10, fmx = 10000, step = 1, value = 1, cw = [1, 80])\n\t\tself.uiList[\"countSli\"] = str(self.curveCountSli)\n\t\tself.spiralRadiusSli = pm.floatSliderGrp(label = \"Radius\", field = True, min = 0.001, max = 4.0, fmx = 10000, step = 0.1, precision = 3, value = 1.0, cw = [1, 80])\n\t\tself.uiList[\"radiusSli\"] = str(self.spiralRadiusSli)\n\t\tself.spiralRadiusMap = splineGradientGrp(self.mainForm)\n\t\tself.spiralRadiusMap.mainGradient.setHeight(120)\n\t\tself.uiList[\"radiusMap\"] = str(self.spiralRadiusMap.mainGradient)\n\t\tself.uiList[\"radiusMapPosField\"] = str(self.spiralRadiusMap.posField)\n\t\tself.uiList[\"radiusMapValField\"] = str(self.spiralRadiusMap.valField)\n\t\tself.uiList[\"radiusMapInterp\"] = str(self.spiralRadiusMap.interpMenu)\n\t\tself.spiralStepSli = pm.floatSliderGrp(label = \"Step\", field = True, min = 0.001, max = 0.5, fmx = 10000, step = 0.01, precision = 3, value = 0.1, cw = [1, 80])\n\t\tself.uiList[\"stepSli\"] = str(self.spiralStepSli)\n\t\tself.spiralRatioSli = pm.floatSliderGrp(label = \"Ratio Step\", field = True, min = 0.001, max = 7.0, fmx = 10000, step = 0.01, precision = 3, value = 1.0, cw = [1, 80])\n\t\tself.uiList[\"ratioSli\"] = str(self.spiralRatioSli)\n\t\tself.grpNameField = pm.textFieldGrp(label = \"Group Name\", text = \"spiral_grp\", cw = [1, 80], adj = 2)\n\t\tself.uiList[\"groupField\"] = str(self.grpNameField)\n\t\tself.mainButton = pm.button(label = \"Create Spiral!\", height = 40, command = pm.Callback(self.createSpiralCommand))\n\t\tself.uiList[\"mainButton\"] = str(self.mainButton)\n\t\t#configure widgets\n\t\tself.mainForm.attachForm(self.uiList[\"nameField\"],'top',20)\n\t\tself.mainForm.attachForm(self.uiList[\"nameField\"],'left',10)\n\t\tself.mainForm.attachForm(self.uiList[\"nameField\"],'right',10)\n\t\tself.mainForm.attachForm(self.uiList[\"countSli\"],'left',10)\n\t\tself.mainForm.attachForm(self.uiList[\"countSli\"],'right',10)\n\t\tself.mainForm.attachControl(self.uiList[\"countSli\"],'top',8,self.uiList[\"nameField\"])\n\t\tself.mainForm.attachForm(self.uiList[\"radiusSli\"],'left',10)\n\t\tself.mainForm.attachForm(self.uiList[\"radiusSli\"],'right',10)\n\t\tself.mainForm.attachControl(self.uiList[\"radiusSli\"],'top',8,self.uiList[\"countSli\"])\n\t\tself.mainForm.attachForm(self.uiList[\"radiusMap\"], 'left', 10)\n\t\tself.mainForm.attachForm(self.uiList[\"radiusMap\"], 'right', 10)\n\t\tself.mainForm.attachControl(self.uiList[\"radiusMap\"],'top',8,self.uiList[\"radiusSli\"])\n\t\tself.mainForm.attachForm(self.uiList[\"radiusMapPosField\"], 'left', 20)\n\t\tself.mainForm.attachControl(self.uiList[\"radiusMapPosField\"], 'top', -5, self.uiList[\"radiusMap\"])\n\t\tself.mainForm.attachControl(self.uiList[\"radiusMapValField\"], 'left', 10, self.uiList[\"radiusMapPosField\"])\n\t\tself.mainForm.attachControl(self.uiList[\"radiusMapValField\"], 'top', -5, self.uiList[\"radiusMap\"])\n\t\tself.mainForm.attachForm(self.uiList[\"radiusMapInterp\"], 'left', 20)\n\t\tself.mainForm.attachControl(self.uiList[\"radiusMapInterp\"], 'top', 4, self.uiList[\"radiusMapValField\"])\n\t\tself.mainForm.attachForm(self.uiList[\"stepSli\"],'left',10)\n\t\tself.mainForm.attachForm(self.uiList[\"stepSli\"],'right',10)\n\t\tself.mainForm.attachControl(self.uiList[\"stepSli\"],'top',8,self.uiList[\"radiusMapInterp\"])\n\t\tself.mainForm.attachForm(self.uiList[\"ratioSli\"],'left',10)\n\t\tself.mainForm.attachForm(self.uiList[\"ratioSli\"],'right',10)\n\t\tself.mainForm.attachControl(self.uiList[\"ratioSli\"],'top',8,self.uiList[\"stepSli\"])\n\t\tself.mainForm.attachForm(self.uiList[\"groupField\"],'left',10)\n\t\tself.mainForm.attachForm(self.uiList[\"groupField\"],'right',10)\n\t\tself.mainForm.attachControl(self.uiList[\"groupField\"],'top',8,self.uiList[\"ratioSli\"])\n\t\tself.mainForm.attachForm(self.uiList[\"mainButton\"],'left',10)\n\t\tself.mainForm.attachForm(self.uiList[\"mainButton\"],'right',10)\n\t\tself.mainForm.attachControl(self.uiList[\"mainButton\"],'top',30,self.uiList[\"groupField\"])\n\t\t#show UI\n\t\tself.mainWindow.show()\n\n\tdef createSpiralCommand(self):\n\t\tnewSpiralCurves = spiralAlongCurve()\n\t\ttry:\n\t\t\tnewSpiralCurves.spine = pm.ls(sl = True)[0]\n\t\t\tnewSpiralCurves.newCurveName = self.curveNameField.getText()\n\t\t\tnewSpiralCurves.curveCount = self.curveCountSli.getValue()\n\t\t\tnewSpiralCurves.radius = self.spiralRadiusSli.getValue()\n\t\t\tnewSpiralCurves.radiusMap = self.spiralRadiusMap.mainGradient\n\t\t\tnewSpiralCurves.step = self.spiralStepSli.getValue()\n\t\t\tnewSpiralCurves.ratioStep = self.spiralRatioSli.getValue()\n\t\t\tnewSpiralCurves.grpName = self.grpNameField.getText()\n\t\t\tnewSpiralCurves.drawSpiralSet()\n\t\texcept IndexError:\n\t\t\tprint \"No curve Selected!\"\n\n\nspiralAlongCurveUI()" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 3
-flexibleWidthValue 32
-enable 1
-width 35
-height 34
-manage 1
-visible 1
-preventOverride 0
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "Rope.png" 
-image1 "Rope.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "from MayaDynamicRope_Tool import * \nMayaDynamicRope_Tool()" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "Display Texture Border Edges" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "Texture Border Edges" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "TBE" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "menuIconDisplay.png" 
-image1 "menuIconDisplay.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "ToggleTextureBorderEdges" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
$gBuffStr = `toolButton -style iconOnly -doubleClickCommand "toolPropertyWindow" -cl toolCluster `;
$gBuffStr0 = `superCtx `;
$gBuffStr1 = ` texSmoothContext
-image1 "vacantCell.png" 
-image2 "vacantCell.png" 
-image3 "vacantCell.png" 
-pinBorder 0
-space 1
`;
superCtx -edit -attach $gBuffStr1 $gBuffStr0;
$gBuffStr1 = $gBuffStr0;
toolButton -edit -tool $gBuffStr1 -toolImage1 $gBuffStr1 "texSmooth.png" $gBuffStr;
toolButton -edit -tool $gBuffStr1 $gBuffStr;

shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "Wedge the selected faces by extruding and rotating them about a selected edge" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "Wedge" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "polyWedgeFace.png" 
-image1 "polyWedgeFace.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "////////////////////////// Wedge Tool v1.1 /////////////////////////////////////////////\n// \n// script by : Klaudio Ladavac\n// contact: klaudio2u@gmail.com\n//\n// last update - 08.07.2017 \n////////////////////////////////////////////////////////////////////////////////////////\n\nglobal string $getit[];\nglobal string $extrNodeW[];\nglobal string $getFace[];\nglobal string $preGetObj[];\nglobal string $getWedge[];\nglobal string $rotationTransf[];\n\n\n // get the name of the object selected \n $preGetObj = `ls -hilite`; \n\n // store components selected from \"multi\" \n $getFace = `filterExpand -sm 34`;\n string $getEdge[] = `filterExpand -sm 32`;\n \n\n// Check number of edges selected - must be exactly 1, if not - warnning.\nif ( size ($getEdge) == 1) \n{\n \n // get material from selection \n select -r $getFace[0];\n hyperShade -smn;\n string $getMaterialAss[] = `ls -sl`;\n \n \n select -r $getEdge;\n \n //get the length (size) of the edge for the extrude to be appropriate length too\n ConvertSelectionToVertices;\n string $selVertices[] = `ls -sl -fl`;\n vector $a = `pointPosition -w $selVertices[0]`;\n vector $b = `pointPosition -w $selVertices[1]`;\n vector $mathVectors = $b - $a; \n float $lengthBetween = `mag $mathVectors`;\n float $lengthBetween2 = $lengthBetween * -1;\n \n\n // do extrude \n select $getEdge; \n $extrNodeW = `polyExtrudeEdge -constructionHistory 1 -keepFacesTogether 1 -divisions 2 -offset 0 -thickness $lengthBetween -smoothingAngle 30 -lty $lengthBetween2 $getEdge`;\n\n // extrude expression - connecting attributes \n $exp = ($extrNodeW[0] + \".localTranslateY = \" + $extrNodeW[0] + \".thickness * -1\");\n expression -s $exp -n \"expCusWedge\" -o $extrNodeW[0] -ae 1 -uc all;\n \n //value for toggle the expression\n optionVar -iv \"setFixToggle\" 1;\n\n string $getEdge2[] = `filterExpand -sm 32`;\n ConvertSelectionToFaces;\n string $getFace2[] = `filterExpand -sm 34`;\n \n string $selectgrow[] = `ls -sl -fl`; \n GrowPolygonSelectionRegion; \n select -d $selectgrow;\n \n doDelete;\n \n // rotation - add transfrom\n select -r $getFace2; \n $rotationTransf = `polyMoveFacet -constructionHistory 1 -random 0 $getFace2`;\n \n // selection ready for Wedge default\n select -r $getFace; \n select -add $getFace2; \n select -add $getEdge2;\n \n WedgePolygon;\n $getWedge = `ls -sl -tl 1`;\n setAttr ($getWedge[0] + \".wedgeAngle\") -90;\n setAttr ($getWedge[0] + \".divisions\") 6;\n \n select -r $preGetObj;\n \n SeparatePolygon;\n $getit = `ls -sl -tr`;\n pickWalk -d up;\n renameSelectionList (\"WedgeTool\"); \n \n // reassign material - can be lost sometimes \n select -r $getit;\n hyperShade -a $getMaterialAss[0];\n \n select -r $getit[1];\n hide;\n select -r $getit[0];\n //sets -e -forceElement initialShadingGroup;\n \n \n// START UI\n window -t \"Wedge Tool\" -tlb 1 customWedgeee;\n columnLayout -adj true;\n\n formLayout -h 115 -w 145 -numberOfDivisions 100 wedgeIt; \n attrControlGrp -l \"Angle \" -attribute ($getWedge[0] + \".wedgeAngle\") angleWdg;\n attrControlGrp -l \"Offset \" -attribute ($extrNodeW[0] + \".thickness\") thickWdg;\n iconTextButton -image1 \"k_FlipWedge.png\" -c \"flipWedge($extrNodeW, $getWedge)\" buttFlips;\n \n attrControlGrp -l \"Divisions \" -attribute ($getWedge[0] + \".divisions\") divWdg;\n attrFieldSliderGrp -l \"Rotate \" -min -90 -max 90 -cw3 50 81 0 -at ($rotationTransf[0] + \".localRotateZ\") rotMovekWdg; \n \n attrControlGrp -l \"Tweak \" -attribute ($extrNodeW[0] + \".localTranslateZ\") thicTwkWdg; \n formLayout -edit \n -attachForm angleWdg \"top\" 2 -attachForm angleWdg \"left\" -96 \n -attachForm thickWdg \"top\" 22 -attachForm thickWdg \"left\" -96 \n -attachForm divWdg \"top\" 47 -attachForm divWdg \"left\" -81\n -attachForm thicTwkWdg \"top\" 92 -attachForm thicTwkWdg \"left\" -81 \n -attachForm rotMovekWdg \"top\" 67 -attachForm rotMovekWdg \"left\" 8 \n \n -attachForm buttFlips \"top\" 3 -attachForm buttFlips \"left\" 119\n wedgeIt; \n setParent ..;\n \n // Angle\n popupMenu -parent angleWdg;\n menuItem -l \" 90\" -c \"angle90deg($getWedge)\";\n menuItem -l \" 180\" -c \"angle180deg($getWedge)\";\n menuItem -divider 1;\n menuItem -l \" -90\" -c \"angleM90deg($getWedge)\";\n menuItem -l \" -180\" -c \"angleM180deg($getWedge)\";\n popupMenu -parent thicTwkWdg;\n menuItem -l \" Reset Attribute\" -c \"localTransZ($extrNodeW)\";\n \n // Rotate\n popupMenu -parent rotMovekWdg;\n menuItem -l \" 0\" -c \"rotate0deg($rotationTransf)\";\n menuItem -divider 1;\n menuItem -l \" 45\" -c \"rotateP45deg($rotationTransf)\";\n menuItem -l \" 90\" -c \"rotateP90deg($rotationTransf)\";\n menuItem -divider 1;\n menuItem -l \" - 45\" -c \"rotateN45deg($rotationTransf)\"; \n menuItem -l \" - 90\" -c \"rotateN90deg($rotationTransf)\";\n\n\n \n\n separator -height 2 -style \"none\";\n\n formLayout -h 36 -w 145 -numberOfDivisions 100 wedgeIt2; \n iconTextButton -image1 \"k_fixWedge.png\" -c \"revFixExpress($extrNodeW, $getWedge)\" revWdg;\n iconTextButton -image1 \"k_applyWedge.png\" -c \"clearDoneWedge($getit, $getFace, $preGetObj)\" revWdg2;\n formLayout -edit \n -attachForm revWdg \"top\" 2 -attachForm revWdg \"left\" 2\n -attachForm revWdg2 \"top\" 2 -attachForm revWdg2 \"left\" 39\n wedgeIt2; \n\n showWindow customWedgeee;\n// END UI\n \n \n}\nelse \n{\n warning -n \" -- INFO -- Select only ONE edge for Wedge direction!!\"; \n}\n\n// Angle\nproc angle90deg(string $getWedge[]) { setAttr ($getWedge[0] + \".wedgeAngle\") 90; }\nproc angle180deg(string $getWedge[]) { setAttr ($getWedge[0] + \".wedgeAngle\") 180; }\nproc angleM90deg(string $getWedge[]) { setAttr ($getWedge[0] + \".wedgeAngle\") -90; }\nproc angleM180deg(string $getWedge[]) { setAttr ($getWedge[0] + \".wedgeAngle\") -180; }\n\n// Tweak\nproc localTransZ(string $extrNodeW[]) { setAttr ($extrNodeW[0] + \".localTranslateZ\") 0; }\n\n// Rotate\nproc rotate0deg(string $rotationTransf[]) { setAttr ($rotationTransf[0] + \".localRotateZ\") 0; }\nproc rotateP45deg(string $rotationTransf[]) { setAttr ($rotationTransf[0] + \".localRotateZ\") 45; }\nproc rotateP90deg(string $rotationTransf[]) { setAttr ($rotationTransf[0] + \".localRotateZ\") 90; }\nproc rotateN45deg(string $rotationTransf[]) { setAttr ($rotationTransf[0] + \".localRotateZ\") -45; }\nproc rotateN90deg(string $rotationTransf[]) { setAttr ($rotationTransf[0] + \".localRotateZ\") -90; }\n\n\nproc flipWedge(string $extrNodeW[], string $getWedge[])\n{\n // get Wedge angle Value\n float $getWedgeFlip = `getAttr ($getWedge[0] + \".wedgeAngle\")`;\n // reverse\n float $newWedgeFlip1 = $getWedgeFlip * -1;\n setAttr ($getWedge[0] + \".wedgeAngle\") $newWedgeFlip1; \n \n // get extrude Thickness value\n float $getOffsetFlip = `getAttr ($extrNodeW[0] + \".thickness\")`;\n // reverse \n float $getOffsetFlip2 = $getOffsetFlip * -1;\n setAttr ($extrNodeW[0] + \".thickness\") $getOffsetFlip2; \n \n}\n\n// FIX \nproc revFixExpress(string $extrNodeW[], string $getWedge[])\n{ \n int $chkToggleVal = `optionVar -q \"setFixToggle\"`;\n \n if ($chkToggleVal == 1)\n {\n $exp1 = ($extrNodeW[0] + \".localTranslateY = \" + $extrNodeW[0] + \".thickness * 1\");\n expression -e -s $exp1 -n \"expCusWedge\" -o $extrNodeW[0] -ae 1 -uc all expCusWedge;\n \n optionVar -iv \"setFixToggle\" 2;\n \n float $getWedgeVal = `getAttr ($getWedge[0] + \".wedgeAngle\")`;\n float $newWedgeVal = $getWedgeVal * -1;\n setAttr ($getWedge[0] + \".wedgeAngle\") $newWedgeVal;\n }\n \n if ($chkToggleVal == 2)\n {\n $exp2 = ($extrNodeW[0] + \".localTranslateY = \" + $extrNodeW[0] + \".thickness * -1\");\n expression -e -s $exp2 -n \"expCusWedge\" -o $extrNodeW[0] -ae 1 -uc all expCusWedge;\n \n optionVar -iv \"setFixToggle\" 1; \n \n\n }\n \n}\n\n// Apply\nproc clearDoneWedge(string $getit[], string $getFace[], string $preGetObj[])\n{\n // clear expressison node\n delete \"expCusWedge\";\n \n select -r $getit[0];\n string $getGroup[] = `pickWalk -d up`;\n \n select -r $getit[0];\n parent -w;\n DeleteHistory;\n \n select -r $getGroup;\n doDelete;\n \n select -r $getit[0];\n rename $getit[0] $preGetObj[0];\n //setSelectMode components Components; selectType -smp 0 -sme 0 -smf 1 -smu 0 -pv 0 -pe 0 -pf 1 -puv 0;\n doMenuComponentSelection($preGetObj[0], \"facet\");\n select -r $getFace;\n \n evalDeferred \"deleteUI -window customWedgeee\";\n \n}\n" 
-sourceType "mel" 
-doubleClickCommand "WedgePolygonOptions" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "select similar" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "//====================================================\n\n// Globa..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/k_selectSimilar_SHELF.png" 
-image1 "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/k_selectSimilar_SHELF.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "from kl_selectSimilar import kl_selectSimilar\nkl_selectSimilar()\n" 
-sourceType "python" 
-doubleClickCommand "from kl_selectSimilar import kl_selectSimilarTopo\nkl_selectSimilarTopo()" 
-commandRepeatable 1
-flat 1
-mi "Select Similar Topo" ( "print(\"User defined menuItem\");\n// Select similar based on topology\n\nstring $selectedObjs[] = `ls -sl -long -tr`;\n\n// Get all meshes (with transforms) in the scene\nstring $sceneMeshes[] = `ls -long -type \"mesh\"`;\nstring $meshTransforms[] = `listRelatives -p -fullPath -type \"transform\" $sceneMeshes`;\n\n string $saveSimilar;\n\n for ($eachS in $selectedObjs)\n {\n select $eachS;\n\n for ($i=0; $i < size($meshTransforms); $i++ ) \n {\n string $meshCheck = `polyCompare -fd -uv $eachS $meshTransforms[$i]`;\n if ($meshCheck == 0)\n {\n $saveSimilar += (\" \" + $meshTransforms[$i]);\n }\n }\n \n\n }\n \n\n// convert to Array\n$objToArray_sim = stringToStringArray($saveSimilar, \" \"); \nselect -r $objToArray_sim;\n\n// clear stored Objects\n$saveSimilar = \"\"; \n\n\n" )
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "create a curve cube" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "curve -d 1 -p -0.5 0.5 0.5 -p 0.5 0.5 0.5 -p 0.5 0.5 -0.5 -p -0...." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "cube" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/cubeCurves.png" 
-image1 "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/cubeCurves.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "curve -d 1 -p -0.5 0.5 0.5 -p 0.5 0.5 0.5 -p 0.5 0.5 -0.5 -p -0.5 0.5 -0.5 -p -0.5 0.5 0.5 -p -0.5 -0.5 0.5 -p -0.5 -0.5 -0.5 -p 0.5 -0.5 -0.5 -p 0.5 -0.5 0.5 -p -0.5 -0.5 0.5 -p 0.5 -0.5 0.5 -p 0.5 0.5 0.5 -p 0.5 0.5 -0.5 -p 0.5 -0.5 -0.5 -p -0.5 -0.5 -0.5 -p -0.5 0.5 -0.5 -n \"cube_control\";" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "double click to load the script, one click to execute it" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "perfCirc" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "perfCirc" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/perfCirc.png" 
-image1 "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/perfCirc.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "perfCirc" 
-sourceType "mel" 
-doubleClickCommand "/* This file downloaded from Highend3d.com\n'' \n'' Highend3d.com File Information:\n'' \n'' Script Name: tdArrangeCircle\n'' Author: thanasis_scifi \n'' Last Updated: Aug 29, 2007\n'' Update/Change this file at:\n'' http://Highend3d.com/maya/downloads/mel_scripts/polygon/1627.html\n'' \n'' Please do not alter any information above this line\n'' it is generated dynamically by Highend3d.com and will\n'' be changed automatically on any updates.\n*/\n\n\tglobal proc float findSize (string $spName , string $epName )\t\n\t\t{\t\n\t\t\t\t\t\n\t\t\tstring $epName;\n\t\t\tstring $spName;\n\t\t\t\n\t\t\tfloat $sp [] =` pointPosition -w $spName`;\n\t\t\tfloat $ep [] =` pointPosition -w $epName`;\t\t\t\t\t\n\t\n\t\t\tfloat $spX = $sp[0] - $ep[0];\n\t\t\tfloat $spY = $sp[1] - $ep[1];\n\t\t\tfloat $spZ = $sp[2] - $ep[2];\n\t\t\t\n\t\t\tfloat $measure = sqrt( $spX*$spX + $spY*$spY + $spZ*$spZ); \n\t\t\treturn $measure;\n\t\t\n\t\t\t\t\t\n\t\t}\n\n\n\tglobal proc moveP (string $ep , string $mp )\n\t\n\t\t{\n\t\t\tfloat $circP [] = \t`pointPosition -w $ep`; \n\t\t\t\t\t\t \n\t\t\tmove -ws ($circP[0] ) ($circP[1] ) ($circP[2] ) $mp ;\n\t\t}\n\t\t\t\t\nglobal proc perfCirc ()\t\t\n{\t\t\n\t\t\t\tstring $startPoint[] = `ls -sl`; \n\t\t\t\t\n\t\t\t\tif (`size ($startPoint)` != 1 )\n\t\t\t\terror \"One at a time dude! Select just one vertex\";\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tConvertSelectionToFaces $startPoint[0] ; \n\t\t\t\thilite ; \n\t\t\t\tselectType -ocm -alc false; \n\t\t\t\tselectType -ocm -polymeshFace true;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tfloat $pivot [] = `pointPosition -w $startPoint [0]`;\n\t\t\t\t\n\t\t\t\tpolyExtrudeFacet -kft on -pivot $pivot[0] $pivot[1] $pivot[2] -scale 0.9 0.9 0.9 ;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tConvertSelectionToVertices;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tShrinkPolygonSelectionRegion;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tstring $centerP [] = `ls -sl`;\n\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tGrowPolygonSelectionRegion;\n\t\t\t\t\n\t\n\t\t\t\t\n\t\t\t\tselect -d $centerP [0];\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tstring $points [] = `ls - sl -flatten`;\n\t\t\t\t\n\t\t\t\tint $number = `size($points)`;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\tfloat $circRadius = 1.0;\n\t\t\t\t\tfloat $minDist = 1000.00;\n\t\t\t\t\tfor ($each in $points)\n\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ( min (`findSize $each $centerP[0]` , $minDist ) == $minDist )\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\telse \n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$minDist = `findSize $each $centerP[0]`;\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$circRadius = 0.9 * $minDist;\n\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\n\t\t\t\t\t\t\t\tstring $polyShape [] = `listRelatives -p $startPoint[0]`; \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tstring $objName [] = `listRelatives -p $polyShape[0]`;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tstring $tempName [];\n\t\t\t\t\t\t\t\tstring $tempName2 [];\n\t\t\t\t\t\t\t\tint $vertexTemp = `tokenize $centerP[0] \"[\" $tempName `;\n\t\t\t\t\t\t\t\ttokenize $tempName[1] \"]\" $tempName2;\t\t\n\t\t\t\t\t\t\t\tstring $circName = \"circleFor\" + $objName[0] +$tempName2[0];\n\t\t\t\t\t\t\t\tstring $centerVtx = $centerP[0];\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\tvector $centerVtxPos = `pointPosition -w $centerVtx`;\n\n\t\t\t\t\t\t\t\tfloat $centerVtxPosX = $centerVtxPos.x;\n\t\t\t\t\t\t\t\tfloat $centerVtxPosY = $centerVtxPos.y;\n\t\t\t\t\t\t\t\tfloat $centerVtxPosZ = $centerVtxPos.z;\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\tfloat $vertNorm [] = `polyNormalPerVertex - q -normalXYZ $centerVtx` ;\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tcircle -c $centerVtxPosX $centerVtxPosY $centerVtxPosZ \n\t\t\t\t\t\t\t\t\t\t-nr $vertNorm[0] $vertNorm[1] $vertNorm[2] \n\t\t\t\t\t\t\t\t\t\t-sw 360 \n\t\t\t\t\t\t\t\t\t\t-r $circRadius\n\t\t\t\t\t\t\t\t\t\t-d 3 \n\t\t\t\t\t\t\t\t\t\t-ut 0 \n\t\t\t\t\t\t\t\t\t\t-tol 0.01 \n\t\t\t\t\t\t\t\t\t\t-s $number \n\t\t\t\t\t\t\t\t\t\t-ch 1 \n\t\t\t\t\t\t\t\t\t\t-name $circName; \n\t\t\t\t\n\n\t\t\t\t\t\t\t\txform -cp $circName;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tfor ($each in $points )\n\t\t\t\t\t\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tfloat $minSap = 1000.0; \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tint $koukou;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tfor ($i = 0 ; $i < $number ; $i ++ )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ( min (`findSize $each ($circName +\".ep[\"+$i+\"]\")` , $minSap ) == $minSap )\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\telse \n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$minSap = `findSize $each ($circName +\".ep[\"+$i+\"]\")`;\n\t\t\t\t\t\t\t\t\t\t$koukou = $i;\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tmoveP ($circName +\".ep[\"+$koukou+\"]\") $each;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ($number < 17 )\n\t\t\t\t{\n\t\t\t\t\t\tselect -r $centerP[0];\t\n\t\t\t\t\t\tConvertSelectionToFaces ; \t\t\n\t\t\t\t\t\thilite ; \n\t\t\t\t\n\t\t\t\t\t\tpolyTriangulate `ls -sl` ;\n\t\t\t\t}\t\t\n\t\t\t\t\t\t\n\t\t\t\t\tdelete $circName;\t\n\t\t\n}" 
-commandRepeatable 1
-flat 1
-mi "load perfect circle" ( "print(\"User defined menuItem\");\n/* This file downloaded from Highend3d.com\n'' \n'' Highend3d.com File Information:\n'' \n'' Script Name: tdArrangeCircle\n'' Author: thanasis_scifi \n'' Last Updated: Aug 29, 2007\n'' Update/Change this file at:\n'' http://Highend3d.com/maya/downloads/mel_scripts/polygon/1627.html\n'' \n'' Please do not alter any information above this line\n'' it is generated dynamically by Highend3d.com and will\n'' be changed automatically on any updates.\n*/\n\n\tglobal proc float findSize (string $spName , string $epName )\t\n\t\t{\t\n\t\t\t\t\t\n\t\t\tstring $epName;\n\t\t\tstring $spName;\n\t\t\t\n\t\t\tfloat $sp [] =` pointPosition -w $spName`;\n\t\t\tfloat $ep [] =` pointPosition -w $epName`;\t\t\t\t\t\n\t\n\t\t\tfloat $spX = $sp[0] - $ep[0];\n\t\t\tfloat $spY = $sp[1] - $ep[1];\n\t\t\tfloat $spZ = $sp[2] - $ep[2];\n\t\t\t\n\t\t\tfloat $measure = sqrt( $spX*$spX + $spY*$spY + $spZ*$spZ); \n\t\t\treturn $measure;\n\t\t\n\t\t\t\t\t\n\t\t}\n\n\n\tglobal proc moveP (string $ep , string $mp )\n\t\n\t\t{\n\t\t\tfloat $circP [] = \t`pointPosition -w $ep`; \n\t\t\t\t\t\t \n\t\t\tmove -ws ($circP[0] ) ($circP[1] ) ($circP[2] ) $mp ;\n\t\t}\n\t\t\t\t\nglobal proc perfCirc ()\t\t\n{\t\t\n\t\t\t\tstring $startPoint[] = `ls -sl`; \n\t\t\t\t\n\t\t\t\tif (`size ($startPoint)` != 1 )\n\t\t\t\terror \"One at a time dude! Select just one vertex\";\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tConvertSelectionToFaces $startPoint[0] ; \n\t\t\t\thilite ; \n\t\t\t\tselectType -ocm -alc false; \n\t\t\t\tselectType -ocm -polymeshFace true;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tfloat $pivot [] = `pointPosition -w $startPoint [0]`;\n\t\t\t\t\n\t\t\t\tpolyExtrudeFacet -kft on -pivot $pivot[0] $pivot[1] $pivot[2] -scale 0.9 0.9 0.9 ;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tConvertSelectionToVertices;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tShrinkPolygonSelectionRegion;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tstring $centerP [] = `ls -sl`;\n\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tGrowPolygonSelectionRegion;\n\t\t\t\t\n\t\n\t\t\t\t\n\t\t\t\tselect -d $centerP [0];\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tstring $points [] = `ls - sl -flatten`;\n\t\t\t\t\n\t\t\t\tint $number = `size($points)`;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\tfloat $circRadius = 1.0;\n\t\t\t\t\tfloat $minDist = 1000.00;\n\t\t\t\t\tfor ($each in $points)\n\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ( min (`findSize $each $centerP[0]` , $minDist ) == $minDist )\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\telse \n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$minDist = `findSize $each $centerP[0]`;\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$circRadius = 0.9 * $minDist;\n\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\n\t\t\t\t\t\t\t\tstring $polyShape [] = `listRelatives -p $startPoint[0]`; \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tstring $objName [] = `listRelatives -p $polyShape[0]`;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tstring $tempName [];\n\t\t\t\t\t\t\t\tstring $tempName2 [];\n\t\t\t\t\t\t\t\tint $vertexTemp = `tokenize $centerP[0] \"[\" $tempName `;\n\t\t\t\t\t\t\t\ttokenize $tempName[1] \"]\" $tempName2;\t\t\n\t\t\t\t\t\t\t\tstring $circName = \"circleFor\" + $objName[0] +$tempName2[0];\n\t\t\t\t\t\t\t\tstring $centerVtx = $centerP[0];\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\tvector $centerVtxPos = `pointPosition -w $centerVtx`;\n\n\t\t\t\t\t\t\t\tfloat $centerVtxPosX = $centerVtxPos.x;\n\t\t\t\t\t\t\t\tfloat $centerVtxPosY = $centerVtxPos.y;\n\t\t\t\t\t\t\t\tfloat $centerVtxPosZ = $centerVtxPos.z;\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\tfloat $vertNorm [] = `polyNormalPerVertex - q -normalXYZ $centerVtx` ;\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tcircle -c $centerVtxPosX $centerVtxPosY $centerVtxPosZ \n\t\t\t\t\t\t\t\t\t\t-nr $vertNorm[0] $vertNorm[1] $vertNorm[2] \n\t\t\t\t\t\t\t\t\t\t-sw 360 \n\t\t\t\t\t\t\t\t\t\t-r $circRadius\n\t\t\t\t\t\t\t\t\t\t-d 3 \n\t\t\t\t\t\t\t\t\t\t-ut 0 \n\t\t\t\t\t\t\t\t\t\t-tol 0.01 \n\t\t\t\t\t\t\t\t\t\t-s $number \n\t\t\t\t\t\t\t\t\t\t-ch 1 \n\t\t\t\t\t\t\t\t\t\t-name $circName; \n\t\t\t\t\n\n\t\t\t\t\t\t\t\txform -cp $circName;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tfor ($each in $points )\n\t\t\t\t\t\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tfloat $minSap = 1000.0; \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tint $koukou;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tfor ($i = 0 ; $i < $number ; $i ++ )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ( min (`findSize $each ($circName +\".ep[\"+$i+\"]\")` , $minSap ) == $minSap )\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\telse \n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$minSap = `findSize $each ($circName +\".ep[\"+$i+\"]\")`;\n\t\t\t\t\t\t\t\t\t\t$koukou = $i;\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tmoveP ($circName +\".ep[\"+$koukou+\"]\") $each;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ($number < 17 )\n\t\t\t\t{\n\t\t\t\t\t\tselect -r $centerP[0];\t\n\t\t\t\t\t\tConvertSelectionToFaces ; \t\t\n\t\t\t\t\t\thilite ; \n\t\t\t\t\n\t\t\t\t\t\tpolyTriangulate `ls -sl` ;\n\t\t\t\t}\t\t\n\t\t\t\t\t\t\n\t\t\t\t\tdelete $circName;\t\n\t\t\n}" )
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "create a regular polygon from a face" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "/* This file downloaded from Highend3d.com\n'' \n'' Highend3d.co..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/RegularPolygon.png" 
-image1 "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/RegularPolygon.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "/* This file downloaded from Highend3d.com\n'' \n'' Highend3d.com File Information:\n'' \n'' Script Name: Regular Polygon Generator\n'' Author: Viral \n'' Last Updated: Oct 16, 2007\n'' Update/Change this file at:\n'' http://Highend3d.com/maya/downloads/mel_scripts/modeling/poly_tools/1700.html\n'' \n'' Please do not alter any information above this line\n'' it is generated dynamically by Highend3d.com and will\n'' be changed automatically on any updates.\n*/\n//__________________________________________________________________________________________________________________\n//\n//\tTITLE: \t\tperfectPoly.mel version 1.\n//\tAUTHOR:\t\tViral Sindroja.\n//\tE-MAIL:\t\tLittlevizza@hotmail.com\n//\tDATE:\t\t\t16/10/2007.\n//\n//\n//\tDESCRIPTION:\tState how many sides you want. The script generates a regular polygon on the selected face.\n//\t\t\t\tIt only works for one face at a time, and it works for any polygonal surface.\n//\n//\tUSE:\t\t\tThis programme is great for creating mechnical bits to a mesh, like bolts, holes, round\n//\t\t\t\tsockets etc. \n//\n//\tERRORS:\t\tThere are no errors, but if something occurs email me about it. Please SAVE YOUR WORK REGULARLY.\n//\t\t\t\tYou will have to clean up the mesh after the procedure is finished. You may have to scale/rot the \n//\t\t\t\tface afterwards, due to the size and shape of the original face. The n-gon will be flush with \n//\t\t\t\toriginal face and you will hardly see it. If the n-gon is flipped up-side down, it is because\n//\t\t\t\tthe normal is the wrong way round. so you need to reverse it or extrude the face in a bit.\n//\t\t\t\tIf ever the error message \"Division by Zero\" occurs (which in all likelyhood it shouldn't) it is\n//\t\t\t\tbecause the first, second and very last vert of the face are in a perfect line. So just find them\n//\t\t\t\tand adjust them. Don't blame me, blame the cross product :) ...\n//\n//\tNOTE:\t\t\tFor best results stick to an even number for even sided faces, and an odd number for odd sided\n//\t\t\t\tfaces. I.e. if a face has 4 edges, then pick a number like 8, 14, 18, 20, etc. \n//_________________________________________________________________________________________________________________\n//\n//\tCopyright © 2007 Viral Sindroja\n//\tAll Rights Reserved.\n//\tFor educational purposes only.\n//\tPlease do not republish in electronic or print form without permission, thanks\n// \t - Viral Sindroja. \n//_________________________________________________________________________________________________________________\n\nglobal proc perfectPoly()\n{\n\n\tpolyExtrudeFacet -kft true -ls 0.5 0.5 0;\n\n\tstring $selected_face[] = `ls -sl -fl`;\n\t\n\n\tint $number_of_sides = `intSliderGrp -q -v perPoly`;\n\n\t//////////////\tPOLYMESH\t///////////////////////////////////////\n\tstring $polymesh[];\n\ttokenize $selected_face[0] \".[]\" $polymesh;\n\n\t\t\n\t////////////// ORDER EDGES\t///////////////////////////////////////\n\n\tstring $fte[] = `polyInfo -faceToEdge $selected_face[0]`;\n\n\tstring $order_edges[];\n\ttokenize $fte[0] \" :\\n\\r\" $order_edges;\n\tint $size_edgearray = `size $order_edges`;\n\t\n\tstring $edges[];\n\n\tfor($j=2;$j<$size_edgearray; ++$j)\n\t\t{\n\t\t\t$edges[$j-2] = $polymesh[0] + \".e[\" + $order_edges[$j] + \"]\";\n\t\t}\n\n\t\n\t////////////// ORDER VERTS\t///////////////////////////////////////\n\n\tstring $ftv[] = `polyInfo -faceToVertex $selected_face[0]`;\n\tstring $order_verts[];\n\t\n\ttokenize $ftv[0] \" :\\n\\r\" $order_verts;\n\tint $size = `size $order_verts`;\n\n\tstring $ordered_verts[];\n\tfor($i=2;$i<$size;++$i)\n\t\t{\n\t\t\t$ordered_verts[$i-2] = $polymesh[0] + \".vtx[\" + $order_verts[$i] + \"]\";\n\t\t}\n\n\t////////////// ARRAY CLEAR\t///////////////////////////////////////\n\n\tclear $fte;\n\tclear $order_edges;\n\tclear $ftv;\n\tclear $order_verts;\n\t\n\t////////////// NUMBER OF VERTS \t///////////////////////////////////////\n\t\n\tint $n = `size $ordered_verts`;\n\t\n\t////////////// SORT VERTS/EDGES\t///////////////////////////////////////\n\t\n\t////////////// SUBDIVIDE EDGES\t///////////////////////////////////////\n\n\tif($n<$number_of_sides)\n\t\t{\t\n\t\t\tint $remainder = $number_of_sides - $n;\n\t\t\tfloat $g = $remainder/$n;\n\t\t\tint $f = `trunc $g`;\n\t\t\tint $residue = $remainder - ($f*$n);\n\t\n\t\t\tselect -r $edges[0];\n\t\t\tpolySubdivideEdge -dv ($f +$residue);\n\t\n\t\t\tfor($k=1;$k<$n;++$k)\n\t\t\t{\n\t\t\t\tselect -r $edges[$k];\n\t\t\t\tpolySubdivideEdge -dv $f;\n\t\t\t}\n\t\t\tselect -r $selected_face[0];\n\t\t}\n\n\t//////////////\tMERGE VERTS\t///////////////////////////////////////\n\n\tif($n>$number_of_sides)\n\t{\n\t\t\tint $remainder = $n - $number_of_sides;\n\n\t\t\tif($remainder == 1)\n\t\t\t\t{\n\t\t\t\t\tselect -r $ordered_verts[0];\n\t\t\t\t\tselect -add $ordered_verts[1];\n\t\t\t\t\tpolyMergeVertex -d 10;\n\t\t\t\t}\n\n\t\t\tselect -cl;\n\n\t\t\tif($remainder>1)\n\t\t\t\t{\t\n\t\t\t\t\tfor($j=0;$j<$remainder;++$j)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tselect -add $ordered_verts[$j];\n\t\t\t\t\t\t}\n\t\t\t\t\tpolyMergeVertex -d 10;\n\t\t\t\t\tselect -cl;\n\t\t\t\t\tselect -r $ordered_verts[0];\n\t\t\t\t\tselect -add $ordered_verts[1];\n\t\t\t\t\tpolyMergeVertex -d 10;\n\t\t\t\t\n\t\t\t\t}\n\t}\n\tselect -r $selected_face[0];\n\t\t\n\t\n\t//////////////\tCLEAR ARRAYS\t///////////////////////////////////////\n\t\n\tclear $selected_face;\n\tclear $edges;\n\tclear $ordered_verts;\n\n//////////////////\tCONSTRUCT REGULAR POLYGON\t//////////////////////////////////////////////////////////\n\n\tstring $selected_newverts[] = `ls -sl -fl`;\n\t\n\n\t//Reselect all the verts\n\tstring $face_to_verts[] = `polyInfo -faceToVertex $selected_newverts[0]`;\n\tstring $order1[];\n\t \n\ttokenize $face_to_verts[0] \" :\\n\\r\" $order1;\n\tint $size = `size $order1`;\n\n\tstring $ordered_new_verts[];\n\tfor($i=2;$i<$size;++$i)\n\t\t{\n\t\t\t$ordered_new_verts[$i-2] = $polymesh[0] + \".vtx[\" + $order1[$i] + \"]\";\n\t\t}\n\tclear $face_to_verts;\n\tclear $order1;\n\t\n\tint $n_gon = `size $ordered_new_verts`;\n\n\t$theta = (2*3.14159265)/$n_gon;\n\t\n\tvector $vert1 = `pointPosition -w $ordered_new_verts[0]`;\n\tvector $vert2 = `pointPosition -w $ordered_new_verts[1]`;\n\tvector $vert3 = `pointPosition -w $ordered_new_verts[$n_gon-1]`;\n\n\tvector $a = $vert1 - $vert2;\n\tvector $b = $vert3 - $vert2;\n\n\tvector $cross_ab = cross($b,$a);\n\tfloat $mag_cross_ab = mag ($cross_ab);\n\t\n\tvector $normal = $cross_ab/$mag_cross_ab;\n\t\n\tvector $sum = <<0,0,0>>;\n\t\t\n\t\tfor($i=0;$i<$n_gon;++$i)\n\t\t\t{\n\t\t\t\tvector $vnow = `pointPosition -w $ordered_new_verts[$i]`;\n\t\t\t\t$sum = $sum + $vnow;\n\t\t\t}\n\t\n\tvector $centroid = $sum/$n_gon;\n\t\n\tvector $v1 = $vert1 - $centroid;\n\n\t\tfor($i=1;$i<$n_gon;++$i)\n\t\t\t{\n\t\t\t\tfloat $theta_new = $theta*$i;\n\t\t\t\tfloat $cos_tn = cos ($theta_new);\n\t\t\t\tfloat $sin_tn = sin ($theta_new);\n\n\t\t\t\tvector $cross_normV1 = cross($normal,$v1);\n\t\t\t\t\n\t\t\t\tvector $v_new = ($v1*$cos_tn) + ($cross_normV1*$sin_tn) + $centroid;\n\t\t\t\t\n\t\t\t\tselect -r $ordered_new_verts[$i];\n\t\t\t\tmove -a ($v_new.x) ($v_new.y) ($v_new.z);\n\t\n\t\t\t}\n\tselect -cl;\n\tselect -r $selected_newverts;\n\tclear $ordered_new_verts;\n\tclear $selected_newverts;\n\tclear $polymesh;\n\t\n}\n\n{\n\t\t\t\twindow -title \"Regular Polygon\" -wh 416 78 Regular_Polygon;\n\t\t\t\tcolumnLayout;\n\t\t\t\tintSliderGrp -label \"Number of Sides\" \n\t\t\t\t\t\t-fieldMinValue 3 -fieldMaxValue 200\n\t\t\t\t\t\t-minValue 3 -maxValue 200 -value 4 -field true perPoly;\n\n\t\t\t\tbutton -label \"Execute\" -c \"perfectPoly()\";\t\t\t\t\nshowWindow;\n}" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "spherize selection" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "spherize" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "spherize" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/spherizeSelection.png" 
-image1 "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/spherizeSelection.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import math as math\nfrom pymel.core import *\nclass sphereizedSelection():\n messages = [\"Please make sure you have selected something.\", \"Completed! \", \"Performing checks on selection... \"]\n def __init__(self, *args):\n if window(\"spherizeSelection\", exists=1): deleteUI(\"spherizeSelection\")\n window(\"spherizeSelection\", title=\"Spherize Selection - Shannon Hochkins\", w=405, sizeable=0) \n with columnLayout('content', adjustableColumn=True):\n with frameLayout( label='Settings', borderStyle='in'):\n with columnLayout(columnAttach=('both', 15), rs=15, cal='left', cw=395 ):\n text(l=\"Select any component(s) or poly object(s).\", h=30)\n checkBox('flatten',l='Attempt to flatten selection ', cc=self.enableRadio)\n separator( 'baseSep', height=5, style='in', en=0, vis=0)\n radioButtonGrp('flattenRadio', numberOfRadioButtons=3, adj=1, label='Normal Axis ', labelArray3=['X', 'Y', 'Z'], en=0, vis=0)\n radioButtonGrp('flattenRadio', e=1, sl=1, cw=[10,100], cal=((1, 'left')), h=50)\n with columnLayout(columnAttach=('both', 15), rs=15, cal='left', cw=405 ):\n separator( style='none')\n button(c=self.average, l='Average Selection', w=380, )\n button(l='Spherize', c=self.relay, height=50, w=380, backgroundColor=(.2, .2, .2))\n with rowColumnLayout(nc=2, cal=[(1,'right'), (2,'right')], cw=[(1,200),(2,170)]): \n text('displayInfo', l=self.messages[2],vis=0)\n progressBar('buildGridProgBar', maxValue=100, width=150,vis=0) \n showWindow(\"spherizeSelection\")\n def relay(self, *args): \n b = ls(os=1)\n select(cl=1)\n if (len(b) == 0):\n warning(self.messages[0])\n else:\n text('displayInfo',e=1,vis=1) \n refresh(f=1)\n for i in range(0,len(b),1): \n selectedType = listRelatives(b[i]) \n if (selectedType != []):\n type = PyNode(b[i]).getShape().type()\n if (type == 'mesh'): \n select(polyListComponentConversion(b[i],tv=1),add=1)\n if (type == 'nurbsCurve'): \n select(b[i],add=1)\n runtime.SelectCurveCVsAll(b[i]) \n self.spherize()\n else:\n select(b[i], add=1) \n if (len(selected(fl=1)) > 0 and selectedType == []):\n self.convertToVerts(selected())\n self.spherize() \n def spherize(self, *args):\n s = selected(fl=1)\n setToolTo('Move')\n s, avd, oda, cs = selected(fl=1), 0, [], manipMoveContext(\"Move\", q=1, p=1)\n select(cl=1)\n if (checkBox('flatten', q=1, v=1) == 1):\n select(s,r=1)\n self.flatten() \n for verts in range(0, len(s), 1):\n vts = s[verts].getPosition(space='world')\n dfc = math.sqrt(pow(vts[0] - cs[0],2) + pow(vts[1] - cs[1],2) + pow(vts[2] - cs[2],2))\n oda += [(dfc)]\n avd += dfc\n text('displayInfo',e=1,l='Calculating new positions on '+ listRelatives(listRelatives(s[verts],p=1)[0], p=1)[0] +'... ') \n progressBar('buildGridProgBar', edit=1, progress=int((float((verts + 1)) / float(len(s))) * 100),vis=1)\n avd /= len(s)\n for vert in range(0, len(s), 1):\n vts = s[vert].getPosition(space='world')\n x, y, z = (((avd / oda[vert]) * (vts[0] - cs[0])) + cs[0]), (((avd / oda[vert]) * (vts[1] - cs[1])) + cs[1]), (((avd / oda[vert]) * (vts[2] - cs[2])) + cs[2])\n s[vert].setPosition([x,y,z], space='world')\n text('displayInfo',e=1,l='Performing Witchcraft on '+ listRelatives(listRelatives(s[verts],p=1)[0], p=1)[0] +'... ')\n progressBar('buildGridProgBar', edit=1, progress=int((float((vert + 1)) / float(len(s))) * 100),vis=1)\n refresh() \n text('displayInfo',e=1,l=self.messages[1])\n select(cl=1)\n def flatten(self, *args):\n self.convertToVerts(selected())\n setToolTo('Scale')\n manipScaleContext(\"Scale\", e=1, mode=9)\n p, oa, r = manipScaleContext(\"Scale\", q=1, p=1), manipScaleContext(\"Scale\", q=1, oa=1), radioButtonGrp('flattenRadio',q=1,sl=1)\n scale((0,1,1) if r == 1 else (1,0,1) if r == 2 else (1,1,0), p=(p[0],p[1],p[2]), ls=1, oa=(\"%srad\"%oa[0],\"%srad\"%oa[1],\"%srad\"%oa[2]))\n text('displayInfo',e=1,l=self.messages[1])\n select(cl=1)\n def average(self, *args):\n if (len(selected(fl=1)) == 0):\n warning(self.messages[0])\n else:\n self.convertToVerts(selected())\n s = selected()\n polyAverageVertex(s, ch=1)\n def enableRadio(self, *args):\n if (checkBox('flatten',q=1,v=1) == 1):\n setToolTo('Scale')\n manipScaleContext(\"Scale\", e=1, mode=9)\n radioButtonGrp('flattenRadio', e=1,en=1,vis=1)\n separator('baseSep', e=1,vis=1)\n else:\n radioButtonGrp('flattenRadio', e=1,en=0,vis=0)\n separator('baseSep', e=1,vis=0)\n def convertToVerts(self, object):\n runtime.ConvertSelectionToVertices(object)\nsphereizedSelection()" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "show polygons only, double click to show all" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "polyOnly" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/polySolo.png" 
-image1 "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/polySolo.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import maya.cmds as mc\n\nmc.modelEditor(mc.getPanel(withFocus=True), allObjects = False, e = True)\n\nmc.modelEditor(mc.getPanel(withFocus=True), polymeshes = True, e = True)" 
-sourceType "python" 
-doubleClickCommand "import maya.cmds as mc\n\nmc.modelEditor(mc.getPanel(withFocus=True), allObjects = True, e = True)" 
-commandRepeatable 1
-flat 1
-mi "show all" ( "print(\"User defined menuItem\");\n\nimport maya.cmds as mc\n\nmc.modelEditor(mc.getPanel(withFocus=True), allObjects = True, e = True)" )
-mip 0
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "import maya.cmds as mc\n\nmc.modelEditor(mc.getPanel(withFocus=True), sel = False, e = True)" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "import maya.cmds as mc\n\nmc.modelEditor(mc.getPanel(withFocus=Tru..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "/Users/silvia/Library/Preferences/Autodesk/maya/2017/prefs/icons/Selection-Hilight.png" 
-image1 "/Users/silvia/Library/Preferences/Autodesk/maya/2017/prefs/icons/Selection-Hilight.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import maya.cmds as mc\n\n\n\nstate = mc.modelEditor(mc.getPanel(withFocus=True), q = 1 , sel = False)\n\nif state :\n\t\n\tmc.modelEditor(mc.getPanel(withFocus=True), e = 1 , sel = False)\nelse:\n\n\tmc.modelEditor(mc.getPanel(withFocus=True), e = 1 , sel = True)\n" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "import maya.cmds as mc\n\nmc.modelEditor(mc.getPanel(withFocus=True), activeComponentsXr ay=1)" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "import maya.cmds as mc\n\nmc.modelEditor(mc.getPanel(withFocus=Tru..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/xray.png" 
-image1 "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/xray.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import maya.cmds as mc\n\nmc.modelEditor(mc.getPanel(withFocus=True), xray=1, e=1)" 
-sourceType "python" 
-doubleClickCommand "import maya.cmds as mc\n\nmc.modelEditor(mc.getPanel(withFocus=True), xray=0 , e = True)" 
-commandRepeatable 1
-flat 1
-mi "xray OFF" ( "print(\"User defined menuItem\");\nimport maya.cmds as mc\n\nmc.modelEditor(mc.getPanel(withFocus=True), xray=0 , e = True)" )
-mip 0
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "displaySurface -xRay true;" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "displaySurface -xRay true;" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/xraySelected.png" 
-image1 "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/xraySelected.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "displaySurface -xRay true;" 
-sourceType "mel" 
-doubleClickCommand "displaySurface -xRay false;" 
-commandRepeatable 1
-flat 1
-mi "xray OFF" ( "print(\"User defined menuItem\");\ndisplaySurface -xRay false;" )
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "create a loop in the middle and edit flow" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "insert edge loop edit flow" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "//10.5.9.10/home/ARXANIMA/carlo.turrio/My Documents/maya/2014-x64/prefs/icons/flowLoop.png" 
-image1 "//10.5.9.10/home/ARXANIMA/carlo.turrio/My Documents/maya/2014-x64/prefs/icons/flowLoop.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "ConvertSelectionToContainedEdges;\npolySplitRing -ch on -splitType 2 -divisions 1 -useEqualMultiplier 1 -smoothingAngle 30 -fixQuads 1 ;\npolyEditEdgeFlow -constructionHistory 1 -adjustEdgeFlow 1;\n\n" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "import maya.cmds as mc\n\n\ndef splitLoop():\n mc.ConvertSelectionToContainedEdges()\n mc.polySplitRing(sma = 180 , wt = 0.5)\n mc.polyDuplicateEdge(ch = True , of = loopDistance() )\n\n\ndef doubleLoop():\n mc.ConvertSelectionToContainedEdges()\n mc.polySplitRing(sma = 180 , wt = 0.5)\n mc.polyDuplicateEdge(ch = True , of = loopDistance() )\n mc.polyDelEdge(e = False, cv = True,)\n\ndef splitLoopUI():\n \n if mc.window('splitLoopUI' , exists = True):\n mc.deleteUI('splitLoopUI')\n \n mc.window('splitLoopUI' , wh = (200,100)) \n mc.frameLayout( label=' set loop distance')\n mc.floatSliderGrp('LoopDistanceValue' , minValue = 1.00 , maxValue = 99.00 , value = 50.00 , field = True ),\n mc.flowLayout()\n mc.text(' ')\n mc.button(label ='Triple Loop' , command = 'splitLoop()'),\n mc.text(' ')\n mc.button(label ='Double Loop' , command = 'doubleLoop()'),\n \n mc.columnLayout(),\n \n mc.showWindow('splitLoopUI')\n \n\n\ndef loopDistance():\n distance = mc.floatSliderGrp('LoopDistanceValue' , query = True, value = True)\n convertedDistance = distance / 100\n return convertedDistance \n \n \nsplitLoopUI()" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "import maya.cmds as mc\n\n\ndef splitLoop():\n mc.ConvertSelectio..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/splitLoop.png" 
-image1 "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/splitLoop.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import pymel.core as pm\nimport pymel.core.runtime as run\n\ndef splitLoopUI(*pArgs):\n\n pde=[]\n\n if pm.window('splitLoopUI' , exists = True):\n pm.deleteUI('splitLoopUI')\n\n def splitLoop(*pArgs):\n\n run.ConvertSelectionToContainedEdges()\n sp=pm.polySplitRing(sma = 180 , wt = 0.5)\n p=pm.polyDuplicateEdge(ch = True , of = loopDistance() )\n pde.append(p[0])\n pde.append(sp[0])\n \n if pm.optionMenu ( typ , q = 1 , v = 1 ) == \"Double Loop\":\n \n pm.polyDelEdge(e = False, cv = True)\n \n def slide(*pArgs):\n\n off = pm.floatSliderGrp ( 'LoopDistanceValue' , q = 1 , v = 1 )\n pde[-2].setAttr( 'offset' , off/100 )\n\n def close(*pArgs):\n\n pm.deleteUI ( 'splitLoopUI' )\n\n def und(*pArgs):\n\n pm.delete(pde)\n\n def new(*pArgs):\n\n close()\n splitLoopUI()\n\n pm.window('splitLoopUI' , wh = (200,300))\n pm.rowColumnLayout ( 'splitLoopUI' , adj = 1 )\n typ = pm.optionMenu ( w = 150 , l = \" \" )\n pm.menuItem ( l = \"Triple Loop\" )\n pm.menuItem ( l = \"Double Loop\" )\n pm.frameLayout( label='set loop distance')\n pm.floatSliderGrp('LoopDistanceValue' , minValue = 1.00 , maxValue = 99.00 , value = 50.00 , field = True , s = 1.0 , dc = slide )\n pm.button( l = 'Create' , c = splitLoop )\n pm.button( l = 'Undo' , c = und ) \n pm.button( l = 'New' , c = new )\n pm.button( l = 'Close' , c = close )\n pm.showWindow('splitLoopUI')\n\ndef loopDistance():\n distance = pm.floatSliderGrp('LoopDistanceValue' , query = True, value = True)\n convertedDistance = distance / 100\n return convertedDistance\n\nsplitLoopUI()" 
-sourceType "python" 
-doubleClickCommand "import maya.cmds as mc\n\n\ndef splitLoop():\n mc.ConvertSelectionToContainedEdges()\n mc.polySplitRing(sma = 180 , wt = 0.5)\n mc.polyDuplicateEdge(ch = True , of = loopDistance() )\n\n\ndef doubleLoop():\n mc.ConvertSelectionToContainedEdges()\n mc.polySplitRing(sma = 180 , wt = 0.5)\n mc.polyDuplicateEdge(ch = True , of = loopDistance() )\n mc.polyDelEdge(e = False, cv = True,)\n\ndef splitLoopUI():\n \n if mc.window('splitLoopUI' , exists = True):\n mc.deleteUI('splitLoopUI')\n \n mc.window('splitLoopUI' , wh = (200,100)) \n mc.frameLayout( label=' \t\t\t\t set loop distance')\n mc.floatSliderGrp('LoopDistanceValue' , minValue = 1.00 , maxValue = 99.00 , value = 50.00 , field = True ),\n mc.flowLayout()\n mc.text(' ')\n mc.button(label ='Triple Loop' , command = 'splitLoop()'),\n mc.text(' ')\n mc.button(label ='Double Loop' , command = 'doubleLoop()'),\n \n mc.columnLayout(),\n \n mc.showWindow('splitLoopUI')\n \n\n\ndef loopDistance():\n distance = mc.floatSliderGrp('LoopDistanceValue' , query = True, value = True)\n convertedDistance = distance / 100\n return convertedDistance \n \n \nsplitLoopUI()" 
-commandRepeatable 1
-flat 1
-mi "splitLoop_legacy" ( "print(\"User defined menuItem\");\nimport maya.cmds as mc\n\n\ndef splitLoop():\n mc.ConvertSelectionToContainedEdges()\n mc.polySplitRing(sma = 180 , wt = 0.5)\n mc.polyDuplicateEdge(ch = True , of = loopDistance() )\n\n\ndef doubleLoop():\n mc.ConvertSelectionToContainedEdges()\n mc.polySplitRing(sma = 180 , wt = 0.5)\n mc.polyDuplicateEdge(ch = True , of = loopDistance() )\n mc.polyDelEdge(e = False, cv = True,)\n\ndef splitLoopUI():\n \n if mc.window('splitLoopUI' , exists = True):\n mc.deleteUI('splitLoopUI')\n \n mc.window('splitLoopUI' , wh = (200,100)) \n mc.frameLayout( label=' \t\t\t\t set loop distance')\n mc.floatSliderGrp('LoopDistanceValue' , minValue = 1.00 , maxValue = 99.00 , value = 50.00 , field = True ),\n mc.flowLayout()\n mc.text(' ')\n mc.button(label ='Triple Loop' , command = 'splitLoop()'),\n mc.text(' ')\n mc.button(label ='Double Loop' , command = 'doubleLoop()'),\n \n mc.columnLayout(),\n \n mc.showWindow('splitLoopUI')\n \n\n\ndef loopDistance():\n distance = mc.floatSliderGrp('LoopDistanceValue' , query = True, value = True)\n convertedDistance = distance / 100\n return convertedDistance \n \n \nsplitLoopUI()" )
-mip 0
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "Launch SmartMesh Tools Window" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "SmartMesh Tools v1.1.0" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.25 
-image "polyAssignSubdivHole.png" 
-image1 "polyAssignSubdivHole.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "source dpSmartMeshTools.mel; dpSmartMeshTools;" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "SimplePipe;" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "SPipe" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "SPipe" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.25 
-image "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/SimplePipe.png" 
-image1 "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/SimplePipe.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "SimplePipe;" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "rope rig" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "ak_rope;" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/RopeRig.png" 
-image1 "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/RopeRig.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "ak_rope;" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "import fx_growSelectionByEdgeAngle\nfx_growSelectionByEdgeAngle.run()" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "import fx_growSelectionByEdgeAngle\nfx_growSelectionByEdgeAngle.r..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.25 
-image "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/SelectByAngle.png" 
-image1 "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/SelectByAngle.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import fx_growSelectionByEdgeAngle\nfx_growSelectionByEdgeAngle.run()" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "remove pasted_ from name" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "## This script requires pymel\n\n## This script is a quick and sim..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/remove_pasted.png" 
-image1 "C:/Users/kui_user/Documents/maya/2014-x64/prefs/icons/remove_pasted.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "## This script requires pymel\n\n## This script is a quick and simple way to clean up a scene after\n## copy and pasting in Maya. It searches for objects with the name\n## starting with pasted__, ungroups them if they came in a group,\n## and renames them. Pymel automatically renames them uniquely if\n## needed.\n\n## Import pymel\nfrom pymel.core import *\n\n## Stores a list of all objects starting with pasted__\npastedObjects = ls('pasted__*')\n\n## For each thing in the list, store it as object\nfor object in pastedObjects:\n ## Get a list of it's direct parent\n rel = listRelatives(object, p=True)\n ## If that parent starts with group\n if 'group*' in rel:\n ## It came in root level and is pasted in a group, so ungroup it\n rel[0].ungroup()\n ## The new name is the objects name without pasted__\n newName = object.replace('pasted__', '')\n ## Rename the object with the new name\n rename(object, newName)" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "layerEditorLayerButtonVisibilityChange layer2;\nlayerEditorLayerButtonVisibilityChange layer1;\n" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "layerEditorLayerButtonVisibilityChange layer2;\nlayerEditorLayerB..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "layerswitch" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "C:/Users/carlo.turrio/Documents/maya/2014-x64/prefs/icons/layerswitch.png" 
-image1 "C:/Users/carlo.turrio/Documents/maya/2014-x64/prefs/icons/layerswitch.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "layerEditorLayerButtonVisibilityChange layer2;\nlayerEditorLayerButtonVisibilityChange layer1;\n" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "import pymel.core as pm\n\ndef createWin ( Title, apply ):\n\n winID = 'MyWin'\n\n def close ( *pArgs ):\n\n if pm.window ( winID, ex = 1 ) :\n\n pm.deleteUI ( winID )\n\n if pm.window ( winID, ex = 1 ):\n\n pm.deleteUI ( winID )\n\n def apply ( *pArgs):\n\n N = pm.intSliderGrp( n , q = 1 , v = 1 )\n mel.eval('polySelectEdgesEveryN (\"edgeRing\", %i)' %(N))\n close()\n\n pm.window ( winID , t = Title , sizeable = 0 , resizeToFitChildren = 1 )\n pm.rowColumnLayout ( p = winID , nc = 1 , cw = [ ( 1 , 150 ) ] , co = [ ( 1 , 'left' , 5 ) ] )\n n = pm.intSliderGrp ( min =1 , max = 100 , v = 1 , field = 1)\n\n pm.button ( l = ' Apply ' , c = apply )\n pm.button ( l = ' Close ' , c = close )\n pm.showWindow ( )\n\ncreateWin ( 'Ring' , apply )" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "import pymel.core as pm\n\ndef createWin ( Title, apply ):\n\n wi..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "loopN" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "pythonFamily.png" 
-image1 "pythonFamily.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import pymel.core as pm\n\ndef createWin ( Title, apply ):\n\n winID = 'MyWin'\n\n def close ( *pArgs ):\n\n if pm.window ( winID, ex = 1 ) :\n\n pm.deleteUI ( winID )\n\n if pm.window ( winID, ex = 1 ):\n\n pm.deleteUI ( winID )\n\n def apply ( *pArgs):\n\n N = pm.intSliderGrp( n , q = 1 , v = 1 )\n mel.eval('polySelectEdgesEveryN (\"edgeRing\", %i)' %(N))\n\n pm.window ( winID , t = Title , sizeable = 0 , resizeToFitChildren = 1 )\n pm.rowColumnLayout ( p = winID , nc = 1 , cw = [ ( 1 , 150 ) ] , co = [ ( 1 , 'left' , 5 ) ] )\n n = pm.intSliderGrp ( min =1 , max = 100 , v = 1 , field = 1)\n\n pm.button ( l = ' Apply ' , c = apply )\n pm.button ( l = ' Close ' , c = close )\n pm.showWindow ( )\n\ncreateWin ( 'Ring' , apply )" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "polySelectEdgesEveryN (\"edgeRing\", 2)" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "polySelectEdgesEveryN (\"edgeRing\", 2)" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "polySelectEdgesEveryN (\"edgeRing\", 2)" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "commandButton.png" 
-image1 "commandButton.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "polySelectEdgesEveryN (\"edgeRing\", 2)" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "FileTextureManager" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "FileTextureManager" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.2 
-image "C:/Users/carlo.turrio/Documents/maya/2014-x64/prefs/icons/filetexturemanager.png" 
-image1 "C:/Users/carlo.turrio/Documents/maya/2014-x64/prefs/icons/filetexturemanager.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "FilePathEditor;\n" 
-sourceType "mel" 
-doubleClickCommand "FileTextureManager" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "wp_rename()" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "wp_rename()" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "wpRename" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "commandButton.png" 
-image1 "commandButton.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "wp_rename()" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "import maya.cmds as cmds\nimport pymel.core as pm\n\n\nclass UI(object):\n def __init__(self):\n title = 'curvyEdges'\n version = '1.01'\n\n self.ceObj = spline(self)\n\n if pm.window('curvyEdgesWin', exists=True):\n pm.deleteUI('curvyEdgesWin')\n\n with pm.window('curvyEdgesWin', title='{0} | {1}'.format(title, version),\n mnb=False, mxb=False, sizeable=False) as window:\n with pm.columnLayout():\n\n # curve Frame\n with pm.frameLayout(l='Curve Settings', cll=True, cl=False, bs='out'):\n with pm.columnLayout():\n self.curveType = pm.radioButtonGrp(l='Curve Type:', sl=0, nrb=2, cw3=[96, 96, 128],\n labelArray2=['BezierCurve', 'NurbsCurve'])\n self.spans = pm.intSliderGrp(field=True, l='Curve Spans:', minValue=2, maxValue=24,\n fieldMinValue=2, fieldMaxValue=128, value=2, cw3=[96, 64, 128])\n with pm.rowColumnLayout(nc=2, cw=[1, 96], co=[1, 'right', 1]):\n self.selOnly = pm.checkBox(v=False, l='Selection Only')\n pm.button(l='Create Curve', c=self._create, width=201)\n\n # Deformer Frame\n with pm.frameLayout(l='Deformer Settings', bs='out', cl=False, cll=True):\n with pm.columnLayout():\n self.currentCrv = pm.textFieldGrp(editable=False, l='Current Curve:', cw2=[96, 195])\n\n self.deformers = [attrSlider(1, 0, 1, 'envelope', self.ceObj),\n attrSlider(1, -10, 10, 'tension', self.ceObj),\n attrSlider(0, 0, 256, 'dropoffDistance[0]', self.ceObj),\n attrSlider(1, 0, 2, 'scale[0]', self.ceObj),\n attrSlider(1, 0, 1, 'rotation', self.ceObj)]\n\n window.show()\n pm.scriptJob(event=['SelectionChanged', self.select], protected=True, p=window)\n self.select()\n\n def _create(self, *args):\n try:\n self.ceObj.create(self.curveType.getSelect(), self.spans.getValue(), self.selOnly.getValue())\n for i in self.deformers:\n i.setEnable(True)\n i.get()\n except:\n pass\n\n def select(self, *args):\n try:\n self.ceObj.select()\n for i in self.deformers:\n i.setEnable(True)\n i.get()\n except:\n self.setCurrentCurve('Select a curvyEdges curve!')\n for i in self.deformers:\n i.setEnable(False)\n\n def setCurrentCurve(self, curve):\n self.currentCrv.setText(curve)\n\n\nclass spline(object):\n def __init__(self, uiObj):\n self.uiObj = uiObj\n\n def create(self, curveType, spans, selOnly):\n sel = pm.selected()\n cmds.CreateCurveFromPoly()\n curve = pm.selected()\n pm.rebuildCurve(curve, spans=spans)\n # set UI curve\n self.uiObj.setCurrentCurve(curve[0].shortName())\n\n if curveType == 1:\n pm.nurbsCurveToBezier()\n pm.delete(curve, ch=True)\n\n # Deform\n if selOnly:\n sel = pm.polyListComponentConversion(sel, fe=True, tv=True)\n self.wire = pm.wire(sel, w=curve)\n else:\n #Object\n self.wire = pm.wire(sel[0].node(), w=curve)\n\n def select(self):\n sel = pm.selected()\n if isinstance(sel[0], pm.nt.Transform):\n if not isinstance(sel[0].getShape(), pm.nt.NurbsCurve):\n raise Exception('Invalid Selection Type')\n\n elif isinstance(sel[0], pm.NurbsCurveCV):\n sel = [i.node().getParent() for i in sel]\n\n else:\n raise Exception('Invalid Selection Type')\n\n self.wire = pm.listConnections(sel[0].getShape())\n self.uiObj.setCurrentCurve(sel[0].shortName())\n\n\nclass attrSlider(object):\n def __init__(self, value, min, max, name, ceObj):\n self.name = name\n self.ceObj = ceObj\n\n self.undoState = False\n self.attr = pm.floatSliderGrp(field=True, l=self.name, value=value, pre=3, enable=False,\n minValue=min, maxValue=max, dc=lambda *args: self.set(cc=False),\n cc=lambda *args: self.set(cc=True), cw3=[96, 64, 128])\n\n pm.scriptJob(event=['Undo', self.get], protected=True, p=self.attr)\n\n def get(self, *args):\n try:\n value = getattr(self.ceObj.wire[0], self.name).get(self.attr.getValue())\n self.attr.setValue(value)\n except:\n AttributeError('{0} node does not exist'.format(self.ceObj.wire[0]))\n\n def set(self, cc=False):\n if not cc and not self.undoState:\n self.undoState = True\n pm.undoInfo(openChunk=True)\n\n try:\n getattr(self.ceObj.wire[0], self.name).set(self.attr.getValue())\n except:\n AttributeError('{0} node does no longer exist'.format(self.ceObj.wire[0]))\n\n if cc and self.undoState:\n pm.undoInfo(closeChunk=True)\n self.undoState = False\n\n def setEnable(self, val):\n self.attr.setEnable(val)\n" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "import maya.cmds as cmds\nimport pymel.core as pm\n\n\nclass UI(obje..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "curvyEdges" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "pythonFamily.png" 
-image1 "pythonFamily.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import maya.cmds as cmds\nimport pymel.core as pm\n\n\nclass UI(object):\n def __init__(self):\n title = 'curvyEdges'\n version = '1.01'\n\n self.ceObj = spline(self)\n\n if pm.window('curvyEdgesWin', exists=True):\n pm.deleteUI('curvyEdgesWin')\n\n with pm.window('curvyEdgesWin', title='{0} | {1}'.format(title, version),\n mnb=False, mxb=False, sizeable=False) as window:\n with pm.columnLayout():\n\n # curve Frame\n with pm.frameLayout(l='Curve Settings', cll=True, cl=False, bs='out'):\n with pm.columnLayout():\n self.curveType = pm.radioButtonGrp(l='Curve Type:', sl=0, nrb=2, cw3=[96, 96, 128],\n labelArray2=['BezierCurve', 'NurbsCurve'])\n self.spans = pm.intSliderGrp(field=True, l='Curve Spans:', minValue=2, maxValue=24,\n fieldMinValue=2, fieldMaxValue=128, value=2, cw3=[96, 64, 128])\n with pm.rowColumnLayout(nc=2, cw=[1, 96], co=[1, 'right', 1]):\n self.selOnly = pm.checkBox(v=False, l='Selection Only')\n pm.button(l='Create Curve', c=self._create, width=201)\n\n # Deformer Frame\n with pm.frameLayout(l='Deformer Settings', bs='out', cl=False, cll=True):\n with pm.columnLayout():\n self.currentCrv = pm.textFieldGrp(editable=False, l='Current Curve:', cw2=[96, 195])\n\n self.deformers = [attrSlider(1, 0, 1, 'envelope', self.ceObj),\n attrSlider(1, -10, 10, 'tension', self.ceObj),\n attrSlider(0, 0, 256, 'dropoffDistance[0]', self.ceObj),\n attrSlider(1, 0, 2, 'scale[0]', self.ceObj),\n attrSlider(1, 0, 1, 'rotation', self.ceObj)]\n\n window.show()\n pm.scriptJob(event=['SelectionChanged', self.select], protected=True, p=window)\n self.select()\n\n def _create(self, *args):\n try:\n self.ceObj.create(self.curveType.getSelect(), self.spans.getValue(), self.selOnly.getValue())\n for i in self.deformers:\n i.setEnable(True)\n i.get()\n except:\n pass\n\n def select(self, *args):\n try:\n self.ceObj.select()\n for i in self.deformers:\n i.setEnable(True)\n i.get()\n except:\n self.setCurrentCurve('Select a curvyEdges curve!')\n for i in self.deformers:\n i.setEnable(False)\n\n def setCurrentCurve(self, curve):\n self.currentCrv.setText(curve)\n\n\nclass spline(object):\n def __init__(self, uiObj):\n self.uiObj = uiObj\n\n def create(self, curveType, spans, selOnly):\n sel = pm.selected()\n cmds.CreateCurveFromPoly()\n curve = pm.selected()\n pm.rebuildCurve(curve, spans=spans)\n # set UI curve\n self.uiObj.setCurrentCurve(curve[0].shortName())\n\n if curveType == 1:\n pm.nurbsCurveToBezier()\n pm.delete(curve, ch=True)\n\n # Deform\n if selOnly:\n sel = pm.polyListComponentConversion(sel, fe=True, tv=True)\n self.wire = pm.wire(sel, w=curve)\n else:\n #Object\n self.wire = pm.wire(sel[0].node(), w=curve)\n\n def select(self):\n sel = pm.selected()\n if isinstance(sel[0], pm.nt.Transform):\n if not isinstance(sel[0].getShape(), pm.nt.NurbsCurve):\n raise Exception('Invalid Selection Type')\n\n elif isinstance(sel[0], pm.NurbsCurveCV):\n sel = [i.node().getParent() for i in sel]\n\n else:\n raise Exception('Invalid Selection Type')\n\n self.wire = pm.listConnections(sel[0].getShape())\n self.uiObj.setCurrentCurve(sel[0].shortName())\n\n\nclass attrSlider(object):\n def __init__(self, value, min, max, name, ceObj):\n self.name = name\n self.ceObj = ceObj\n\n self.undoState = False\n self.attr = pm.floatSliderGrp(field=True, l=self.name, value=value, pre=3, enable=False,\n minValue=min, maxValue=max, dc=lambda *args: self.set(cc=False),\n cc=lambda *args: self.set(cc=True), cw3=[96, 64, 128])\n\n pm.scriptJob(event=['Undo', self.get], protected=True, p=self.attr)\n\n def get(self, *args):\n try:\n value = getattr(self.ceObj.wire[0], self.name).get(self.attr.getValue())\n self.attr.setValue(value)\n except:\n AttributeError('{0} node does not exist'.format(self.ceObj.wire[0]))\n\n def set(self, cc=False):\n if not cc and not self.undoState:\n self.undoState = True\n pm.undoInfo(openChunk=True)\n\n try:\n getattr(self.ceObj.wire[0], self.name).set(self.attr.getValue())\n except:\n AttributeError('{0} node does no longer exist'.format(self.ceObj.wire[0]))\n\n if cc and self.undoState:\n pm.undoInfo(closeChunk=True)\n self.undoState = False\n\n def setEnable(self, val):\n self.attr.setEnable(val)\n\nUI()\n" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "parent to surface" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "\"\"\"\nTHIS SCRIPT IS A PYTHON CONVERTED VERSION OF \"parentToSurfac..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "surfaceParent" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "pythonFamily.png" 
-image1 "pythonFamily.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "\"\"\"\nTHIS SCRIPT IS A PYTHON CONVERTED VERSION OF \"parentToSurface.mel\"\n\nIT CONNECTS SELECTED ITEMS TO A SELECTED SURFACE OR MESH BY FOLLICLE NODES \n\"\"\"\n\nimport maya.cmds as cmd\nimport maya.mel as mel\n\ndef __convertToCmFactor():\n\tunit=cmd.currentUnit(q=True, linear=True) \n\tif unit == \"mm\":\n\t\treturn(0.1)\n\telif unit == \"cm\":\n\t\treturn(1)\n\telif unit == \"m\":\n\t\treturn(100)\n\telif unit == \"in\":\n\t\treturn(2.54)\n\telif unit == \"ft\":\n\t\treturn(30.48)\n\telif unit == \"yd\":\n\t\treturn(91.44)\n\telse:\n\t\treturn(1.0)\n\t\t\ndef __attachObjectToSurface(obj, surface, u, v):\n\tfollicle=cmd.createNode (\"follicle\")\n\ttforms=mel.eval(\"listTransforms %s\" %(follicle))\n\tfollicleDag=tforms[0]\n\tcmd.connectAttr (surface + \".worldMatrix[0]\", follicle + \".inputWorldMatrix\")\n\tnType = cmd.nodeType (surface)\n\tif nType == \"nurbsSurface\":\t\n\t\tcmd.connectAttr (surface + \".local\", follicle + \".inputSurface\")\n\telse:\n\t\tcmd.connectAttr (surface + \".outMesh\", follicle + \".inputMesh\")\n\n\tcmd.connectAttr (follicle + \".outTranslate\", follicleDag + \".translate\")\n\tcmd.connectAttr (follicle + \".outRotate\", follicleDag + \".rotate\")\n\tcmd.setAttr (follicleDag + \".translate\", lock=True)\n\tcmd.setAttr (follicleDag + \".rotate\", lock=True)\n\tcmd.setAttr (follicle + \".parameterU\", u);\n\tcmd.setAttr (follicle + \".parameterV\", v);\n\tcmd.parent (obj, follicleDag)\n\t\ndef parentToSurface():\n\t'''\n\tSelect first items you want to attach to a surface or a mesh\n\tand then select the driver surface or mesh.\n\t'''\n\tshapes=[]\n\tsl = cmd.ls (sl=True)\n\tnumSel = len(sl)\n\tif numSel < 2:\n\t\tprint \"ParentToSurface: select object(s) to parent followed by a mesh or nurbsSurface to attach to.\"\n\t\treturn\n\tsurface = sl[numSel-1]\n\tif cmd.nodeType (surface) == \"transform\":\n\t\tshapes = cmd.ls (surface, dag=True, s=True, ni=True, v=True)\n\tif len(shapes)>0:\n\t\tsurface = shapes[0]\n\tnType = cmd.nodeType (surface)\n\tif nType != \"mesh\" and nType != \"nurbsSurface\":\n\t\tprint \"ParentToSurface: Last selected item must be a mesh or nurbsSurface.\"\n\t\treturn\n\n\tclPos = \"\"\n\tconvertFac = 1.0\n\n\tif nType == \"nurbsSurface\":\n\t\tclPos = cmd.createNode (\"closestPointOnSurface\")\n\t\tcmd.connectAttr (surface + \".worldSpace[0]\", clPos + \".inputSurface\")\n\t\tminU = cmd.getAttr (surface+\".mnu\")\n\t\tmaxU = cmd.getAttr (surface+\".mxu\")\n\t\tsizeU = maxU - minU\n\t\tminV = cmd.getAttr (surface+\".mnv\")\n\t\tmaxV = cmd.getAttr (surface+\".mxv\");\n\t\tsizeV = maxV - minV\n\telse:\n\t\tpomLoaded = cmd.pluginInfo (\"nearestPointOnMesh\", query=True, l=True)\n\t\tif pomLoaded == 0:\n\t\t\tcmd.loadPlugin (\"nearestPointOnMesh\")\n\t\t\tpomLoaded = cmd.pluginInfo (\"nearestPointOnMesh\", query=True, l=True)\n\t\t\tif pomLoaded == 0:\n\t\t\t\tprint \"ParentToSurface: Can't load nearestPointOnMesh plugin.\"\n\t\t\t\treturn\n\t\tconvertFac = __convertToCmFactor()\n\t\tclPos = cmd.createNode (\"nearestPointOnMesh\")\n\t\tcmd.connectAttr (surface + \".worldMesh\", clPos + \".inMesh\")\n\tfor i in range (0, numSel-1, 1):\n\t\tobj = sl[i]\n\t\tif cmd.nodeType(obj) != \"transform\":\n\t\t\tprint \"ParentToSurface: select the transform of the node(s) to constrain\\n\"\n\t\t\tpass\n\t\tbbox = cmd.xform (obj, q=True, ws=True, bb=True)\n\t\tpos=[]\n\t\tpos.append ((bbox[0] + bbox[3])*0.5)\n\t\tpos.append ((bbox[1] + bbox[4])*0.5)\n\t\tpos.append ((bbox[2] + bbox[5])*0.5)\n\t\t\n\t\tcmd.setAttr (clPos + \".inPosition\", pos[0]*convertFac, pos[1]*convertFac, pos[2]*convertFac, type=\"double3\")\n\t\tclosestU = cmd.getAttr (clPos + \".parameterU\")\n\t\tclosestV = cmd.getAttr (clPos + \".parameterV\")\n\t\tif nType == \"nurbsSurface\":\n\t\t\tclosestU = (closestU + minU)/sizeU\n\t\t\tclosestV = (closestV + minV)/sizeV\n\t\t__attachObjectToSurface (obj, surface, closestU, closestV)\n\n\tif clPos != \"\":\n\t\tcmd.delete (clPos)\nparentToSurface()" 
-sourceType "python" 
-doubleClickCommand "// parentToSurface\n// This mel command allows one to attach selected objects to a selected mesh or nurbs surface.\n// The objects will follow any deformation or transformation of the surface.\n// Usage: put this script in your local scripts directory. In Maya select object(s) to attach\n// followed by a mesh or nurbs surface to attach then enter \"parentToSurface\" in the\n// command line. A follicle node will be created at the point on surface closest to\n// the center of the object and the object will be parented to this follicle. Note that\n//\t if the surface to attach to is a mesh it must have well defined UVs that range from 0-1\n//\t with no areas sharing the same value.\n//\n// For convenience drag the parentToSurface string onto the shelf to make a shelf button.\n// \n// This command uses the follicle node, which is normally used by the hair system. The follicle node\n// is currently the only node in maya that can derive a rotate and translate based on a uv position\n// for both meshes and nurbs surfaces.\n//\n// One use of this script might be to attach buttons to a cloth object, or any deforming surface. To\n// attach several buttons, first position the buttons where desired then select them followed by the\n// object to attach to and run this command.\n// For more info or to report problems with this script go to Duncan's Corner:\n// http://area.autodesk.com/blogs/blog/7/\n\nproc float convertToCmFactor()\n{\n\tstring $unit = `currentUnit -q -linear`;\n\tif( $unit == \"mm\" ){\n\t\treturn( 0.1 );\n\t} else if( $unit == \"cm\" ){\n\t\treturn( 1.0 );\n\t} else if( $unit == \"m\" ){\n\t\treturn( 100.0 );\n\t} else if( $unit == \"in\" ){\n\t\treturn( 2.54 );\n\t} else if( $unit == \"ft\" ){\n\t\treturn( 30.48 );\n\t} else if( $unit == \"yd\" ){\n\t\treturn( 91.44 );\n\t} else {\n\t\treturn( 1.0 );\n\t}\n}\n\nproc attachObjectToSurface(string $obj, string $surface, float $u, float $v )\n{\n\tstring $follicle = `createNode follicle`;\n\tstring $tforms[] = `listTransforms $follicle`;\n\tstring $follicleDag = $tforms[0];\n\n\t\n\tconnectAttr ($surface + \".worldMatrix[0]\") ($follicle + \".inputWorldMatrix\");\n\tstring $nType = `nodeType $surface`;\n\tif( \"nurbsSurface\" == $nType ){ \n\t\tconnectAttr ($surface + \".local\") ($follicle + \".inputSurface\");\n\t} else {\n\t\tconnectAttr ($surface + \".outMesh\") ($follicle + \".inputMesh\");\n\t}\n\tconnectAttr ($follicle + \".outTranslate\") ($follicleDag + \".translate\");\n\tconnectAttr ($follicle + \".outRotate\") ($follicleDag + \".rotate\");\n\tsetAttr -lock true ($follicleDag + \".translate\");\n\tsetAttr -lock true ($follicleDag + \".rotate\");\n\tsetAttr ($follicle + \".parameterU\") $u;\n\tsetAttr ($follicle + \".parameterV\") $v;\n\t\n\t//parent -addObject -shape $obj $follicleDag;\n\tparent $obj $follicleDag;\n}\n\nglobal proc parentToSurface()\n{\n\tstring $sl[] = `ls -sl`;\n\tint $numSel =size($sl);\n\tif( $numSel < 2 ){\n\t\twarning( \"ParentToSurface: select object(s) to parent followed by a mesh or nurbsSurface to attach to.\");\n\t\treturn;\n\t}\n\tstring $surface = $sl[$numSel-1];\n\tif( nodeType($surface) == \"transform\" ){\n\t\tstring $shapes[] = `ls -dag -s -ni -v $surface`;\n\t\tif( size( $shapes ) > 0 ){\n\t\t\t$surface = $shapes[0];\n\t\t} \n\t}\n\tstring $nType = `nodeType $surface`;\n\tif( $nType != \"mesh\" && $nType != \"nurbsSurface\"){\n\t\twarning( \"ParentToSurface: Last selected item must be a mesh or nurbsSurface.\");\n\t\treturn;\n\t}\n\tstring $clPos = \"\";\n\tfloat $minU, $minV, $sizeU, $sizeV;\n\tfloat $convertFac = 1.0;\n\n\tif( $nType == \"nurbsSurface\" ){\n\t\t$clPos = `createNode closestPointOnSurface`;\t\n\t\tconnectAttr ($surface + \".worldSpace[0]\") ($clPos + \".inputSurface\");\n\n\t\t$minU = `getAttr ($surface+\".mnu\")`;\n\t\tfloat $maxU = `getAttr ($surface+\".mxu\")`;\n\t\t$sizeU = $maxU - $minU;\n\t\t$minV = `getAttr ($surface+\".mnv\")`;\n\t\tfloat $maxV = `getAttr ($surface+\".mxv\")`;\n\t\t$sizeV = $maxV - $minV;\n\t} else {\n\t\tint $pomLoaded = `pluginInfo -query -l nearestPointOnMesh`;\n\t\tif( !$pomLoaded ){\n\t\t\tloadPlugin nearestPointOnMesh;\n\t\t\t$pomLoaded = `pluginInfo -query -l nearestPointOnMesh`;\n\t\t\tif( !$pomLoaded ){\n\t\t\t\twarning( \"ParentToSurface: Can't load nearestPointOnMesh plugin.\");\n\t\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t// The following is to overcome a units bug in the nearestPointOnMesh plugin\n\t\t// If at some point it correctly handles units, then we need to take out the\n\t\t// following conversion factor.\t\n\t\t$convertFac = convertToCmFactor();\n\n\t\t$clPos = `createNode nearestPointOnMesh`;\n\t\tconnectAttr ($surface + \".worldMesh\") ($clPos + \".inMesh\");\n\t}\n\t\n\tint $i;\n\tfloat $closestU, $closestV;\n\tfor( $i = 0; $i < $numSel -1; $i++ ){\n\t\tstring $obj = $sl[$i];\n\t\tif( nodeType( $obj )!= \"transform\" ){\n\t\t\twarning( \"ParentToSurface: select the transform of the node(s) to constrain\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tfloat $bbox[] = `xform -q -ws -bb $obj`;\n\t\tfloat $pos[3];\n\t\t$pos[0] = ($bbox[0] + $bbox[3])*0.5;\n\t\t$pos[1] = ($bbox[1] + $bbox[4])*0.5;\n\t\t$pos[2] = ($bbox[2] + $bbox[5])*0.5;\n\t\tsetAttr ($clPos + \".inPosition\") -type double3 \n\t\t\t($pos[0]*$convertFac) \n\t\t\t($pos[1]*$convertFac)\n\t\t\t($pos[2]*$convertFac);\n\t\t$closestU = getAttr( $clPos + \".parameterU\");\n\t\t$closestV = getAttr( $clPos + \".parameterV\");\n\t\tif( $nType == \"nurbsSurface\" ){\n\t\t\t$closestU = ($closestU + $minU)/$sizeU;\n\t\t\t$closestV = ($closestV + $minV)/$sizeV;\n\t\t}\n\n\t\tattachObjectToSurface( $obj, $surface, $closestU, $closestV );\n\t}\n\n\n\tif( $clPos != \"\" ){\n\t\tdelete $clPos;\n\t}\n\n}" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "Reset Display" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "Reset Display" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "reset" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "commandButton.png" 
-image1 "commandButton.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "PolyDisplayReset" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "import UVTransfer as uvTrans\nMCuvTrans = uvTrans.MainClassUVTransfer()\nMCuvTrans.uvTransUI()" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "import UVTransfer as uvTrans\nMCuvTrans = uvTrans.MainClassUVTran..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "UVtrans" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "pythonFamily.png" 
-image1 "pythonFamily.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import UVTransfer as uvTrans\nMCuvTrans = uvTrans.MainClassUVTransfer()\nMCuvTrans.uvTransUI()" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "import SelectBadGeo as BG\nMCBG = BG.MainClassBadGeo()\nMCBG.badGeoUI()" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "import SelectBadGeo as BG\nMCBG = BG.MainClassBadGeo()\nMCBG.badGe..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/badGeo.png" 
-image1 "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/badGeo.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import SelectBadGeo as BG\nMCBG = BG.MainClassBadGeo()\nMCBG.badGeoUI()" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 3
-flexibleWidthValue 32
-enable 1
-width 35
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "source \"AMT Mesh Blend/MeshBlend.mel\"" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "source \"AMT Mesh Blend/MeshBlend.mel\"" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/blendMesh.png" 
-image1 "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/blendMesh.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "source \"AMT Mesh Blend/MeshBlend.mel\"" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "import maya.cmds as cmds\nimport maya.cmds as mc\nimport MASH.api ..." 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "import maya.cmds as cmds\nimport maya.cmds as mc\nimport MASH.api ..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "C:/Users/Al One TR3/Documents/maya/2018/prefs/icons/ModIt_Icon.png" 
-image1 "C:/Users/Al One TR3/Documents/maya/2018/prefs/icons/ModIt_Icon.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import maya.cmds as cmds\nimport maya.cmds as mc\nimport MASH.api as mapi\nimport maya.mel as mel\n\ndef createCustomWorkspaceControlModIt(*args):\n #UI_______________________________________\n\n mc.columnLayout(adj = True, w=250, h=305)\n \n #_________________SUPP ERROR MESSAGE\n mc.warning()\n print '',\n\n #__________________________________________________________________PRIMITIVES\n #________________\n cH1 = mc.columnLayout(adj =True)\n frameEdit = mc.frameLayout(l = \" PRIMITIVES\", cll =1, cl =0, bgc= [0.15, 0.15, 0.15])\n mc.rowColumnLayout ( numberOfColumns=5, columnWidth=[ (1,50), (2,50), (3,50), (4,50), (5,50) ], columnAlign=[ (1, 'center'), (2, 'center'), (3, 'center'), (4, 'center'), (5, 'center') ] )\n\n imageSphere = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Sphere.png\"\n imageCube = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Cube.png\"\n imageCylindre = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Cylindre.png\"\n imagePlane = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Plane.png\"\n imageDisc = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Disc.png\"\n\n\n PShpere = mc.symbolButton( image= imageSphere, c= \"PSphere16()\", ann= \"Create Sphere\")\n mc.popupMenu()\n mc.menuItem(l= 'Sphere sbdv 8', c= 'PSphere8()')\n mc.menuItem(l= 'Sphere sbdv 10', c= 'PSphere10()')\n mc.menuItem(l= 'Sphere sbdv 12', c= 'PSphere12()')\n mc.menuItem(l= 'Sphere sbdv 14', c= 'PSphere14()')\n mc.menuItem(l= 'Sphere sbdv 16', c= 'PSphere16()')\n mc.menuItem(l= 'Sphere sbdv 18', c= 'PSphere18()')\n mc.menuItem(l= 'Sphere sbdv 20', c= 'PSphere20()')\n\n PCube = mc.symbolButton( image= imageCube, c= \"PCube1()\", ann= \"Create Cube \")\n mc.popupMenu()\n mc.menuItem(l= 'Cube sbdv 1', c= 'PCube1()')\n mc.menuItem(l= 'Cube sbdv 2', c= 'PCube2()')\n mc.menuItem(l= 'Cube sbdv 3', c= 'PCube3()')\n mc.menuItem(l= 'Cube sbdv 4', c= 'PCube4()')\n mc.menuItem(l= 'Cube sbdv 5', c= 'PCube5()')\n mc.menuItem(l= 'Cube sbdv 6', c= 'PCube6()')\n\n PCylindre = mc.symbolButton( image= imageCylindre, c= \"PCylY12()\", ann= \"Create Cylinder on X with 6 Subdiv)\")\n mc.popupMenu()\n mc.menuItem(l= '__________X')\n mc.menuItem(l= 'Cylindre X 6', c= 'PCylX6()')\n mc.menuItem(l= 'Cylindre X 8', c= 'PCylX8()')\n mc.menuItem(l= 'Cylindre X 10', c= 'PCylX10()')\n mc.menuItem(l= 'Cylindre X 12', c= 'PCylX12()')\n mc.menuItem(l= 'Cylindre X 16', c= 'PCylX16()')\n mc.menuItem(l= 'Cylindre X 20', c= 'PCylX20()')\n mc.menuItem(l= 'Cylindre X 28', c= 'PCylX28()')\n mc.menuItem(l= '__________Y')\n mc.menuItem(l= 'Cylindre Y 6', c= 'PCylY6()')\n mc.menuItem(l= 'Cylindre Y 8', c= 'PCylY8()')\n mc.menuItem(l= 'Cylindre Y 10', c= 'PCylY10()')\n mc.menuItem(l= 'Cylindre Y 12', c= 'PCylY12()')\n mc.menuItem(l= 'Cylindre Y 16', c= 'PCylY16()')\n mc.menuItem(l= 'Cylindre Y 20', c= 'PCylY20()')\n mc.menuItem(l= 'Cylindre Y 28', c= 'PCylY28()')\n mc.menuItem(l= '__________Z')\n mc.menuItem(l= 'Cylindre Z 6', c= 'PCylZ6()')\n mc.menuItem(l= 'Cylindre Z 8', c= 'PCylZ8()')\n mc.menuItem(l= 'Cylindre Z 10', c= 'PCylZ10()')\n mc.menuItem(l= 'Cylindre Z 12', c= 'PCylZ12()')\n mc.menuItem(l= 'Cylindre Z 16', c= 'PCylZ16()')\n mc.menuItem(l= 'Cylindre Z 20', c= 'PCylZ20()')\n mc.menuItem(l= 'Cylindre Z 28', c= 'PCylZ28()')\n\n\n PPlane = mc.symbolButton( image= imagePlane, c= \"PPlaneX()\", ann= \"Create a Plane on X, Y or Z axis\")\n mc.popupMenu()\n mc.menuItem(l= 'Plane X', c= 'PPlaneX()')\n mc.menuItem(l= 'Plane Y', c= 'PPlaneY()')\n mc.menuItem(l= 'Plane Z', c= 'PPlaneZ()')\n PDisk = mc.symbolButton( image= imageDisc, c= \"PDiscZ12()\", ann= \"Create a Disc on X, Y or Z axis\")\n mc.popupMenu()\n mc.menuItem(l= '__________X')\n mc.menuItem(l= 'Disc X 6', c= 'PDiscX6()')\n mc.menuItem(l= 'Disc X 8', c= 'PDiscX8()')\n mc.menuItem(l= 'Disc X 10', c= 'PDiscX10()')\n mc.menuItem(l= 'Disc X 12', c= 'PDiscX12()')\n mc.menuItem(l= 'Disc X 14', c= 'PDiscX14()')\n mc.menuItem(l= 'Disc X 16', c= 'PDiscX16()')\n mc.menuItem(l= 'Disc X 18', c= 'PDiscX18()')\n mc.menuItem(l= '__________Y')\n mc.menuItem(l= 'Disc Y 6', c= 'PDiscY6()')\n mc.menuItem(l= 'Disc Y 8', c= 'PDiscY8()')\n mc.menuItem(l= 'Disc Y 10', c= 'PDiscY10()')\n mc.menuItem(l= 'Disc Y 12', c= 'PDiscY12()')\n mc.menuItem(l= 'Disc Y 14', c= 'PDiscY14()')\n mc.menuItem(l= 'Disc Y 16', c= 'PDiscY16()')\n mc.menuItem(l= 'Disc Y 18', c= 'PDiscY18()')\n mc.menuItem(l= '__________Z')\n mc.menuItem(l= 'Disc Z 6', c= 'PDiscZ6()')\n mc.menuItem(l= 'Disc Z 8', c= 'PDiscZ8()')\n mc.menuItem(l= 'Disc Z 10', c= 'PDiscZ10()')\n mc.menuItem(l= 'Disc Z 12', c= 'PDiscZ12()')\n mc.menuItem(l= 'Disc Z 14', c= 'PDiscZ14()')\n mc.menuItem(l= 'Disc Z 16', c= 'PDiscZ16()')\n mc.menuItem(l= 'Disc Z 18', c= 'PDiscZ18()')\n\n mc.setParent(cH1)\n mc.separator(h= 1, style = 'none')\n\n\n #________________\n #__________________________________________________________________TOOLS\n #________________\n\n\n cH2 = mc.columnLayout(adj =True)\n frameEdit = mc.frameLayout(l = \" TOOLS\", cll =1, cl =0, bgc= [0.15, 0.15, 0.15])\n mc.rowColumnLayout ( numberOfColumns=5, columnWidth=[ (1,48), (2,48), (3,48), (4,48), (5,48) ], columnAlign=[ (1, 'center'), (2, 'center'), (3, 'center'), (4, 'center'), (5, 'center') ] )\n\n imageCam = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Camera.png\"\n imageHardEdge = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/HardEdge.png\"\n imageSym = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Sym.png\"\n\n CamO = mc.symbolButton( image= imageCam, c= \"CamOrtho()\", ann= \"Hide and Lock Orthographique Cameras\")\n\n\n Sym = mc.symbolButton( image= imageSym, c= \"SymX()\", ann= \"Make Symetrie\")\n mc.popupMenu()\n mc.menuItem(l= '________Symmetry Merge')\n mc.menuItem(l= 'Symmetry on X', c= 'SymX()')\n mc.menuItem(l= 'Symmetry on Y', c= 'SymY()')\n mc.menuItem(l= 'Symmetry on Z', c= 'SymZ()')\n mc.menuItem(l= '________Flip Selection')\n mc.menuItem(l= 'Flip on X', c= 'FlipX()')\n mc.menuItem(l= 'Flip on Y', c= 'FlipY()')\n mc.menuItem(l= 'Flip on Z', c= 'FlipZ()')\n\n HardEdge = mc.symbolButton( image= imageHardEdge, c= \"HardEdges()\", ann= \"Be sure to be in edge mode\")\n mc.popupMenu()\n mc.menuItem(l= 'Smooth 30', c= 'mc.polySoftEdge(angle= 30)')\n mc.menuItem(l= 'Smooth 35', c= 'mc.polySoftEdge(angle= 35)')\n mc.menuItem(l= 'Smooth 40', c= 'mc.polySoftEdge(angle= 40)')\n mc.menuItem(l= 'Smooth 45', c= 'mc.polySoftEdge(angle= 45)')\n\n Align = mc.symbolButton( image= \"CenterPivot.png\", c= \"Align()\", ann= \"Select at least 3 Vertices, 2 Edges or 1 Face\")\n mc.popupMenu()\n mc.menuItem(l= 'A to B', c= 'BtoA()')\n \n UVs = mc.symbolButton( image= \"polyAutoProjLarge.png\", c= \"UVsAuto()\", ann= \"Auto UVs\")\n mc.popupMenu()\n mc.menuItem(l= 'Auto UVs', c= 'UVsAuto()')\n mc.menuItem(l= 'Planar UVs', c= 'UVsPlanar()')\n mc.menuItem(l= 'UVs Shader', c= 'UVs()')\n\n mc.setParent(cH2)\n mc.separator(h= 1, style = 'none')\n\n\n #________________\n #__________________________________________________________________COLORS\n #________________\n\n cH3 = mc.columnLayout(adj =True)\n frameEdit = mc.frameLayout(l = \" COLORS\", cll =1, cl =0, bgc= [0.15, 0.15, 0.15])\n mc.rowColumnLayout ( numberOfColumns=6, columnWidth=[ (1,40), (2,40), (3,40), (4,40), (5,40), (6,40) ], columnAlign=[ (1, 'center'), (2, 'center'), (3, 'center'), (4, 'center'), (5, 'center'), (6, 'center') ] )\n\n imageColorLambert = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/ColorLambert.png\"\n imageColorGreen = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/ColorGreen.png\"\n imageColorRed = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/ColorRed.png\"\n imageColorBlue = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/ColorBlue.png\"\n imageColorYellow = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/ColorYellow.png\"\n imageColorDarkGrey = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/ColorDarkGrey.png\"\n\n ColorLambert = mc.symbolButton( image= imageColorLambert, c= \"lambert1()\", ann= \"Apply Face Color\")\n mc.popupMenu()\n mc.menuItem(l= 'Select', c= 'SelectLambert()')\n mc.menuItem(l= 'Transparancy', c= 'TransLambert()')\n mc.menuItem(l= 'Attribut', c= 'AttributLambert()')\n\n ColorGreen = mc.symbolButton( image= imageColorGreen, c= \"SelGreen()\", ann= \"Apply Face Color\")\n mc.popupMenu()\n mc.menuItem(l= 'Select', c= 'SelectGreen()')\n mc.menuItem(l= 'Transparancy', c= 'TransGreen()')\n mc.menuItem(l= 'Attribut', c= 'AttributGreen()')\n\n ColorRed = mc.symbolButton( image= imageColorRed, c= \"SelRed()\", ann= \"Apply Face Color\")\n mc.popupMenu()\n mc.menuItem(l= 'Select', c= 'SelectRed()')\n mc.menuItem(l= 'Transparancy', c= 'TransRed()')\n mc.menuItem(l= 'Attribut', c= 'AttributRed()')\n\n ColorBlue = mc.symbolButton( image= imageColorBlue, c= \"SelBlue()\", ann= \"Apply Face Color\")\n mc.popupMenu()\n mc.menuItem(l= 'Select', c= 'SelectBlue()')\n mc.menuItem(l= 'Transparancy', c= 'TransBlue()')\n mc.menuItem(l= 'Attribut', c= 'AttributBlue()')\n\n ColorYellow = mc.symbolButton( image= imageColorYellow, c= \"SelYellow()\", ann= \"Apply Face Color\")\n mc.popupMenu()\n mc.menuItem(l= 'Select', c= 'SelectYellow()')\n mc.menuItem(l= 'Transparancy', c= 'TransYellow()')\n mc.menuItem(l= 'Attribut', c= 'AttributYellow()')\n\n ColorDarkGrey = mc.symbolButton( image= imageColorDarkGrey, c= \"SelGreyDark()\", ann= \"Apply Face Color\")\n mc.popupMenu()\n mc.menuItem(l= 'Select', c= 'SelectDarkGrey()')\n mc.menuItem(l= 'Transparancy', c= 'TransDarkGrey()')\n mc.menuItem(l= 'Attribut', c= 'AttributDarkGrey()')\n\n\n mc.setParent(cH3)\n mc.separator(h= 1, style = 'none')\n\n #________________\n #__________________________________________________________________SELECTIONS\n #________________\n\n cH5 = mc.columnLayout(adj =True)\n frameEdit = mc.frameLayout(l = \" SELECTIONS\", cll =1, cl =0, bgc= [0.15, 0.15, 0.15])\n mc.rowColumnLayout ( numberOfColumns=5, columnWidth=[ (1,30), (2,110), (3,30), (4,30), (5,30) ], columnAlign=[ (1, 'center'), (2, 'center'), (3, 'right'), (4, 'right'), (5, 'right') ] )\n\n imageMoins = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Moins.png\"\n imagePlus = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Plus.png\"\n imageDel = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Del.png\"\n imageSetSel = mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SelSet.png\"\n\n Moins1 = mc.symbolButton( image= imageMoins, c= \"Moins1()\", ann= \"Remove from Selection 1\")\n Store1 = mc.button(l= \"Store Selection 1\", c= \"Store1()\", w= 110, bgc= [0.22, 0.22, 0.22])\n Plus1 = mc.symbolButton( image= imagePlus, c= \"Plus1()\", ann= \"Add to Selection 1\")\n Del1 = mc.symbolButton( image= imageDel, c= \"Del1()\", ann= \"Delete Selection 1\")\n SetSel1 = mc.symbolButton( image= imageSetSel, c= \"SetSel1()\", ann= \"Get Selection 1\")\n\n Moins2 = mc.symbolButton( image= imageMoins, c= \"Moins2()\", ann= \"Remove from Selection 2\")\n Store2 = mc.button(l= \"Store Selection 2\", c= \"Store2()\", w= 110, bgc= [0.22, 0.22, 0.22])\n Plus2 = mc.symbolButton( image= imagePlus, c= \"Plus2()\", ann= \"Add to Selection 2\")\n Del2 = mc.symbolButton( image= imageDel, c= \"Del2()\", ann= \"Delete Selection 2\")\n SetSel2 = mc.symbolButton( image= imageSetSel, c= \"SetSel2()\", ann= \"Get Selection 2\")\n\n\n mc.setParent(cH5)\n mc.separator(h= 1, style = 'none')\n\n\n #________________\n #__________________________________________________________________CHAIN\n #________________\n\n cH6 = mc.columnLayout(adj =True)\n frameEdit = mc.frameLayout(l = \" CHAIN\", cll =1, cl =1, bgc= [0.15, 0.15, 0.15])\n Chain = mc.button(l= \" - Make Chain - \", c= \"Chain()\", w= 50, bgc= [0.22, 0.22, 0.22])\n mc.popupMenu()\n mc.menuItem(l= 'Bezier', c= \"Bezier()\")\n mc.menuItem(l= 'EPCurve', c= \"EPCurve()\")\n mc.menuItem(l= 'PencilCurve', c= \"Pencil()\")\n slideNumber = mc.intSliderGrp('Slider_Number', l = \"Number\",min =1, max =200,po =True, field =True, cc=\"Number_Val()\", dc=\"Number_Val()\", v= 30, adj =0, cat= [1, \"left\", 3], cw= [1, 45], ann= \"Set Number of Instances\")\n BakeChain = mc.button(l= \"- Bake Chain - \", c= \"BChain()\", w= 50, bgc= [0.22, 0.22, 0.22])\n mc.setParent(cH6)\n\n \n #__________________________________________________________________SCREW and BOLTS\n #________________\n\n cH8 = mc.columnLayout(adj =True)\n frameEdit = mc.frameLayout(l = \" SREWS and BOLTS\", cll =1, cl =1, bgc= [0.15, 0.15, 0.15])\n\n\n imageCustom= mc.internalVar(upd = True)+\"scripts/ShadeIt_script/Icons/Empty.png\" \n imageScrewA= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Screw_A.png\"\n imageScrewB= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Screw_B.png\"\n imageScrewC= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Screw_C.png\"\n imageScrewD= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Screw_D.png\"\n imageScrewE= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Screw_E.png\"\n imageScrewF= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Screw_F.png\"\n\n imageBoltA= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Bolt_A.png\"\n imageBoltB= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Bolt_B.png\"\n imageBoltC= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Bolt_C.png\"\n imageBoltD= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Bolt_D.png\"\n imageBoltE= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Bolt_E.png\"\n imageChainA= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/Chain_A.png\"\n \n imageSF1= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_1.png\"\n imageSF2= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_2.png\"\n imageSF3= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_3.png\"\n imageSF4= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_4.png\" \n imageSF5= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_5.png\"\n imageSF6= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_6.png\"\n imageSF7= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_7.png\"\n imageSF8= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_8.png\"\n imageSF9= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_9.png\"\n imageSF10= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_10.png\" \n imageSF11= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_11.png\"\n imageSF12= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_12.png\" \n imageSF13= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_13.png\"\n imageSF14= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_14.png\"\n imageSF15= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_15.png\"\n imageSF16= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_16.png\" \n imageSF17= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_17.png\"\n imageSF18= mc.internalVar(upd = True)+\"scripts/ModIt_script/Icons/SF_18.png\" \n \n \n mc.rowColumnLayout ( numberOfColumns=6, columnWidth=[ (1,39), (2,39), (3,39), (4,39), (5,39), (6,39) ] )\n \n ScrewA = mc.symbolButton( image= imageScrewA, c= \"ScrewA()\", ann= \"Add Screw A\")\n mc.popupMenu()\n mc.menuItem(l= 'Screw_A_Washer', c= \"Screw_A_Washer()\")\n ScrewB = mc.symbolButton( image= imageScrewB, c= \"ScrewB()\", ann= \"Add Screw B\")\n mc.popupMenu()\n mc.menuItem(l= 'Screw_B_Washer', c= \"Screw_B_Washer()\")\n ScrewC = mc.symbolButton( image= imageScrewC, c= \"ScrewC()\", ann= \"Add Screw C\")\n mc.popupMenu()\n mc.menuItem(l= 'Screw_C_Washer', c= \"Screw_C_Washer()\")\n ScrewD = mc.symbolButton( image= imageScrewD, c= \"ScrewD()\", ann= \"Add Screw D\")\n mc.popupMenu()\n mc.menuItem(l= 'Screw_D_Washer', c= \"Screw_D_Washer()\")\n ScrewE = mc.symbolButton( image= imageScrewE, c= \"ScrewE()\", ann= \"Add Screw E\")\n ScrewF = mc.symbolButton( image= imageScrewF, c= \"ScrewF()\", ann= \"Add Screw F\")\n\n\n BoltA = mc.symbolButton( image= imageBoltA, c= \"BoltA()\", ann= \"Add Bolt A\")\n mc.popupMenu()\n mc.menuItem(l= 'Bolt_A_Washer', c= \"Bolt_A_Washer()\")\n BoltB = mc.symbolButton( image= imageBoltB, c= \"BoltB()\", ann= \"Add Bolt B\")\n mc.popupMenu()\n mc.menuItem(l= 'Bolt_B_Washer', c= \"Bolt_B_Washer()\")\n BoltC = mc.symbolButton( image= imageBoltC, c= \"BoltC()\", ann= \"Add Bolt C\")\n BoltD = mc.symbolButton( image= imageBoltD, c= \"BoltD()\", ann= \"Add Bolt D\")\n BoltE = mc.symbolButton( image= imageBoltE, c= \"BoltE()\", ann= \"Add Bolt E\")\n ChainA = mc.symbolButton( image= imageChainA, c= \"ChainA()\", ann= \"Add Chain A\")\n mc.popupMenu()\n mc.menuItem(l= 'Chain_B', c= \"ChainB()\")\n mc.setParent( '..' )\n\n\n cH9 = mc.columnLayout(adj =True)\n mc.separator(h= 3, style='in')\n\n\n mc.rowColumnLayout ( numberOfColumns=6, columnWidth=[ (1,39), (2,39), (3,39), (4,39), (5,39), (6,39) ] )\n \n SF1 = mc.symbolButton( image= imageSF1, c= \"SF1()\", ann= \"Add SF 1\")\n SF2 = mc.symbolButton( image= imageSF2, c= \"SF2()\", ann= \"Add SF 2\")\n SF3 = mc.symbolButton( image= imageSF3, c= \"SF3()\", ann= \"Add SF 3\")\n SF4 = mc.symbolButton( image= imageSF4, c= \"SF4()\", ann= \"Add SF 4\")\n SF5 = mc.symbolButton( image= imageSF5, c= \"SF5()\", ann= \"Add SF 5\")\n SF6 = mc.symbolButton( image= imageSF6, c= \"SF6()\", ann= \"Add SF 6\")\n\n SF7 = mc.symbolButton( image= imageSF7, c= \"SF7()\", ann= \"Add SF 7\")\n SF8 = mc.symbolButton( image= imageSF8, c= \"SF8()\", ann= \"Add SF 8\")\n SF9 = mc.symbolButton( image= imageSF9, c= \"SF9()\", ann= \"Add SF 9\")\n SF10 = mc.symbolButton( image= imageSF10, c= \"SF10()\", ann= \"Add SF 10\")\n SF11 = mc.symbolButton( image= imageSF11, c= \"SF11()\", ann= \"Add SF 11\")\n SF12 = mc.symbolButton( image= imageSF12, c= \"SF12()\", ann= \"Add SF 12\")\n \n SF13 = mc.symbolButton( image= imageSF13, c= \"SF13()\", ann= \"Add SF 13\")\n SF14 = mc.symbolButton( image= imageSF14, c= \"SF14()\", ann= \"Add SF 14\")\n SF15 = mc.symbolButton( image= imageSF15, c= \"SF15()\", ann= \"Add SF 15\")\n SF16 = mc.symbolButton( image= imageSF16, c= \"SF16()\", ann= \"Add SF 16\")\n SF17 = mc.symbolButton( image= imageSF17, c= \"SF17()\", ann= \"Add SF 17\")\n SF18 = mc.symbolButton( image= imageSF18, c= \"SF18()\", ann= \"Add SF 18\")\n \n \n mc.setParent(cH8)\n mc.separator(h= 1, style = 'none')\n mc.setParent( '..' )\n\n\nmc.workspaceControl(\"ModIt 2.0 \", retain=False, floating=True, li= True, uiScript=\"createCustomWorkspaceControlModIt()\");\n\n\n\n\nclass COMAND():\n def Comand():\n mc.launch(web= \"https://wizix.artstation.com/\")\n\n\n###________________________________________PRIMITIVES_______________________________###\n###_________SPHERE\n\ndef PSphere8():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polySphere(r= 10, sx= 8, sy= 6, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Sphere_1\")\n\n else: \n \n name = \"Sphere\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polySphere(r= 10, sx= 8, sy= 6, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Sphere\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\ndef PSphere10():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polySphere(r= 10, sx= 10, sy= 6, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Sphere_1\")\n\n else: \n \n name = \"Sphere\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polySphere(r= 10, sx= 10, sy= 6, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Sphere\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\ndef PSphere12():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polySphere(r= 10, sx= 12, sy= 8, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Sphere_1\")\n\n else: \n \n name = \"Sphere\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polySphere(r= 10, sx= 12, sy= 8, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Sphere\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\ndef PSphere14():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polySphere(r= 10, sx= 14, sy= 8, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Sphere_1\")\n\n else: \n \n name = \"Sphere\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polySphere(r= 10, sx= 14, sy= 8, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Sphere\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\ndef PSphere16():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polySphere(r= 10, sx= 16, sy= 10, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Sphere_1\")\n\n else: \n \n name = \"Sphere\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polySphere(r= 10, sx= 16, sy= 10, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Sphere\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\ndef PSphere18():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polySphere(r= 10, sx= 18, sy= 10, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Sphere_1\")\n\n else: \n \n name = \"Sphere\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polySphere(r= 10, sx= 18, sy= 10, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Sphere\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\ndef PSphere20():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polySphere(r= 10, sx= 20, sy= 12, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Sphere_1\")\n\n else: \n \n name = \"Sphere\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polySphere(r= 10, sx= 20, sy= 12, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Sphere\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\n###_________CUBE\n\ndef PCube1():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCube(w= 20, h= 20, d= 20, sx= 1,sy= 1,sz= 1, ax= [0, 1, 0], cuv= 4, ch= 1)\n mc.rename(\"Cube_1\")\n\n else: \n \n name = \"Cube\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCube(w= 20, h= 20, d= 20, sx= 1,sy= 1,sz= 1, ax= [0, 1, 0], cuv= 4, ch= 1)\n mc.rename(\"Cube\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\ndef PCube2():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCube(w= 20, h= 20, d= 20, sx= 2,sy= 2,sz= 2, ax= [0, 1, 0], cuv= 4, ch= 1)\n mc.rename(\"Cube_1\")\n\n else: \n \n name = \"Cube\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCube(w= 20, h= 20, d= 20, sx= 2,sy= 2,sz= 2, ax= [0, 1, 0], cuv= 4, ch= 1)\n mc.rename(\"Cube\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef PCube3():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCube(w= 20, h= 20, d= 20, sx= 3,sy= 3,sz= 3, ax= [0, 1, 0], cuv= 4, ch= 1)\n mc.rename(\"Cube_1\")\n\n else: \n \n name = \"Cube\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCube(w= 20, h= 20, d= 20, sx= 3,sy= 3,sz= 3, ax= [0, 1, 0], cuv= 4, ch= 1)\n mc.rename(\"Cube\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n \ndef PCube4():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCube(w= 20, h= 20, d= 20, sx= 4,sy= 4,sz= 4, ax= [0, 1, 0], cuv= 4, ch= 1)\n mc.rename(\"Cube_1\")\n\n else: \n \n name = \"Cube\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCube(w= 20, h= 20, d= 20, sx= 4,sy= 4,sz= 4, ax= [0, 1, 0], cuv= 4, ch= 1)\n mc.rename(\"Cube\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n \ndef PCube5():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCube(w= 20, h= 20, d= 20, sx= 5,sy= 5,sz= 5, ax= [0, 1, 0], cuv= 4, ch= 1)\n mc.rename(\"Cube_1\")\n\n else: \n \n name = \"Cube\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCube(w= 20, h= 20, d= 20, sx= 5,sy= 5,sz= 5, ax= [0, 1, 0], cuv= 4, ch= 1)\n mc.rename(\"Cube\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\ndef PCube6():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCube(w= 20, h= 20, d= 20, sx= 6,sy= 6,sz= 6, ax= [0, 1, 0], cuv= 4, ch= 1)\n mc.rename(\"Cube_1\")\n\n else: \n \n name = \"Cube\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCube(w= 20, h= 20, d= 20, sx= 6,sy= 6,sz= 6, ax= [0, 1, 0], cuv= 4, ch= 1)\n mc.rename(\"Cube\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n \n###_________CYLINDRE\n\ndef PCylX6():\n \n selection = mc.ls(sl= True)\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [1, 0, 0],sc= 0, cuv= 4, ch= 1, sa= 6)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [1, 0, 0],sc= 0, cuv= 4, ch= 1, sa= 6)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n \n\n \ndef PCylX8():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [1, 0, 0],sc= 0, cuv= 4, ch= 1, sa= 8)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 8)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n \ndef PCylX10():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [1, 0, 0],sc= 0, cuv= 4, ch= 1, sa= 10)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 10)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\ndef PCylX12():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [1, 0, 0],sc= 0, cuv= 4, ch= 1, sa= 12)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 12)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\ndef PCylX16():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [1, 0, 0],sc= 0, cuv= 4, ch= 1, sa= 16)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 16)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\ndef PCylX20():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [1, 0, 0],sc= 0, cuv= 4, ch= 1, sa= 20)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 20)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\ndef PCylX28():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [1, 0, 0],sc= 0, cuv= 4, ch= 1, sa= 28)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 28)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\ndef PCylY6():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 6)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 6)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n \n\ndef PCylY8():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 8)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 8)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n \n \ndef PCylY10():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 10)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n \n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 10)\n mc.rename(\"Cylinder\")\n\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n \n\ndef PCylY12():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 12)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 12)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n \n\ndef PCylY16():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 16)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 16)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n \n\ndef PCylY18():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 18)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 18)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n \n\ndef PCylY20():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 20)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 20)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n\ndef PCylY28():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 28)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 28)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n \n\ndef PCylZ6():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 0, 1],sc= 0, cuv= 4, ch= 1, sa= 6)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 6)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n \n\n\ndef PCylZ8():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 0, 1],sc= 0, cuv= 4, ch= 1, sa= 8)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 8)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\n \n\ndef PCylZ10():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 0, 1],sc= 0, cuv= 4, ch= 1, sa= 10)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 10)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n \n\ndef PCylZ12():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 0, 1],sc= 0, cuv= 4, ch= 1, sa= 12)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 12)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\n\ndef PCylZ16():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 0, 1],sc= 0, cuv= 4, ch= 1, sa= 16)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 16)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n \n\ndef PCylZ18():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 0, 1],sc= 0, cuv= 4, ch= 1, sa= 18)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 18)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\n\ndef PCylZ20():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 0, 1],sc= 0, cuv= 4, ch= 1, sa= 20)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 20)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n \n\ndef PCylZ28():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 0, 1],sc= 0, cuv= 4, ch= 1, sa= 28)\n mc.rename(\"Cylinder_1\")\n\n else: \n \n name = \"Cylinder\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyCylinder(r= 10, h= 20, sy= 1,sz= 0, ax= [0, 1, 0],sc= 0, cuv= 4, ch= 1, sa= 6)\n mc.rename(\"Cylinder\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n \n \n \n \n###_________PLANE\n\ndef PPlaneX():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyPlane(w= 20, h= 20, sx= 1, sy= 1, ax= [1, 0, 0], cuv= 2, ch= 1)\n mc.rename(\"Plane_1\")\n\n else: \n \n name = \"Plane\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyPlane(w= 20, h= 20, sx= 1, sy= 1, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Plane\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\n\ndef PPlaneY():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyPlane(w= 20, h= 20, sx= 1, sy= 1, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Plane_1\")\n\n else: \n \n name = \"Plane\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyPlane(w= 20, h= 20, sx= 1, sy= 1, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Plane\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\n\ndef PPlaneZ():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyPlane(w= 20, h= 20, sx= 1, sy= 1, ax= [0, 0, 1], cuv= 2, ch= 1)\n mc.rename(\"Plane_1\")\n\n else: \n \n name = \"Plane\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyPlane(w= 20, h= 20, sx= 1, sy= 1, ax= [0, 1, 0], cuv= 2, ch= 1)\n mc.rename(\"Plane\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\n \n###_________DISK\n\ndef PDiscX6():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 6, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(0, 0, -90)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 6, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(0, 0, -90)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef PDiscX8():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 8, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(0, 0, -90)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 8, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(0, 0, -90)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n \n \ndef PDiscX10():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 10, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(0, 0, -90)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 10, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(0, 0, -90)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef PDiscX12():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 12, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(0, 0, -90)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 12, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(0, 0, -90)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n \n \ndef PDiscX16():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 16, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(0, 0, -90)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 16, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(0, 0, -90)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n \ndef PDiscX18():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 18, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(0, 0, -90)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 18, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(0, 0, -90)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n \n \ndef PDiscY6():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 6, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 6, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef PDiscY8():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 8, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 8, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef PDiscY10():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 10, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 10, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef PDiscY12():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 12, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 12, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef PDiscY14():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 14, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 14, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef PDiscY16():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 16, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 16, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef PDiscY18():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 18, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 18, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef PDiscZ6():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 6, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(90, 0, 0)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 6, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(90, 0, 0)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef PDiscZ8():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 8, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(90, 0, 0)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 8, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(90, 0, 0)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef PDiscZ10():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 10, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(90, 0, 0)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 10, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(90, 0, 0)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n \ndef PDiscZ12():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 12, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(90, 0, 0)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 12, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(90, 0, 0)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n \ndef PDiscZ14():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 14, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(90, 0, 0)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 14, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(90, 0, 0)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n \ndef PDiscZ16():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 16, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(90, 0, 0)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 16, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(90, 0, 0)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n \ndef PDiscZ18():\n \n selection = mc.ls(sl= True)\n\n if selection == []:\n mc.polyDisc(sides= 18, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(90, 0, 0)\n mc.rename(\"Disc_1\")\n\n else: \n \n name = \"Disc\"\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n mc.polyDisc(sides= 18, subdivisionMode= 4, subdivisions= 1,radius= 10)\n mc.rotate(90, 0, 0)\n mc.rename(\"Disc\")\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n \n \n \n \n \n \n \n \n###________________________________________TOOLS_______________________________###\n###_________CAMRRE\n\ndef CamOrtho():\n mc.setAttr( \"top.visibility\", 0)\n mc.setAttr( \"top.v\", lock= True)\n\n mc.setAttr( \"front.visibility\", 0)\n mc.setAttr( \"front.v\", lock= True)\n\n mc.setAttr( \"side.visibility\", 0)\n mc.setAttr( \"side.v\", lock= True)\n \n print \"DONE\"\n\n\n\n###_________SYM\n\ndef SymX():\n selection = mc.ls(sl = True, fl = True, dag = True, hd = 1)\n\n for each in selection:\n mc.FreezeTransformations()\n mc.delete(ch= True)\n mc.duplicate()\n mc.rename(\"Dupli\")\n mc.setAttr(\"Dupli.scaleX\", -1)\n mc.polyUnite(selection, \"Dupli\", n = \"polyTemps\")\n mc.delete(ch= True)\n mc.CenterPivot()\n mc.polyMergeVertex( d = 0.001, am = 1,ch= 0)\n mc.rename(\"Combiningwzx\")\n \n\ndef SymY():\n selection = mc.ls(sl = True, fl = True, dag = True, hd = 1)\n\n for each in selection:\n mc.FreezeTransformations()\n mc.delete(ch= True)\n mc.duplicate()\n mc.rename(\"Dupli\")\n mc.setAttr(\"Dupli.scaleY\", -1)\n mc.polyUnite(selection, \"Dupli\", n = \"polyTemps\")\n mc.delete(ch= True)\n mc.CenterPivot()\n mc.polyMergeVertex( d = 0.001, am = 1,ch= 0)\n mc.rename(\"Combiningwzx\") \n\ndef SymZ():\n selection = mc.ls(sl = True, fl = True, dag = True, hd = 1)\n\n for each in selection:\n mc.FreezeTransformations()\n mc.delete(ch= True)\n mc.duplicate()\n mc.rename(\"Dupli\")\n mc.setAttr(\"Dupli.scaleZ\", -1)\n mc.polyUnite(selection, \"Dupli\", n = \"polyTemps\")\n mc.delete(ch= True)\n mc.CenterPivot()\n mc.polyMergeVertex( d = 0.001, am = 1,ch= 0)\n mc.rename(\"Combiningwzx\") \n \n \ndef FlipX():\n selection = mc.ls(sl = True, fl = True, dag = True, hd = 1)\n \n\n for each in selection:\n DupSel = mc.duplicate(rc= True)\n mc.group(em= True, n=\"DupliF\")\n mc.parent(DupSel, 'DupliF')\n mc.setAttr(\"DupliF.scaleX\", -1)\n mc.rename(\"DupliF\", \"DupliFlip\")\n\ndef FlipY():\n selection = mc.ls(sl = True, fl = True, dag = True, hd = 1)\n \n\n for each in selection:\n DupSel = mc.duplicate(rc= True)\n mc.group(em= True, n=\"DupliF\")\n mc.parent(DupSel, 'DupliF')\n mc.setAttr(\"DupliF.scaleY\", -1)\n mc.rename(\"DupliF\", \"DupliFlip\")\n\ndef FlipZ():\n selection = mc.ls(sl = True, fl = True, dag = True, hd = 1)\n \n\n for each in selection:\n DupSel = mc.duplicate(rc= True)\n mc.group(em= True, n=\"DupliF\")\n mc.parent(DupSel, 'DupliF')\n mc.setAttr(\"DupliF.scaleZ\", -1)\n mc.rename(\"DupliF\", \"DupliFlip\")\n\n###___________________________________________________________________________HARDEDGES\ndef HardEdges():\n mc.polySelectConstraint(m= 3, t= 0x8000, sm= 1)\n mc.polySelectConstraint(m= 0) \n\n\n###___________________________________________________________________________UVS\n\ndef UVsAuto(): \n selection = mc.ls(sl = True, fl = True, dag = True, type= 'mesh')\n \n for each in selection:\n mc.DeleteHistory()\n mc.polyAutoProjection(lm= 0, pb= 0, ibd= 1, sc= 1, o= 1, p= 3, ps= 0.1, ws= 0)\n mc.polyEditUV(pu= 0.5, pv= 0.5, su= 0.5, sv= 0.5, u= -0.25, v= 0.25)\n mc.select(each)\n mc.DeleteHistory()\n print \"UV Done\"\n \ndef UVsPlanar():\n \n selection = mc.ls(sl = True, fl = True, dag = True, type= 'mesh')\n \n for each in selection:\n mc.DeleteHistory()\n mc.polyProjection( each + '.f[*]', ch= 1, type= \"planar\", ibd= True, kir= True, md= \"c\" )\n mc.polyEditUV(pu= 0.5, pv= 0.5, su= 0.5, sv= 0.5, u= -0.25, v= 0.25)\n mc.select(each)\n mc.DeleteHistory()\n print \"UV Done\"\n\ndef UVs():\n \n UVsPath = mc.internalVar(upd = True)+\"scripts/ModIt_script/Shaders/Uvs.ma\"\n selection = mc.ls(sl = True, fl = True, dag = True)\n\n if mc.objExists('UVs'):\n print(\"UVs_EXIST\")\n for each in selection:\n mc.hyperShade( a= \"UVs\")\n mc.select(\"UVs\")\n print \"Done\"\n \n else:\n mc.sets(n= \"Settemps\")\n mc.file(UVsPath, i = True)\n mc.binMembership(\"UVs\", addToBin= \"Viewport_Shaders\")\n mc.select(\"Settemps\")\n mc.ls(selection= True)\n mc.delete(\"Settemps\")\n for each in selection:\n mc.hyperShade( a= \"UVs\")\n mc.select(\"UVs\")\n print \"Done\" \n\ndef BtoA():\n mc.MatchTranslation()\n mc.MatchRotation()\n \n\n###________________________________________________________________________FACES COLORS\ndef lambert1():\n\n mc.hyperShade( assign= \"lambert1\" )\n \n\ndef SelGreen():\n\n selection = mc.ls(sl= True)\n\n if mc.objExists('Sel_Green'):\n mc.hyperShade( assign= \"Sel_Green\" )\n \n else:\n LambertGreen = mc.shadingNode(\"lambert\",asShader=True)\n mc.setAttr(LambertGreen + \".color\", 0.0, 0.7, 0.0, type = 'double3')\n mc.rename(\"Sel_Green\")\n mc.select(selection)\n mc.hyperShade( assign= \"Sel_Green\" )\n\n\n\ndef SelRed():\n\n selection = mc.ls(sl= True)\n\n if mc.objExists('Sel_Red'):\n mc.hyperShade( assign= \"Sel_Red\" )\n \n else:\n LambertRed = mc.shadingNode(\"lambert\",asShader=True)\n mc.setAttr(LambertRed + \".color\", 0.7, 0.0, 0.0, type = 'double3')\n mc.rename(\"Sel_Red\")\n mc.select(selection)\n mc.hyperShade( assign= \"Sel_Red\" )\n\ndef SelBlue():\n\n selection = mc.ls(sl= True)\n\n if mc.objExists('Sel_Blue'):\n mc.hyperShade( assign= \"Sel_Blue\" )\n \n else:\n LambertBlue = mc.shadingNode(\"lambert\",asShader=True)\n mc.setAttr(LambertBlue + \".color\", 0.0, 0.0, 0.7, type = 'double3')\n mc.rename(\"Sel_Blue\")\n mc.select(selection)\n mc.hyperShade( assign= \"Sel_Blue\" )\n\ndef SelYellow():\n\n selection = mc.ls(sl= True)\n\n if mc.objExists('Sel_Yellow'):\n mc.hyperShade( assign= \"Sel_Yellow\" )\n \n else:\n LambertYellow = mc.shadingNode(\"lambert\",asShader=True)\n mc.setAttr(LambertYellow + \".color\", 1.0, 0.7, 0.0, type = 'double3')\n mc.rename(\"Sel_Yellow\")\n mc.select(selection)\n mc.hyperShade( assign= \"Sel_Yellow\" )\n\ndef SelGreyDark():\n\n selection = mc.ls(sl= True)\n\n if mc.objExists('Sel_GreyDark'):\n mc.hyperShade( assign= \"Sel_GreyDark\" )\n \n else:\n LambertGreyDark = mc.shadingNode(\"lambert\",asShader=True)\n mc.setAttr(LambertGreyDark + \".color\", 0.05, 0.05, 0.05, type = 'double3')\n mc.rename(\"Sel_GreyDark\")\n mc.select(selection)\n mc.hyperShade( assign= \"Sel_GreyDark\" ) \n \n\ndef SelectLambert():\n\n if mc.objExists('lambert1'):\n mc.hyperShade( objects= \"lambert1\" )\n \n else:\n print \"Please First Create this FaceColor Shader\" \n\n\ndef SelectGreen():\n\n if mc.objExists('Sel_Green'):\n mc.hyperShade( objects= \"Sel_Green\" )\n \n else:\n print \"Please First Create this FaceColor Shader\" \n \n \ndef SelectRed():\n\n if mc.objExists('Sel_Red'):\n mc.hyperShade( objects= \"Sel_Red\" )\n \n else:\n print \"Please First Create this FaceColor Shader\" \n\n\ndef SelectBlue():\n\n if mc.objExists('Sel_Blue'):\n mc.hyperShade( objects= \"Sel_Blue\" )\n \n else:\n print \"Please First Create this FaceColor Shader\" \n\ndef SelectYellow():\n\n if mc.objExists('Sel_Yellow'):\n mc.hyperShade( objects= \"Sel_Yellow\" )\n \n else:\n print \"Please First Create this FaceColor Shader\" \n\ndef SelectDarkGrey():\n\n if mc.objExists('Sel_GreyDark'):\n mc.hyperShade( objects= \"Sel_GreyDark\" )\n \n else:\n print \"Please First Create this FaceColor Shader\" \n\n\ndef TransGreen():\n\n if mc.objExists('Sel_Green'):\n mc.window( title='Green Transparancy' )\n mc.columnLayout()\n mc.attrColorSliderGrp( at='Sel_Green.transparency')\n mc.showWindow()\n \n else:\n print \"Please First Create this FaceColor Shader\" \n \n\ndef AttributGreen():\n\n if mc.objExists('Sel_Green'):\n mc.select('Sel_Green')\n \n else:\n print \"Please First Create this FaceColor Shader\" \n\n\ndef TransLambert():\n\n if mc.objExists('lambert1'):\n mc.window( title='Lambert Transparancy' )\n mc.columnLayout()\n mc.attrColorSliderGrp( at='lambert1.transparency')\n mc.showWindow()\n \n else:\n print \"Please First Create this FaceColor Shader\" \n \n\ndef AttributLambert():\n\n if mc.objExists('lambert1'):\n mc.select('lambert1')\n \n else:\n print \"Please First Create this FaceColor Shader\" \n\ndef TransRed():\n\n if mc.objExists('Sel_Red'):\n mc.window( title='Red Transparancy' )\n mc.columnLayout()\n mc.attrColorSliderGrp( at='Sel_Red.transparency')\n mc.showWindow()\n \n else:\n print \"Please First Create this FaceColor Shader\" \n \n\ndef AttributRed():\n\n if mc.objExists('Sel_Red'):\n mc.select('Sel_Red')\n \n else:\n print \"Please First Create this FaceColor Shader\" \n\n\ndef TransBlue():\n\n if mc.objExists('Sel_Blue'):\n mc.window( title='Blue Transparancy' )\n mc.columnLayout()\n mc.attrColorSliderGrp( at='Sel_Blue.transparency')\n mc.showWindow()\n \n else:\n print \"Please First Create this FaceColor Shader\" \n \n\ndef AttributBlue():\n\n if mc.objExists('Sel_Blue'):\n mc.select('Sel_Blue')\n \n else:\n print \"Please First Create this FaceColor Shader\" \n\n\ndef TransYellow():\n\n if mc.objExists('Sel_Yellow'):\n mc.window( title='Yellow Transparancy' )\n mc.columnLayout()\n mc.attrColorSliderGrp( at='Sel_Yellow.transparency')\n mc.showWindow()\n \n else:\n print \"Please First Create this FaceColor Shader\" \n \n\ndef AttributYellow():\n\n if mc.objExists('Sel_Yellow'):\n mc.select('Sel_Yellow')\n \n else:\n print \"Please First Create this FaceColor Shader\" \n\n\ndef TransDarkGrey():\n\n if mc.objExists('Sel_GreyDark'):\n mc.window( title='GreyDark Transparancy' )\n mc.columnLayout()\n mc.attrColorSliderGrp( at='Sel_GreyDark.transparency')\n mc.showWindow()\n \n else:\n print \"Please First Create this FaceColor Shader\" \n \n\ndef AttributDarkGrey():\n\n if mc.objExists('Sel_GreyDark'):\n mc.select('Sel_GreyDark')\n \n else:\n print \"Please First Create this FaceColor Shader\" \n\n\nclass ALIGN():\n def Comand():\n mc.launch(web= \"https://wizix.artstation.com/\")\n \n \n###________________________________________________________________________ALIGN\ndef Align():\n mc.setToolTo('Move')\n getPivotPos = mel.eval(\"float $getPivotPos[] = `manipMoveContext -q -p Move`;\")\n mel.eval(\"ConvertSelectionToVertices;\")\n vtxSel=mc.ls(fl=1, sl=1)\n selectedObjectStore= mc.ls(o=1, sl=1)\n objectSelectionStore= mc.listRelatives(selectedObjectStore[0], p=1)\n if len(vtxSel)<3:\n mc.warning(\"Please select at least 3 Vertices, 2 Edges or 1 Face\")\n \n plane=mc.polyPlane(cuv=2, sy=1, sx=1, h=1, n='rotationPlane', ch=1, w=1, ax=(0, 1, 0))\n mc.select((plane[0] + \".vtx[0:2]\"), \n vtxSel[0], vtxSel[1], vtxSel[2])\n mel.eval(\"snap3PointsTo3Points(0)\")\n mc.parent(objectSelectionStore, plane[0])\n mc.makeIdentity(objectSelectionStore, apply=True, s=0, r=1, t=0, n=0)\n mc.xform(ws=1, piv=(getPivotPos[0], getPivotPos[1], getPivotPos[2]))\n mc.parent(objectSelectionStore, world=1)\n mc.delete(plane)\n\n\n\n\n###________________________________________CHAIN_______________________________###\n\n\ndef Chain():\n \n if mc.objExists('M_Chain'):\n mc.rename(\"M_Chain\", \"M_Chain_1\")\n \n selection1 = mc.ls(sl = True, fl = True, dag = True, hd = 1)\n selection2 = mc.ls(sl = True, fl = True, dag = True, tl= 1, shapes= True)\n \n mc.select(selection1)\n \n # create a new MASH network\n mashNetwork = mapi.Network()\n mashNetwork.createNetwork(name = \"M_Chain\", geometry=\"Instancer\")\n mc.setAttr(mashNetwork.distribute + '.pointCount', 30)\n mc.setAttr(mashNetwork.distribute + '.arrangement', 8)\n \n \n # create a world node\n curveNode = mashNetwork.addNode(\"MASH_Curve\")\n mc.connectAttr(selection2[0]+\".worldSpace[0]\", \"M_Chain_Curve.inCurves[0]\")\n mc.setAttr(\"M_Chain_Curve.parametricLength\", 1)\n\n\n\ndef BChain():\n selection = mc.ls(sl = True, fl = True, dag = True)\n selCurve = mc.ls(sl = True, fl = True, dag = True, tl= 1, shapes= True)\n selCurveTransform = mc.ls(sl = True, fl = True, dag = True, hd= 1)\n selMashCurve = mc.listConnections(selCurve)\n selMash = mc.listConnections(selMashCurve, t= \"MASH_Waiter\")\n selInstanceT = mc.listConnections(selMash, t= \"instancer\")\n selInstance = mc.ls(selInstanceT, fl = True, dag = True, tl= 1)\n\n\n mc.select(selInstance)\n import maya.mel as mel \n mel.eval('MASHBakeGUI;')\n mc.select(selInstance)\n import MASHbakeInstancer; MASHbakeInstancer.MASHbakeInstancer(False)\n mc.select(\"M_Chain_Instancer_objects\")\n mc.SelectHierarchy(\"M_Chain_Instancer_objects\")\n mc.CenterPivot()\n mc.delete(ch= True)\n mc.showHidden(a= True)\n mc.rename(\"M_Chain_Instancer_objects\", \"M_Chain_Bake_1\")\n mc.delete(selInstance)\n mc.delete(selMashCurve)\n mc.delete(selMash)\n mc.delete(selection)\n print \"BAKE DONE\"\n\n print \"BAKE DONE\"\n\n\n\ndef Number_Val():\n \n myValueWidght = mc.intSliderGrp(\"Slider_Number\", q= True, value=True)\n\n selection = mc.ls(sl = True, fl = True, dag = True)\n selCurve = mc.ls(sl = True, fl = True, dag = True, tl= 1, shapes= True)\n selCurveTransform = mc.ls(sl = True, fl = True, dag = True, hd= 1)\n selMashCurve = mc.listConnections(selCurve)\n selMashDistri = mc.listConnections(selMashCurve, t= \"MASH_Distribute\")\n\n\n for each in selMashDistri:\n mc.setAttr(each + \".pointCount\", myValueWidght)\n\n\n\ndef Bezier():\n \n mc.CreateBezierCurveTool()\n \n\ndef EPCurve():\n \n mc.EPCurveTool()\n \n \ndef Pencil():\n \n mc.PencilCurveTool() \n\n\n\n\n###________________________________________SELECTIONS_______________________________###\n###_________STORE1\n\ndef Store1():\n \n if mc.objExists('ModSet1'):\n mc.sets(add = \"ModSet1\")\n \n else :\n newSet1 = mc.sets(n = \"ModSet1\")\n\n\ndef Plus1():\n mc.sets(add = \"ModSet1\")\n\n\ndef Moins1():\n mc.sets(rm = \"ModSet1\")\n\n\ndef Del1():\n mc.delete(\"ModSet1\")\n\n\ndef SetSel1():\n selection = mc.ls(sl = True, fl = True, dag = True, hd = 1)\n \n mc.select( \"ModSet1\" )\n mc.ls( selection= True )\n import maya.mel as mel \n mel.eval('setSelectMode components Components; selectType -smp 0 -sme 1 -smf 0 -smu 0 -pv 0 -pe 1 -pf 0 -puv 0; HideManipulators;')\n\n\n###_________STORE2\n\ndef Store2():\n \n if mc.objExists('ModSet2'):\n mc.sets(add = \"ModSet2\")\n \n else :\n newSet1 = mc.sets(n = \"ModSet2\")\n\n\ndef Plus2():\n mc.sets(add = \"ModSet2\")\n\n\ndef Moins2():\n mc.sets(rm = \"ModSet2\")\n\n\ndef Del2():\n mc.delete(\"ModSet2\")\n\n\ndef SetSel2():\n selection = mc.ls(sl = True, fl = True, dag = True, hd = 1)\n \n mc.select( \"ModSet2\" )\n mc.ls( selection= True )\n import maya.mel as mel \n mel.eval('setSelectMode components Components; selectType -smp 0 -sme 1 -smf 0 -smu 0 -pv 0 -pe 1 -pf 0 -puv 0; HideManipulators;')\n\n\n\n###________________________________________SCREW AND BOLTS______________________________###\n###_________SCREW1\n\ndef ScrewA():\n \n name = \"Screw_A\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Screw_A.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n\ndef Screw_A_Washer():\n \n name = \"Screw_A_Washer\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Screw_A_Washer.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n\ndef ScrewB():\n \n name = \"Screw_B\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Screw_B.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n\ndef Screw_B_Washer():\n \n name = \"Screw_B_Washer\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Screw_B_Washer.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef ScrewC():\n \n name = \"Screw_C\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Screw_C.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n\ndef Screw_C_Washer():\n \n name = \"Screw_C_Washer\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Screw_C_Washer.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef ScrewD():\n \n name = \"Screw_D\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Screw_D.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n\ndef Screw_D_Washer():\n \n name = \"Screw_D_Washer\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Screw_D_Washer.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef ScrewE():\n \n name = \"Screw_E\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Screw_E.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n \ndef ScrewF():\n \n name = \"Screw_F\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Screw_F.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\") \n\n\ndef BoltA():\n \n name = \"Bolt_A\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Bolt_A.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n\ndef Bolt_A_Washer():\n \n name = \"Bolt_A_Washer\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Bolt_A_Washer.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef BoltB():\n \n name = \"Bolt_B\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Bolt_B.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n\ndef Bolt_B_Washer():\n \n name = \"Bolt_B_Washer\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Bolt_B_Washer.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n\ndef BoltC():\n \n name = \"Bolt_C\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Bolt_C.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n\n\ndef BoltD():\n \n name = \"Bolt_D\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Bolt_D.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n\n\ndef BoltE():\n \n name = \"Bolt_E\"\n # get current position of the move manipulator\n import maya.mel as mel\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n \n # get the current selection\n selection = mc.ls(selection=True)\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Bolt_E.ma\"\n target = mc.file(fileO, i= True)\n\n mc.move(pos[0], pos[1], pos[2], name)\n\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n\n\ndef ChainA():\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Chain_A.ma\"\n target = mc.file(fileO, i= True)\n\n mc.rename(\"Chain_A\", \"Chain_A_01\")\n\n\ndef ChainB():\n \n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/Chain_B.ma\"\n target = mc.file(fileO, i= True)\n\n mc.rename(\"Chain_B\", \"Chain_B_01\")\n\ndef SF1():\n \n name = \"SF_1\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_1.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF2():\n \n name = \"SF_2\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_2.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF3():\n \n name = \"SF_3\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_3.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF4():\n \n name = \"SF_4\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_4.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF5():\n \n name = \"SF_5\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_5.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF6():\n \n name = \"SF_6\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_6.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF7():\n \n name = \"SF_7\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_7.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF8():\n \n name = \"SF_8\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_8.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF9():\n \n name = \"SF_9\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_9.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF10():\n \n name = \"SF_10\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_10.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF11():\n \n name = \"SF_11\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_11.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF12():\n \n name = \"SF_12\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_12.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n\ndef SF13():\n \n name = \"SF_13\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_13.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF14():\n \n name = \"SF_14\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_14.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF15():\n \n name = \"SF_15\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_15.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF16():\n \n name = \"SF_16\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_16.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF17():\n \n name = \"SF_17\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_17.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\ndef SF18():\n \n name = \"SF_18\"\n mel.eval(\"setToolTo $gMove;\")\n pos = mc.manipMoveContext('Move', query=True, position=True) \n selection = mc.ls(selection=True)\n fileO = mc.internalVar(upd = True)+\"scripts/ModIt_script/Mesh/SF_18.ma\"\n target = mc.file(fileO, i= True)\n mc.move(pos[0], pos[1], pos[2], name)\n constr = mc.normalConstraint(selection, name, aimVector = (0,1,0), worldUpType= 0)\n mc.delete(constr)\n mc.rename(name, name + \"_01\")\n\n" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 3
-flexibleWidthValue 32
-enable 1
-width 35
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "GoZ" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "GoZ" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/GoZ.png" 
-image1 "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/GoZ.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "// ------------------------------------------\n//\tGoZBrush from Maya script\n// ------------------------------------------\n\n\n// ------------------------------------------\n// Global variables.\nglobal string $GoZPublicPath = \"C:/Users/Public/Pixologic/\";\nglobal string $GoZAppExt = \".exe\";\nglobal string $GoZProjectPath;\nglobal int $GoZDebugON = 0;\nglobal string $gFileBaseName = \"\";\nglobal int $gFileOccurrence = 0;\nglobal string $selObjects[];\n\n\n// ------------------------------------------\n// Launch an application.\n// Code is different depending on PC/Mac.\nglobal proc launchApp(string $path)\n{\n // On Windows:\n system($path);\n\n // On MacOSX:\n //system(\"open -a \\\"\"+$path+\"\\\"\");\n}\n\n\n// ------------------------------------------\n// Debug purpose...\nglobal proc printDebug(string $text)\n{\n global int $GoZDebugON;\n if ($GoZDebugON)\n {\n print($text+\"\\n\");\n }\n}\n\n// Requires the plugin gozMaya loaded.---------------- //++\nif (`pluginInfo -query -loaded -name \"gozMaya\"`==0){\n loadPlugin \"gozMaya\"; \n}\n\n// ------------------------------------------\n// Decompose a fileName into [$gFileBaseName][$gFileOccurrence],\n// where [$gFileBaseName] is text and $gFileOccurrence is an integer.\n// For example, decompose \"myFile25\" into (\"myFile\", 26)\nglobal proc decomposeFileName(string $fileName)\n{\n global string $gFileBaseName;\n global int $gFileOccurrence;\n\n int $index;\n int $count;\n string $car;\n\n $count = size($fileName);\n for ($index=$count; $index>0; $index--)\n {\n $car = `substring $fileName $index $index`;\n $car = `match \"[0-9]\" $car`;\n if ($car == \"\")\n break;\n }\n\n if ($index == $count)\n {\n $gFileBaseName = $fileName;\n $gFileOccurrence = 0;\n }\n else\n {\n if ($index > 0)\n $gFileBaseName = `substring $fileName 1 $index`;\n else\n $gFileBaseName = \"\";\n $index++;\n $car = `substring $fileName $index $count`;\n $gFileOccurrence = $car;\n }\n}\n\n\n// ------------------------------------------\n// Tests if a GoZ name matches an object name.\n// The test is performed using decomposition of both names(see decomposeFileName).\n// The GoZ name matches the object name if and only if:\n// 1- both names decomposition have the same base name\n// 2- the occurence of GoZ name is greater or equal to the occcurrence of object name.\n// For example, for object name \"myFile25\":\n// - \"myFile25\" and \"myFile48\" are valid GoZ names,\n// - \"myFile24\" and \"toto_en_short\" are NOT valid GoZ names!\nglobal proc int areSameNames(string $objectName, string $objectGoZName)\n{\n string $objName = `tolower $objectName`;\n string $gozName = `tolower $objectGoZName`;\n if ($objName == $gozName)\n return 1;\n return 0;\n/*\n global string $gFileBaseName;\n global int $gFileOccurrence;\n\n string $objectGoZBaseName;\n int $objectGoZOccurrence;\n string $objectBaseName;\n int $objectOccurrence;\n\n decomposeFileName($objectGoZName);\n $objectGoZBaseName = `tolower $gFileBaseName`;\n $objectGoZOccurrence = $gFileOccurrence;\n\n decomposeFileName($objectName);\n $objectBaseName = `tolower $gFileBaseName`;\n $objectOccurrence = $gFileOccurrence;\n\n if ($objectBaseName != $objectGoZBaseName)\n return 0;\n if ($objectGoZOccurrence < $objectOccurrence)\n return 0;\n return 1;\n*/\n}\n\n\n// ------------------------------------------\n// Simulates a sleep of some milliseconds.\n// Note: as no sleep command is available, it waits \"actively\" for the amout of time...\nglobal proc sleep(float $delayInSecond)\n{\n float $startTime;\n float $ellapsedTime;\n $startTime = `timerX`;\n $ellapsedTime = `timerX -st $ellapsedTime`;\n while ($ellapsedTime < $delayInSecond)\n {\n $ellapsedTime = `timerX -st $ellapsedTime`;\n }\n}\n\n\n// ------------------------------------------\n// Creates a new GoZ name based an an object name.\n// Creation is made using the GoZ utility \"GoZMakeObjectPath\",\n// which ensures that the GoZ name is unique.\n// Note: check if the GoZ name $name is unique consists on\n// checking ZTN files in \"/Users/Public/Pixologic/GoZProject/default/\",\n// and verify that the file $name.ztn does not exist in that folder.\n// IMPORTANT: It implies that to safely create several unique GoZ names,\n// the caller should create an empty ZTN file using the unique name it returns.\nglobal proc string createGoZID(string $objectName)\n{\n global string $GoZPublicPath;\n global string $GoZAppExt;\n\n string $fileName;\n string $path;\n int $fileId;\n float $startTime;\n float $ellapsedTime;\n float $delay;\n\n $fileName = $GoZPublicPath + \"GoZBrush/GoZ_ObjectPath.txt\";\n $fileId = `fopen $fileName \"w\"`;\n fprint $fileId $objectName;\n fclose $fileId;\n\n $fileName = $GoZPublicPath + \"GoZBrush/GoZMakeObjectPath\" + $GoZAppExt;\n launchApp($fileName);\n\n $fileName = $GoZPublicPath + \"GoZBrush/GoZ_ObjectPath.txt\";\n $startTime = `timerX`;\n $ellapsedTime = `timerX -st $startTime`;\n $delay = 0.02;\n while ($ellapsedTime < 2.0)\n {\n $fileId = `fopen $fileName \"r\"`;\n if ($fileId != 0)\n {\n $path = \"\";\n $path = `fread $fileId $path`;\n fclose $fileId;\n if (size($path) > size($objectName))\n {\n string $tokens[];\n int $tokenCount;\n $tokenCount = `tokenize $path \"/\\\\\" $tokens`;\n/*\n if ($tokenCount < 2)\n {\n printDebug(\" >>>> No token found in path \\\"\" + $path + \"\\\" <<<<\");\n return $objectName;\n }\n printDebug(\" >>>> \" + $tokenCount + \" tokens found in path \\\"\" + $path + \"\\\" <<<<\");\n*/\n $path = $tokens[$tokenCount-1];\n printDebug(\" >>>> Unique GoZ ID \\\"\" + $path + \"\\\" generated for object \\\"\" + $objectName + \"\\\" <<<<\");\n return $path;\n }\n }\n sleep($delay);\n $delay = 0.1;\n $ellapsedTime = `timerX -st $startTime`;\n }\n\n // If here, did not manage to find a valid path.\n // As such an error is not managed, just returns $objectName which will be overwrited.\n printDebug(\" >>>> No unique GoZ ID generated for object \\\"\" + $objectName + \"\\\" <<<<\");\n return $objectName;\n}\n\n\n// ------------------------------------------\n// Exports a GoZ object to ZBrush.\nglobal proc int exportGoZObject(int $selIndex)\n{\n global string $GoZPublicPath;\n global string $GoZProjectPath;\n global string $selObjects[];\n\n string $objectName = $selObjects[$selIndex];\n string $maFileName;\n string $ztnFileName;\n string $gozName;\n string $gozPath;\n string $validGoZName;\n string $fileName;\n int $fileId;\n printDebug(\" Exporting object \" + $objectName + \"...\");\n\n // The object already has a GoZBrushID attribute, which contains an ID of ZTN file.\n if (`attributeQuery -node $objectName -ex \"GoZBrushID\"`)\n {\n //select -r $objectName;\n $gozName = getAttr($objectName + \".GoZBrushID\");\n $ztnFileName = $GoZProjectPath + $gozName + \".ztn\";\n printDebug(\" Found GoZBrushID attribute = \" + $gozName);\n\n // There is an existing GoZ ID, but it does not match the object name.\n // This can occur either after a copy or a rename of the object.\n // In such a case, create a new GoZ ID matching the object name,\n // and copy maps from previous ID if it still exists.\n if (!areSameNames($objectName, $gozName))\n {\n // Stores previous GoZ ID.\n string $oldGoZName = $gozName;\n\n // Creates a new GoZ ID.\n $gozName = createGoZID($objectName);\n\n string $msg;\n string $result;\n printDebug(\" GoZBrush ID is invalid: --- ObjectName = \" + $objectName + \" --- GoZBrushID = \" + $oldGoZName + \" --- free GoZBrushID = \" + $gozName);\n\n $msg = \"The object \\\"\" + $objectName + \"\\\" is linked to GoZ mesh \\\"\" + $oldGoZName + \"\\\".\";\n $msg = $msg + \"\\nGoZ requires the same name for object and GoZ mesh.\";\n $msg = $msg + \"\\nWhat do you want do do?\";\n $msg = $msg + \"\\n\\n- 'Rename' object as \\\"\" + $oldGoZName + \"\\\".\";\n if (!areSameNames($objectName, $gozName))\n {\n\t $msg = $msg + \"\\n- 'Relink' object to existing GoZ mesh \\\"\" + $objectName + \"\\\".\";\n\t $msg = $msg + \"\\n- 'Create' a new GoZ mesh \\\"\" + $gozName + \"\\\" for this object.\";\n\t $msg = $msg + \"\\n (object will be renamed to \\\"\" + $gozName + \"\\\".)\";\n }\n else\n\t $msg = $msg + \"\\n- 'Create' a new GoZ mesh \\\"\" + $gozName + \"\\\" for this object.\";\n $msg = $msg + \"\\n- 'Cancel' GoZ export for this object.\";\n if (!areSameNames($objectName, $gozName))\n {\n\t $result = `confirmDialog -title \"GoZBrush Note:\\nMaya object and GoZ mesh have different names\" -message $msg\n\t\t -button \"Rename\" -button \"Relink\" -button \"Create\" -button \"Cancel\"\n\t\t -defaultButton \"Rename\" -cancelButton \"Cancel\" -dismissString \"Rename\"`;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t $result = `confirmDialog -title \"GoZBrush Note:\\nMaya object and GoZ mesh have different names\" -message $msg\n\t\t -button \"Rename\" -button \"Create\" -button \"Cancel\"\n\t\t -defaultButton \"Rename\" -cancelButton \"Cancel\" -dismissString \"Rename\"`;\n\t\t\t}\n if ($result == \"Cancel\")\n {\n return 0;\n }\n else if ($result == \"Rename\")\n {\n rename $objectName $oldGoZName;\n $selObjects[$selIndex] = $oldGoZName;\n $objectName = $oldGoZName;\n $gozName = $oldGoZName;\n }\n else if ($result == \"Relink\")\n {\n\t setAttr -type \"string\" ($objectName + \".GoZBrushID\") ($objectName);\n $gozName = $objectName;\n }\n else if ($result == \"Create\")\n {\n setAttr -type \"string\" ($objectName + \".GoZBrushID\") ($gozName);\n\t\t\t\tif (!areSameNames($objectName, $gozName))\n\t\t\t\t{\n\t\t\t rename $objectName $gozName;\n\t\t $selObjects[$selIndex] = $gozName;\n\t $objectName = $gozName;\n\t\t\t\t}\n }\n/*\n setAttr -type \"string\" ($objectName + \".GoZBrushID\") ($gozName);\n printDebug(\" GoZBrushID is not valid(object is a copy or was renamed) - new GoZBrushID created = \" + $gozName);\n*/\n // If previous ID still exists, copy maps from previous ID to new ID.\n\t\t if (!areSameNames($gozName, $oldGoZName))\n\t\t {\n\t\t }\n else if (`file -q -exists $ztnFileName`)\n {\n printDebug(\" The previous ZTN file still exists: copy the maps from previous GoZBrushID to new one!\");\n string $sourcePath;\n string $targetPath;\n\n // copy normal map\n $sourcePath = $GoZProjectPath+ $oldGoZName + \"_NM.tif\";\n $targetPath = $GoZProjectPath+ $gozName + \"_NM.tif\";\n if (`file -q -exists $sourcePath`)\n {\n sysFile -copy $targetPath $sourcePath;\n }\n\n // copy displacement map\n $sourcePath = $GoZProjectPath+ $oldGoZName + \"_DM.tif\";\n $targetPath = $GoZProjectPath+ $gozName + \"_DM.tif\";\n if (`file -q -exists $sourcePath`)\n {\n sysFile -copy $targetPath $sourcePath;\n }\n\n // copy texture map\n $sourcePath = $GoZProjectPath+ $oldGoZName + \"_TXTR.tif\";\n $targetPath = $GoZProjectPath+ $gozName + \"_TXTR.tif\";\n if (`file -q -exists $sourcePath`)\n {\n sysFile -copy $targetPath $sourcePath;\n }\n } // End of if (`file -q -exists $ztnFileName`)\n\n // Creates an empty ZTN file.\n $ztnFileName = $GoZProjectPath + $gozName + \".ztn\";\n $fileId = `fopen $ztnFileName \"w\"`;\n fclose $fileId;\n } // End of if (!isRightGoZID($objectName, $gozName))\n\n // If the GoZBrushID is the right one, verifies that the ZTN file still exists.\n // If not, creates an empty one.\n else if (!`file -q -exists $ztnFileName`)\n {\n // Creates an empty ZTN file.\n $fileId = `fopen $ztnFileName \"w\"`;\n fclose $fileId;\n }\n } // End of if (`attributeQuery -node $objectName -ex \"GoZBrushID\"`)\n // The object does NOT have any GoZBrushID attribute.\n else\n {\n string $objectHistory[];\n string $historyName;\n int\t $objectHistoryCount;\n int\t $objectHistoryIndex;\n printDebug(\" No GoZBrushID found... search in the history for any GoZBrushID\");\n\n // Search in the object history for a GoZ object.\n $gozName = \"\";\n $objectHistory = `listHistory $objectName`;\n $objectHistoryCount = `size($objectHistory)`;\n for ($objectHistoryIndex=0; $objectHistoryIndex<$objectHistoryCount; $objectHistoryIndex++)\n {\n $historyName = $objectHistory[$objectHistoryIndex];\n if (`attributeQuery -node $historyName -ex \"GoZBrushID\"`)\n {\n $gozName = getAttr($historyName + \".GoZBrushID\");\n $ztnFileName = $GoZProjectPath + $gozName + \".ztn\";\n if (`file -q -exists $ztnFileName`)\n {\n string $msg;\n string $result;\n printDebug(\" Found a GoZ object in the history: \" + $historyName + \" --- GoZBrushID = \" + $gozName);\n\n // Found a GoZ object in the construction history: asks the user if we change the object name to GoZ one or not.\n $msg = \"The object \\\"\" + $objectName + \"\\\" is a descendant of \\\"\" + $historyName + \".GoZBrushID\\\".\";\n $msg = $msg + \"\\n\\nPress OK to restore the original GoZ name \\\"\" + $gozName + \"\\\" and send the modified mesh to ZBrush for remapping.\";\n $result = `confirmDialog -title \"GoZBrush Note\" -message $msg\n -button \"OK\" -button \"Cancel\" -defaultButton \"OK\"\n -cancelButton \"Cancel\" -dismissString \"OK\"`;\n if ($result == \"Cancel\")\n {\n $gozName = \"\";\n break;\n //return 0;\n }\n\n // \"Move\" the GoZBrushID attribute from the history object to selected object,\n // and rename the selected object to the ZTN file name.\n // Note: compared to previous version, the history is NOT destroyed(not needed).\n deleteAttr($historyName + \".GoZBrushID\");\n addAttr -ln \"GoZBrushID\" -nn \"GoZBrushID\" -dt \"string\" $objectName;\n setAttr -type \"string\" ($objectName + \".GoZBrushID\") ($gozName);\n rename $objectName $gozName;\n $selObjects[$selIndex] = $gozName;\n $objectName = $gozName;\n break;\n } // End of if (`file -q -exists $ztnFileName`)\n\n else\n {\n deleteAttr($objectHistory[$objectHistoryIndex] + \".GoZBrushID\");\n $gozName = \"\";\n }\n } // End of if ( `attributeQuery -node $objectHistory[$objectHistoryIndex] -ex \"GoZBrushID\"` )\n } // End of for ( $objectHistoryIndex=0; $objectHistoryIndex<$objectHistoryCount ; $objectHistoryIndex++)\n\n // If no valid GoZ object was found in the history, create a new GoZ ID.\n if ($gozName == \"\")\n {\n $gozName = createGoZID($objectName);\n\n if (!areSameNames($objectName, $gozName))\n {\n\t\t\t printDebug(\" A GoZMesh \\\"\" + $objectName + \"\\\" already exist => ask the user what to do\");\n\t string $msg;\n\t string $title;\n\t\t string $result;\n\t\t $msg = \"This object is not linked to any GoZ mesh yet,\";\n\t\t $msg = $msg + \"\\nbut there is already an existing GoZ mesh \\\"\" + $objectName + \"\\\".\";\n\t $msg = $msg + \"\\nGoZ requires the same name for object and GoZ mesh.\";\n\t $msg = $msg + \"\\nWhat do you want do do?\";\n\t $msg = $msg + \"\\n\\n- 'Relink' object to existing GoZ mesh \\\"\" + $objectName + \"\\\".\";\n\t $msg = $msg + \"\\n- 'Create' a new GoZ mesh \\\"\" + $gozName + \"\\\" for this object.\";\n\t $msg = $msg + \"\\n (object will be renamed to \\\"\" + $gozName + \"\\\".)\";\n\t $msg = $msg + \"\\n- 'Cancel' GoZ export for this object.\";\n\t $title = \"GoZBrush Note:\\nCreate a GoZ mesh for the object \\\"\" + $objectName + \"\\\"\";\n\t $result = `confirmDialog -title $title -message $msg\n\t\t -button \"Relink\" -button \"Create\" -button \"Cancel\"\n\t\t -defaultButton \"Create\" -cancelButton \"Cancel\" -dismissString \"Create\"`;\n\t if ($result == \"Cancel\")\n\t {\n\t\t return 0;\n\t\t }\n\t else if ($result == \"Relink\")\n\t\t {\n\t\t addAttr -ln \"GoZBrushID\" -nn \"GoZBrushID\" -dt \"string\" $objectName;\n\t\t\t setAttr -type \"string\" ($objectName + \".GoZBrushID\") ($objectName);\n\t\t\t\t $gozName = $objectName;\n\t\t\t\t}\n\t\t\t\telse if ($result == \"Create\")\n\t\t\t\t{\n\t\t addAttr -ln \"GoZBrushID\" -nn \"GoZBrushID\" -dt \"string\" $objectName;\n\t\t\t\t\tsetAttr -type \"string\" ($objectName + \".GoZBrushID\") ($gozName);\n\t\t\t rename $objectName $gozName;\n\t\t $selObjects[$selIndex] = $gozName;\n\t $objectName = $gozName;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\telse\n\t\t\t{\n\t addAttr -ln \"GoZBrushID\" -nn \"GoZBrushID\" -dt \"string\" $objectName;\n\t\t\t\tsetAttr -type \"string\" ($objectName + \".GoZBrushID\") ($gozName);\n\t\t\t}\n\n // Creates an empty ZTN file.\n $ztnFileName = $GoZProjectPath + $gozName + \".ztn\";\n $fileId = `fopen $ztnFileName \"w\"`;\n fclose $fileId;\n printDebug(\" nothing found in the history, create GoZBrushID\\\"\" + $gozName + \"\\\"\");\n }\n } // End of else of if (`attributeQuery -node $objectName -ex \"GoZBrushID\"`)\n\n // All is fine now regarding the GoZBrushID, next step is exporting the object to a Maya file.\n printDebug(\" Exporting object \\\"\" + $objectName + \"\\\" to \\\"\" + $gozName + \".GoZ\\\"\");\n\n // To avoid parametric object descriptions and any other unsupported shapes, first of all delete the construction history.\n // As a result, the object will become a basic mesh.\n delete -ch $objectName;\n makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 $objectName;\n delete -ch $objectName;\n\n // Selects only the object so that it can be exported \"alone\".\n select -r $objectName;\n\n // Then exports it to a Maya file.\n $maFileName = $GoZProjectPath + $gozName + \".GoZ\"; //$maFileName = $GoZProjectPath + $gozName + \".ma\"; /////TODO eliminate the .ma //++\n $maGoZName = $GoZProjectPath + $gozName;\n sysFile -delete $maFileName;\n gozMaya -o $maGoZName; //////file -op \"v=0\" -typ \"mayaAscii\" -es $maFileName; //TODO: This is where the Raul's GoZMaya new Plugin is called \n \n // Then reselects all the objects previously selected.\n select -r $selObjects;\n\n // Appends the GoZ object to the GoZ object list.\n $gozPath = $GoZProjectPath + $gozName;\n $fileName = $GoZPublicPath + \"GoZBrush/GoZ_ObjectList.txt\";\n $fileId = `fopen $fileName \"a\"`;\n fprint $fileId $gozPath;\n fprint $fileId \"\\n\";\n fclose $fileId;\n printDebug(\" Object path is \\\"\" + $gozPath + \"\\\"\");\n\n return 1;\n}\n\n\n// ------------------------------------------\n// Export one or several meshes to ZBrush...\nprintDebug(\"GoZ Maya >>> ZBrush\");\n\n// Misc local initializations.\nstring $fileName;\nint $selObjectCount;\nint $fileId;\nint $exportCount;\n\n// Gets the path where to export Maya files.\n$fileName = $GoZPublicPath + \"GoZBrush/GoZ_ProjectPath.txt\";\n$fileId = `fopen $fileName \"r\"`;\n$GoZProjectPath = `fread $fileId $GoZProjectPath`;\nfclose $fileId;\n\n// Set the object selection mode and get all selected objects.\nSelectTool;\nchangeSelectMode -component;\nchangeSelectMode -object;\n$selObjects = `ls -selection -shortNames -dagObjects -transforms`; // -tail 1`;\n$selObjectCount = `size($selObjects)`;\n\n// Clears the GoZ object list.\n$fileName = $GoZPublicPath + \"GoZBrush/GoZ_ObjectList.txt\";\n$fileId = `fopen $fileName \"w\"`;\nfclose $fileId;\n\n// Exports all selected objects.\nprintDebug(\"GoZ start exporting \" + $selObjectCount + \" selected objects:\");\n$exportCount = 0;\nfor ($selObjectIndex=0; $selObjectIndex<$selObjectCount; $selObjectIndex++)\n $exportCount += exportGoZObject($selObjectIndex);\nprintDebug($exportCount + \" GoZ objects were exported!\");\n\n// If no object was exported, shows up a dialog to ask the user to select a mesh to GoZBrush.\nif ($exportCount == 0)\n{\n confirmDialog -title \"GoZBrush Note\" -message \"No mesh was exported!\\nPlease, select a mesh to GoZBrush.\" -button \"OK\" -defaultButton \"OK\";\n}\n\n// Otherwise(at least 1 object was exported), GoZee to ZBrush.\nelse\n{\n // Sets the right application id(Maya).\n $fileName = $GoZPublicPath + \"GoZBrush/GoZ_Application.txt\";\n $fileId = `fopen $fileName \"w\"`;\n fprint $fileId \"Maya\";\n fclose $fileId;\n\n // Launch GoZBrush application.\n $fileName = $GoZPublicPath + \"GoZBrush/GoZBrushFromApp\" + $GoZAppExt;\n launchApp($fileName);\n}\n\n" 
-sourceType "mel" 
-doubleClickCommand "// ------------------------------------------\n//\tGoZBrush from Maya script\n// ------------------------------------------\n\n\n// ------------------------------------------\n// Global variables.\nglobal string $GoZPublicPath = \"C:/Users/Public/Pixologic/\";\nglobal string $GoZAppExt = \".exe\";\nglobal string $GoZProjectPath;\nglobal int $GoZDebugON = 0;\nglobal string $gFileBaseName = \"\";\nglobal int $gFileOccurrence = 0;\nglobal string $selObjects[];\n\n\n// ------------------------------------------\n// Launch an application.\n// Code is different depending on PC/Mac.\nglobal proc launchApp(string $path)\n{\n // On Windows:\n system($path);\n\n // On MacOSX:\n //system(\"open -a \\\"\"+$path+\"\\\"\");\n}\n\n\n// ------------------------------------------\n// Debug purpose...\nglobal proc printDebug(string $text)\n{\n global int $GoZDebugON;\n if ($GoZDebugON)\n {\n print($text+\"\\n\");\n }\n}\n\n// Requires the plugin gozMaya loaded.---------------- //++\nif (`pluginInfo -query -loaded -name \"gozMaya\"`==0){\n loadPlugin \"gozMaya\"; \n}\n\n// ------------------------------------------\n// Decompose a fileName into [$gFileBaseName][$gFileOccurrence],\n// where [$gFileBaseName] is text and $gFileOccurrence is an integer.\n// For example, decompose \"myFile25\" into (\"myFile\", 26)\nglobal proc decomposeFileName(string $fileName)\n{\n global string $gFileBaseName;\n global int $gFileOccurrence;\n\n int $index;\n int $count;\n string $car;\n\n $count = size($fileName);\n for ($index=$count; $index>0; $index--)\n {\n $car = `substring $fileName $index $index`;\n $car = `match \"[0-9]\" $car`;\n if ($car == \"\")\n break;\n }\n\n if ($index == $count)\n {\n $gFileBaseName = $fileName;\n $gFileOccurrence = 0;\n }\n else\n {\n if ($index > 0)\n $gFileBaseName = `substring $fileName 1 $index`;\n else\n $gFileBaseName = \"\";\n $index++;\n $car = `substring $fileName $index $count`;\n $gFileOccurrence = $car;\n }\n}\n\n\n// ------------------------------------------\n// Tests if a GoZ name matches an object name.\n// The test is performed using decomposition of both names(see decomposeFileName).\n// The GoZ name matches the object name if and only if:\n// 1- both names decomposition have the same base name\n// 2- the occurence of GoZ name is greater or equal to the occcurrence of object name.\n// For example, for object name \"myFile25\":\n// - \"myFile25\" and \"myFile48\" are valid GoZ names,\n// - \"myFile24\" and \"toto_en_short\" are NOT valid GoZ names!\nglobal proc int areSameNames(string $objectName, string $objectGoZName)\n{\n string $objName = `tolower $objectName`;\n string $gozName = `tolower $objectGoZName`;\n if ($objName == $gozName)\n return 1;\n return 0;\n/*\n global string $gFileBaseName;\n global int $gFileOccurrence;\n\n string $objectGoZBaseName;\n int $objectGoZOccurrence;\n string $objectBaseName;\n int $objectOccurrence;\n\n decomposeFileName($objectGoZName);\n $objectGoZBaseName = `tolower $gFileBaseName`;\n $objectGoZOccurrence = $gFileOccurrence;\n\n decomposeFileName($objectName);\n $objectBaseName = `tolower $gFileBaseName`;\n $objectOccurrence = $gFileOccurrence;\n\n if ($objectBaseName != $objectGoZBaseName)\n return 0;\n if ($objectGoZOccurrence < $objectOccurrence)\n return 0;\n return 1;\n*/\n}\n\n\n// ------------------------------------------\n// Simulates a sleep of some milliseconds.\n// Note: as no sleep command is available, it waits \"actively\" for the amout of time...\nglobal proc sleep(float $delayInSecond)\n{\n float $startTime;\n float $ellapsedTime;\n $startTime = `timerX`;\n $ellapsedTime = `timerX -st $ellapsedTime`;\n while ($ellapsedTime < $delayInSecond)\n {\n $ellapsedTime = `timerX -st $ellapsedTime`;\n }\n}\n\n\n// ------------------------------------------\n// Creates a new GoZ name based an an object name.\n// Creation is made using the GoZ utility \"GoZMakeObjectPath\",\n// which ensures that the GoZ name is unique.\n// Note: check if the GoZ name $name is unique consists on\n// checking ZTN files in \"/Users/Public/Pixologic/GoZProject/default/\",\n// and verify that the file $name.ztn does not exist in that folder.\n// IMPORTANT: It implies that to safely create several unique GoZ names,\n// the caller should create an empty ZTN file using the unique name it returns.\nglobal proc string createGoZID(string $objectName)\n{\n global string $GoZPublicPath;\n global string $GoZAppExt;\n\n string $fileName;\n string $path;\n int $fileId;\n float $startTime;\n float $ellapsedTime;\n float $delay;\n\n $fileName = $GoZPublicPath + \"GoZBrush/GoZ_ObjectPath.txt\";\n $fileId = `fopen $fileName \"w\"`;\n fprint $fileId $objectName;\n fclose $fileId;\n\n $fileName = $GoZPublicPath + \"GoZBrush/GoZMakeObjectPath\" + $GoZAppExt;\n launchApp($fileName);\n\n $fileName = $GoZPublicPath + \"GoZBrush/GoZ_ObjectPath.txt\";\n $startTime = `timerX`;\n $ellapsedTime = `timerX -st $startTime`;\n $delay = 0.02;\n while ($ellapsedTime < 2.0)\n {\n $fileId = `fopen $fileName \"r\"`;\n if ($fileId != 0)\n {\n $path = \"\";\n $path = `fread $fileId $path`;\n fclose $fileId;\n if (size($path) > size($objectName))\n {\n string $tokens[];\n int $tokenCount;\n $tokenCount = `tokenize $path \"/\\\\\" $tokens`;\n/*\n if ($tokenCount < 2)\n {\n printDebug(\" >>>> No token found in path \\\"\" + $path + \"\\\" <<<<\");\n return $objectName;\n }\n printDebug(\" >>>> \" + $tokenCount + \" tokens found in path \\\"\" + $path + \"\\\" <<<<\");\n*/\n $path = $tokens[$tokenCount-1];\n printDebug(\" >>>> Unique GoZ ID \\\"\" + $path + \"\\\" generated for object \\\"\" + $objectName + \"\\\" <<<<\");\n return $path;\n }\n }\n sleep($delay);\n $delay = 0.1;\n $ellapsedTime = `timerX -st $startTime`;\n }\n\n // If here, did not manage to find a valid path.\n // As such an error is not managed, just returns $objectName which will be overwrited.\n printDebug(\" >>>> No unique GoZ ID generated for object \\\"\" + $objectName + \"\\\" <<<<\");\n return $objectName;\n}\n\n\n// ------------------------------------------\n// Exports a GoZ object to ZBrush.\nglobal proc int exportGoZObject(int $selIndex)\n{\n global string $GoZPublicPath;\n global string $GoZProjectPath;\n global string $selObjects[];\n\n string $objectName = $selObjects[$selIndex];\n string $maFileName;\n string $ztnFileName;\n string $gozName;\n string $gozPath;\n string $validGoZName;\n string $fileName;\n int $fileId;\n printDebug(\" Exporting object \" + $objectName + \"...\");\n\n // The object already has a GoZBrushID attribute, which contains an ID of ZTN file.\n if (`attributeQuery -node $objectName -ex \"GoZBrushID\"`)\n {\n //select -r $objectName;\n $gozName = getAttr($objectName + \".GoZBrushID\");\n $ztnFileName = $GoZProjectPath + $gozName + \".ztn\";\n printDebug(\" Found GoZBrushID attribute = \" + $gozName);\n\n // There is an existing GoZ ID, but it does not match the object name.\n // This can occur either after a copy or a rename of the object.\n // In such a case, create a new GoZ ID matching the object name,\n // and copy maps from previous ID if it still exists.\n if (!areSameNames($objectName, $gozName))\n {\n // Stores previous GoZ ID.\n string $oldGoZName = $gozName;\n\n // Creates a new GoZ ID.\n $gozName = createGoZID($objectName);\n\n string $msg;\n string $result;\n printDebug(\" GoZBrush ID is invalid: --- ObjectName = \" + $objectName + \" --- GoZBrushID = \" + $oldGoZName + \" --- free GoZBrushID = \" + $gozName);\n\n $msg = \"The object \\\"\" + $objectName + \"\\\" is linked to GoZ mesh \\\"\" + $oldGoZName + \"\\\".\";\n $msg = $msg + \"\\nGoZ requires the same name for object and GoZ mesh.\";\n $msg = $msg + \"\\nWhat do you want do do?\";\n $msg = $msg + \"\\n\\n- 'Rename' object as \\\"\" + $oldGoZName + \"\\\".\";\n if (!areSameNames($objectName, $gozName))\n {\n\t $msg = $msg + \"\\n- 'Relink' object to existing GoZ mesh \\\"\" + $objectName + \"\\\".\";\n\t $msg = $msg + \"\\n- 'Create' a new GoZ mesh \\\"\" + $gozName + \"\\\" for this object.\";\n\t $msg = $msg + \"\\n (object will be renamed to \\\"\" + $gozName + \"\\\".)\";\n }\n else\n\t $msg = $msg + \"\\n- 'Create' a new GoZ mesh \\\"\" + $gozName + \"\\\" for this object.\";\n $msg = $msg + \"\\n- 'Cancel' GoZ export for this object.\";\n if (!areSameNames($objectName, $gozName))\n {\n\t $result = `confirmDialog -title \"GoZBrush Note:\\nMaya object and GoZ mesh have different names\" -message $msg\n\t\t -button \"Rename\" -button \"Relink\" -button \"Create\" -button \"Cancel\"\n\t\t -defaultButton \"Rename\" -cancelButton \"Cancel\" -dismissString \"Rename\"`;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t $result = `confirmDialog -title \"GoZBrush Note:\\nMaya object and GoZ mesh have different names\" -message $msg\n\t\t -button \"Rename\" -button \"Create\" -button \"Cancel\"\n\t\t -defaultButton \"Rename\" -cancelButton \"Cancel\" -dismissString \"Rename\"`;\n\t\t\t}\n if ($result == \"Cancel\")\n {\n return 0;\n }\n else if ($result == \"Rename\")\n {\n rename $objectName $oldGoZName;\n $selObjects[$selIndex] = $oldGoZName;\n $objectName = $oldGoZName;\n $gozName = $oldGoZName;\n }\n else if ($result == \"Relink\")\n {\n\t setAttr -type \"string\" ($objectName + \".GoZBrushID\") ($objectName);\n $gozName = $objectName;\n }\n else if ($result == \"Create\")\n {\n setAttr -type \"string\" ($objectName + \".GoZBrushID\") ($gozName);\n\t\t\t\tif (!areSameNames($objectName, $gozName))\n\t\t\t\t{\n\t\t\t rename $objectName $gozName;\n\t\t $selObjects[$selIndex] = $gozName;\n\t $objectName = $gozName;\n\t\t\t\t}\n }\n/*\n setAttr -type \"string\" ($objectName + \".GoZBrushID\") ($gozName);\n printDebug(\" GoZBrushID is not valid(object is a copy or was renamed) - new GoZBrushID created = \" + $gozName);\n*/\n // If previous ID still exists, copy maps from previous ID to new ID.\n\t\t if (!areSameNames($gozName, $oldGoZName))\n\t\t {\n\t\t }\n else if (`file -q -exists $ztnFileName`)\n {\n printDebug(\" The previous ZTN file still exists: copy the maps from previous GoZBrushID to new one!\");\n string $sourcePath;\n string $targetPath;\n\n // copy normal map\n $sourcePath = $GoZProjectPath+ $oldGoZName + \"_NM.tif\";\n $targetPath = $GoZProjectPath+ $gozName + \"_NM.tif\";\n if (`file -q -exists $sourcePath`)\n {\n sysFile -copy $targetPath $sourcePath;\n }\n\n // copy displacement map\n $sourcePath = $GoZProjectPath+ $oldGoZName + \"_DM.tif\";\n $targetPath = $GoZProjectPath+ $gozName + \"_DM.tif\";\n if (`file -q -exists $sourcePath`)\n {\n sysFile -copy $targetPath $sourcePath;\n }\n\n // copy texture map\n $sourcePath = $GoZProjectPath+ $oldGoZName + \"_TXTR.tif\";\n $targetPath = $GoZProjectPath+ $gozName + \"_TXTR.tif\";\n if (`file -q -exists $sourcePath`)\n {\n sysFile -copy $targetPath $sourcePath;\n }\n } // End of if (`file -q -exists $ztnFileName`)\n\n // Creates an empty ZTN file.\n $ztnFileName = $GoZProjectPath + $gozName + \".ztn\";\n $fileId = `fopen $ztnFileName \"w\"`;\n fclose $fileId;\n } // End of if (!isRightGoZID($objectName, $gozName))\n\n // If the GoZBrushID is the right one, verifies that the ZTN file still exists.\n // If not, creates an empty one.\n else if (!`file -q -exists $ztnFileName`)\n {\n // Creates an empty ZTN file.\n $fileId = `fopen $ztnFileName \"w\"`;\n fclose $fileId;\n }\n } // End of if (`attributeQuery -node $objectName -ex \"GoZBrushID\"`)\n // The object does NOT have any GoZBrushID attribute.\n else\n {\n string $objectHistory[];\n string $historyName;\n int\t $objectHistoryCount;\n int\t $objectHistoryIndex;\n printDebug(\" No GoZBrushID found... search in the history for any GoZBrushID\");\n\n // Search in the object history for a GoZ object.\n $gozName = \"\";\n $objectHistory = `listHistory $objectName`;\n $objectHistoryCount = `size($objectHistory)`;\n for ($objectHistoryIndex=0; $objectHistoryIndex<$objectHistoryCount; $objectHistoryIndex++)\n {\n $historyName = $objectHistory[$objectHistoryIndex];\n if (`attributeQuery -node $historyName -ex \"GoZBrushID\"`)\n {\n $gozName = getAttr($historyName + \".GoZBrushID\");\n $ztnFileName = $GoZProjectPath + $gozName + \".ztn\";\n if (`file -q -exists $ztnFileName`)\n {\n string $msg;\n string $result;\n printDebug(\" Found a GoZ object in the history: \" + $historyName + \" --- GoZBrushID = \" + $gozName);\n\n // Found a GoZ object in the construction history: asks the user if we change the object name to GoZ one or not.\n $msg = \"The object \\\"\" + $objectName + \"\\\" is a descendant of \\\"\" + $historyName + \".GoZBrushID\\\".\";\n $msg = $msg + \"\\n\\nPress OK to restore the original GoZ name \\\"\" + $gozName + \"\\\" and send the modified mesh to ZBrush for remapping.\";\n $result = `confirmDialog -title \"GoZBrush Note\" -message $msg\n -button \"OK\" -button \"Cancel\" -defaultButton \"OK\"\n -cancelButton \"Cancel\" -dismissString \"OK\"`;\n if ($result == \"Cancel\")\n {\n $gozName = \"\";\n break;\n //return 0;\n }\n\n // \"Move\" the GoZBrushID attribute from the history object to selected object,\n // and rename the selected object to the ZTN file name.\n // Note: compared to previous version, the history is NOT destroyed(not needed).\n deleteAttr($historyName + \".GoZBrushID\");\n addAttr -ln \"GoZBrushID\" -nn \"GoZBrushID\" -dt \"string\" $objectName;\n setAttr -type \"string\" ($objectName + \".GoZBrushID\") ($gozName);\n rename $objectName $gozName;\n $selObjects[$selIndex] = $gozName;\n $objectName = $gozName;\n break;\n } // End of if (`file -q -exists $ztnFileName`)\n\n else\n {\n deleteAttr($objectHistory[$objectHistoryIndex] + \".GoZBrushID\");\n $gozName = \"\";\n }\n } // End of if ( `attributeQuery -node $objectHistory[$objectHistoryIndex] -ex \"GoZBrushID\"` )\n } // End of for ( $objectHistoryIndex=0; $objectHistoryIndex<$objectHistoryCount ; $objectHistoryIndex++)\n\n // If no valid GoZ object was found in the history, create a new GoZ ID.\n if ($gozName == \"\")\n {\n $gozName = createGoZID($objectName);\n\n if (!areSameNames($objectName, $gozName))\n {\n\t\t\t printDebug(\" A GoZMesh \\\"\" + $objectName + \"\\\" already exist => ask the user what to do\");\n\t string $msg;\n\t string $title;\n\t\t string $result;\n\t\t $msg = \"This object is not linked to any GoZ mesh yet,\";\n\t\t $msg = $msg + \"\\nbut there is already an existing GoZ mesh \\\"\" + $objectName + \"\\\".\";\n\t $msg = $msg + \"\\nGoZ requires the same name for object and GoZ mesh.\";\n\t $msg = $msg + \"\\nWhat do you want do do?\";\n\t $msg = $msg + \"\\n\\n- 'Relink' object to existing GoZ mesh \\\"\" + $objectName + \"\\\".\";\n\t $msg = $msg + \"\\n- 'Create' a new GoZ mesh \\\"\" + $gozName + \"\\\" for this object.\";\n\t $msg = $msg + \"\\n (object will be renamed to \\\"\" + $gozName + \"\\\".)\";\n\t $msg = $msg + \"\\n- 'Cancel' GoZ export for this object.\";\n\t $title = \"GoZBrush Note:\\nCreate a GoZ mesh for the object \\\"\" + $objectName + \"\\\"\";\n\t $result = `confirmDialog -title $title -message $msg\n\t\t -button \"Relink\" -button \"Create\" -button \"Cancel\"\n\t\t -defaultButton \"Create\" -cancelButton \"Cancel\" -dismissString \"Create\"`;\n\t if ($result == \"Cancel\")\n\t {\n\t\t return 0;\n\t\t }\n\t else if ($result == \"Relink\")\n\t\t {\n\t\t addAttr -ln \"GoZBrushID\" -nn \"GoZBrushID\" -dt \"string\" $objectName;\n\t\t\t setAttr -type \"string\" ($objectName + \".GoZBrushID\") ($objectName);\n\t\t\t\t $gozName = $objectName;\n\t\t\t\t}\n\t\t\t\telse if ($result == \"Create\")\n\t\t\t\t{\n\t\t addAttr -ln \"GoZBrushID\" -nn \"GoZBrushID\" -dt \"string\" $objectName;\n\t\t\t\t\tsetAttr -type \"string\" ($objectName + \".GoZBrushID\") ($gozName);\n\t\t\t rename $objectName $gozName;\n\t\t $selObjects[$selIndex] = $gozName;\n\t $objectName = $gozName;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\telse\n\t\t\t{\n\t addAttr -ln \"GoZBrushID\" -nn \"GoZBrushID\" -dt \"string\" $objectName;\n\t\t\t\tsetAttr -type \"string\" ($objectName + \".GoZBrushID\") ($gozName);\n\t\t\t}\n\n // Creates an empty ZTN file.\n $ztnFileName = $GoZProjectPath + $gozName + \".ztn\";\n $fileId = `fopen $ztnFileName \"w\"`;\n fclose $fileId;\n printDebug(\" nothing found in the history, create GoZBrushID\\\"\" + $gozName + \"\\\"\");\n }\n } // End of else of if (`attributeQuery -node $objectName -ex \"GoZBrushID\"`)\n\n // All is fine now regarding the GoZBrushID, next step is exporting the object to a Maya file.\n printDebug(\" Exporting object \\\"\" + $objectName + \"\\\" to \\\"\" + $gozName + \".GoZ\\\"\");\n\n // To avoid parametric object descriptions and any other unsupported shapes, first of all delete the construction history.\n // As a result, the object will become a basic mesh.\n delete -ch $objectName;\n makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 $objectName;\n delete -ch $objectName;\n\n // Selects only the object so that it can be exported \"alone\".\n select -r $objectName;\n\n // Then exports it to a Maya file.\n $maFileName = $GoZProjectPath + $gozName + \".GoZ\"; //$maFileName = $GoZProjectPath + $gozName + \".ma\"; /////TODO eliminate the .ma //++\n $maGoZName = $GoZProjectPath + $gozName;\n sysFile -delete $maFileName;\n gozMaya -o $maGoZName; //////file -op \"v=0\" -typ \"mayaAscii\" -es $maFileName; //TODO: This is where the Raul's GoZMaya new Plugin is called \n \n // Then reselects all the objects previously selected.\n select -r $selObjects;\n\n // Appends the GoZ object to the GoZ object list.\n $gozPath = $GoZProjectPath + $gozName;\n $fileName = $GoZPublicPath + \"GoZBrush/GoZ_ObjectList.txt\";\n $fileId = `fopen $fileName \"a\"`;\n fprint $fileId $gozPath;\n fprint $fileId \"\\n\";\n fclose $fileId;\n printDebug(\" Object path is \\\"\" + $gozPath + \"\\\"\");\n\n return 1;\n}\n\n\n// ------------------------------------------\n// Export one or several meshes to ZBrush...\nprintDebug(\"GoZ Maya >>> ZBrush\");\n\n// Misc local initializations.\nstring $fileName;\nint $selObjectCount;\nint $fileId;\nint $exportCount;\n\n// Gets the path where to export Maya files.\n$fileName = $GoZPublicPath + \"GoZBrush/GoZ_ProjectPath.txt\";\n$fileId = `fopen $fileName \"r\"`;\n$GoZProjectPath = `fread $fileId $GoZProjectPath`;\nfclose $fileId;\n\n// Set the object selection mode and get all selected objects.\nSelectTool;\nchangeSelectMode -component;\nchangeSelectMode -object;\n$selObjects = `ls -selection -shortNames -dagObjects -transforms`; // -tail 1`;\n$selObjectCount = `size($selObjects)`;\n\n// Clears the GoZ object list.\n$fileName = $GoZPublicPath + \"GoZBrush/GoZ_ObjectList.txt\";\n$fileId = `fopen $fileName \"w\"`;\nfclose $fileId;\n\n// Exports all selected objects.\nprintDebug(\"GoZ start exporting \" + $selObjectCount + \" selected objects:\");\n$exportCount = 0;\nfor ($selObjectIndex=0; $selObjectIndex<$selObjectCount; $selObjectIndex++)\n $exportCount += exportGoZObject($selObjectIndex);\nprintDebug($exportCount + \" GoZ objects were exported!\");\n\n// If no object was exported, shows up a dialog to ask the user to select a mesh to GoZBrush.\nif ($exportCount == 0)\n{\n confirmDialog -title \"GoZBrush Note\" -message \"No mesh was exported!\\nPlease, select a mesh to GoZBrush.\" -button \"OK\" -defaultButton \"OK\";\n}\n\n// Otherwise(at least 1 object was exported), GoZee to ZBrush.\nelse\n{\n // Sets the right application id(Maya).\n $fileName = $GoZPublicPath + \"GoZBrush/GoZ_Application.txt\";\n $fileId = `fopen $fileName \"w\"`;\n fprint $fileId \"Maya\";\n fclose $fileId;\n\n // Launch GoZBrush application.\n $fileName = $GoZPublicPath + \"GoZBrush/GoZBrushFromApp\" + $GoZAppExt;\n launchApp($fileName);\n}\n\n" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "/******************************** Measure Tools - v1.2 *********..." 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "/******************************** Measure Tools - v1.2 *********..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/K_MeasureTool_SHELF_ICON.png" 
-image1 "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/K_MeasureTool_SHELF_ICON.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "/******************************** Measure Tools - v1.2 ***************************************\n\n ________________________________________\n | |\n | Script done by: Klaudio Ladavac |\n | Contact email : klaudio2u@gmail.com |\n |________________________________________|\n\n\nRELEASE NOTES\n\n >> v1.2 - release date: 15.02.2018\n - NEW - Option to delete only selected Distance Tool\n - NEW - Option to select Locators of selected Distance tool or all in the scene - used to \n scale Locators appropriately and as needed. \n - UPDATE - Distance Tool now always create 2 locators when previous tools added and new one \n share the same vertice\n - UPDATE - UI Refresh\n\n\n >> v1.1 - release date: 08.06.2017\n - NEW - option to choose whether new created Distance Tool will be a constraint to selected \n vertices or just position new Distance Tool on selected vertices without constraints. \n\n\n >> v1.0 - release date: 07.02.2017\n - initial release\n \n\n***********************************************************************************************/\n\nif ( `window -exists UnitConvert` ) {\n deleteUI UnitConvert; }\n \nwindow -tlb 1 -t \"Measure Tools\" UnitConvert;\ncolumnLayout;\n \n // main menus\n string $menuBarLayoutMt = `menuBarLayout mainMt`;\n menu -label \"Options\" -parent mainMt -to 1 optionsMT;\n menuItem -divider true -dividerLabel \"Locators Selection\";\n menuItem -label \"Selected \" -c \"locFromSelected\" selectedMt;\n menuItem -label \"Global \" -c \"locGlobalSelect\" allMT;\n menu -label \"Help\" -parent mainMt -to 1 helpMT;\n menuItem -divider true -dividerLabel \"Tutorials (Vimeo)\";\n menuItem -label \"Features Overview - v 1.0\" -c \"getTutsVimeo1\";\n menuItem -label \"What's New - v 1.1\" -c \"getTutsVimeo2\";\n menuItem -label \"What's New - v 1.2\" -c \"getTutsVimeo3\";\n menuItem -divider true -dividerLabel \"Maya Scripts\";\n menuItem -label \"Gumroad\" -c \"scriptsGumroad\";\n menuItem -divider true -dividerLabel \"Contact\"; \n menuItem -label \"Facebook\" -c \"webFacebook\"; \n menuItem -label \"ArtStation (portfolio)\" -c \"webArtStation\"; \n menuItem -divider true -dividerLabel \"E-Mail\";\n menuItem -label \"klaudio2u@gmail.com\" -c (\"warning -n \\\" > CTRL+C and copy E-Mail to clipboard >>> klaudio2u@gmail.com\\\"\"); \n \n separator -height 1 -style \"none\";\n \n // Measure Tools\n formLayout -h 34 -w 285 -numberOfDivisions 100 distanceCheck; \n text -label \"\" -al \"left\" -h 2 -w 286 -backgroundColor 0.25 0.25 0.25 bkgColorLine; \n text -label \"\" -al \"left\" -h 36 -w 286 -backgroundColor 0.25 0.25 0.25 bkgColorMDtools; \n textField -bgc 0.22 0.22 0.22 -ed true -h 26 -w 110 -pht \"< Select verts ...\" -font \"boldLabelFont\" distanceFiled;\n iconTextButton -image1 \"K_MeasureTool.png\" -c \"distanceToolSelVert\" -rpt 1 distanceBUtton;\n iconTextButton -image1 \"K_MeasureTool2.png\" -c \"distanceToolVert\" -rpt 1 distanceToolBUtton;\n iconTextButton -image1 \"K_MeasureTool_ClearAll.png\" -c \"clearAllDistanceTools\" clearAllBUtton;\n popupMenu -p clearAllBUtton;\n menuItem -l \"Delete Selected\" -image \"closeAttribute.png\" -c \"clearSelectedDistance\";\n\n iconTextCheckBox -v 1 -st \"iconOnly\" -w 20 -h 26 -mw 0 -mh 0 -i1 \"K_MeasureTool_Const.png\" constrainOnOff; \n \n formLayout -edit\n -attachForm bkgColorLine \"top\" 0 -attachForm bkgColorLine \"left\" 1\n -attachForm bkgColorMDtools \"top\" 4 -attachForm bkgColorMDtools \"left\" 1\n -attachForm distanceBUtton \"top\" 9 -attachForm distanceBUtton \"left\" 6\n -attachForm distanceToolBUtton \"top\" 9 -attachForm distanceToolBUtton \"left\" 175\n -attachForm distanceFiled \"top\" 10 -attachForm distanceFiled \"left\" 53\n -attachForm constrainOnOff \"top\" 10 -attachForm constrainOnOff \"left\" 221\n -attachForm clearAllBUtton \"top\" 9 -attachForm clearAllBUtton \"left\" 250\n distanceCheck;\n setParent ..; \n \n columnLayout;\n separator -height 4 -style \"none\";\n setParent ..;\n \n // Unit convert\n formLayout -h 117 -w 285 -numberOfDivisions 100 slicerOrient2; \n text -label \"\" -al \"left\" -h 115-w 286 -backgroundColor 0.25 0.25 0.25 bkgColorMDunits;\n text -label \"Units Convert\" -al \"left\" -fn \"smallPlainLabelFont\" txtColorMDunits;\n iconTextRadioCollection itRadCollect; \n iconTextRadioButton -st \"iconOnly\" -w 46 -h 14 -mw 0 -mh 0 -i1 \"K_MeasureTool_mm.png\" -onc \"mmLayout\" orientXplus; \n iconTextRadioButton -st \"iconOnly\" -w 46 -h 14 -mw 0 -mh 0 -i1 \"K_MeasureTool_cm.png\" -onc \"cmLayout\" orientXplus2; \n iconTextRadioButton -sl -st \"iconOnly\" -w 46 -h 14 -mw 0 -mh 0 -i1 \"K_MeasureTool_m.png\" -onc \"mLayout\" orientXplus3; \n \n // inch > meter\n text -l \" Inches \" labelInches;\n floatField -pre 3 -w 70 -cc \"inputInchesMeter\" inchesInput;\n text -l \" = \" labelEqual1;\n text -l \"Meter \" labelMeter1;\n floatField -pre 3 -w 70 -cc \"inputMeterInches\" meter1Input;\n // feet > meter\n text -l \" Feet \" labelFeet;\n floatField -pre 3 -w 70 -cc \"inputFeetMeter\" feetInput;\n text -l \" = \" labelEqual2;\n text -l \"Meter \" labelMeter2;\n floatField -pre 3 -w 70 -cc \"inputMeterFeet\" meter2Input; \n // yard > meter\n text -l \"Yards \" labelYards;\n floatField -pre 3 -w 70 -cc \"inputYardsMeter\" yardsInput;\n text -l \" = \" labelEqual3;\n text -l \"Meter \" labelMeter3;\n floatField -pre 3 -w 70 -cc \"inputMeterYards\" meter3Input; \n \n formLayout -edit\n -attachForm bkgColorMDunits \"top\" 1 -attachForm bkgColorMDunits \"left\" 1\n -attachForm txtColorMDunits \"top\" 3 -attachForm txtColorMDunits \"left\" 6\n -attachForm orientXplus \"top\" 12 -attachForm orientXplus \"left\" 128\n -attachForm orientXplus2 \"top\" 12 -attachForm orientXplus2 \"left\" 178\n -attachForm orientXplus3 \"top\" 12 -attachForm orientXplus3 \"left\" 228\n // inch > meter\n -attachForm inchesInput \"top\" 39 -attachForm inchesInput \"left\" 50\n -attachForm labelInches \"top\" 42 -attachForm labelInches \"left\" 8\n -attachForm labelEqual1 \"top\" 42 -attachForm labelEqual1 \"left\" 125\n -attachForm labelMeter1 \"top\" 42 -attachForm labelMeter1 \"left\" 171\n -attachForm meter1Input \"top\" 39 -attachForm meter1Input \"left\" 205\n // feet > meter\n -attachForm feetInput \"top\" 64 -attachForm feetInput \"left\" 50 \n -attachForm labelFeet \"top\" 67 -attachForm labelFeet \"left\" 19\n -attachForm labelEqual2 \"top\" 67 -attachForm labelEqual2 \"left\" 125\n -attachForm labelMeter2 \"top\" 67 -attachForm labelMeter2 \"left\" 171\n -attachForm meter2Input \"top\" 64 -attachForm meter2Input \"left\" 205 \n // yard > meter\n -attachForm yardsInput \"top\" 90 -attachForm yardsInput \"left\" 50\n -attachForm labelYards \"top\" 93 -attachForm labelYards \"left\" 19\n -attachForm labelEqual3 \"top\" 93 -attachForm labelEqual3 \"left\" 125\n -attachForm labelMeter3 \"top\" 93 -attachForm labelMeter3 \"left\" 171\n -attachForm meter3Input \"top\" 90 -attachForm meter3Input \"left\" 205 \n \n slicerOrient2; \n setParent ..;\n\nshowWindow UnitConvert;\nsetFocus UnitConvert;\n\n////////////////////////////////////////////////////\n // To Millimeters\n////////////////////////////////////////////////////\n\n// Inches > Millimeter\nproc inputInchesMilli()\n{\n float $getInputInch3 = `floatField -query -v inchesInput`;\n \n float $milliI = $getInputInch3 * 25.4;\n floatField -e -v $milliI meter1Input; \n}\n\n// Millimeter > Inches\nproc inputMilliInches()\n{\n float $getInputMilli1 = `floatField -query -v meter1Input`;\n \n float $inchesM = $getInputMilli1 * 0.03937008;\n floatField -e -v $inchesM inchesInput; \n}\n\n// Feet > Millimeter\nproc inputFeetMilli()\n{\n float $getInputFeet3 = `floatField -query -v feetInput`;\n\n float $milliF = $getInputFeet3 * 304.8;\n floatField -e -v $milliF meter2Input;\n \n}\n\n// Millimeter > Feet\nproc inputMilliFeet()\n{\n float $getInputMilli2 = `floatField -query -v meter2Input`;\n \n float $feetsM = $getInputMilli2 * 0.00328084;\n floatField -e -v $feetsM feetInput;\n \n}\n\n// Yards > Millimeter\nproc inputYardsMilli()\n{\n float $getInputYards3 = `floatField -query -v yardsInput`;\n\n float $milliY = $getInputYards3 * 914.4;\n floatField -e -v $milliY meter3Input;\n \n}\n\n// Millimeter > Yards\nproc inputMilliYards()\n{\n float $getInputMilli3 = `floatField -query -v meter3Input`;\n \n float $yardsM = $getInputMilli3 * 0.00109361;\n floatField -e -v $yardsM yardsInput;\n \n}\n\n////////////////////////////////////////////////////\n // To Centimeters\n////////////////////////////////////////////////////\n\n// Inches > Centimeter\nproc inputInchesCenti()\n{\n float $getInputInch2 = `floatField -query -v inchesInput`;\n \n float $centiI = $getInputInch2 * 2.54;\n floatField -e -v $centiI meter1Input; \n}\n\n// Centimeter > Inches\nproc inputCentiInches()\n{\n float $getInputCenti1 = `floatField -query -v meter1Input`;\n \n float $inchesC = $getInputCenti1 * 0.39370079;\n floatField -e -v $inchesC inchesInput; \n}\n\n// Feet > Centimeter\nproc inputFeetCenti()\n{\n float $getInputFeet2 = `floatField -query -v feetInput`;\n\n float $centiF = $getInputFeet2 * 30.48;\n floatField -e -v $centiF meter2Input;\n \n}\n\n// Centimeter > Feet\nproc inputCentiFeet()\n{\n float $getInputCenti2 = `floatField -query -v meter2Input`;\n \n float $feetsC = $getInputCenti2 * 0.0328084;\n floatField -e -v $feetsC feetInput;\n \n}\n\n// Yards > Centimeter\nproc inputYardsCenti()\n{\n float $getInputYards2 = `floatField -query -v yardsInput`;\n\n float $centiY = $getInputYards2 * 91.44;\n floatField -e -v $centiY meter3Input;\n \n}\n\n// Centimeter > Yards\nproc inputCentiYards()\n{\n float $getInputCenti3 = `floatField -query -v meter3Input`;\n \n float $yardsC = $getInputCenti3 * 0.01093613;\n floatField -e -v $yardsC yardsInput;\n \n}\n\n////////////////////////////////////////////////////\n // To Meters\n////////////////////////////////////////////////////\n\n// Inches > Meter\nproc inputInchesMeter()\n{\n float $getInputInch = `floatField -query -v inchesInput`;\n \n float $meterI = $getInputInch * 0.0254;\n floatField -e -v $meterI meter1Input; \n}\n\n// Meter > Inches\nproc inputMeterInches()\n{\n float $getInputMeter1 = `floatField -query -v meter1Input`;\n \n float $inchesM = $getInputMeter1 * 39.37007874;\n floatField -e -v $inchesM inchesInput; \n}\n\n// Feet > Meter\nproc inputFeetMeter()\n{\n float $getInputFeet = `floatField -query -v feetInput`;\n\n float $metersF = $getInputFeet * 0.3048;\n floatField -e -v $metersF meter2Input;\n \n}\n\n// Meter > Feet\nproc inputMeterFeet()\n{\n float $getInputMeter2 = `floatField -query -v meter2Input`;\n \n float $feetsM = $getInputMeter2 * 3.2808399;\n floatField -e -v $feetsM feetInput;\n \n}\n\n// Yards > Meter\nproc inputYardsMeter()\n{\n float $getInputYards = `floatField -query -v yardsInput`;\n\n float $metersY = $getInputYards * 0.9144;\n floatField -e -v $metersY meter3Input;\n \n}\n\n// Meter > Yards\nproc inputMeterYards()\n{\n float $getInputMeter3 = `floatField -query -v meter3Input`;\n \n float $yardsM = $getInputMeter3 * 1.0936133;\n floatField -e -v $yardsM yardsInput;\n \n}\n\n\n// Select Locator - from selected only\nproc locFromSelected()\n{\n string $saveArray_DT; \n string $locSel[];\n\n // get selected distance tools\n string $distToolSel[] = `ls -sl -tr`;\n \n // check if anything is selected\n if (size($distToolSel) == 0)\n {\n warning -n \" -- INFO -- Nothing is selected! Select one or more DISTANCE TOOLS!\"; \n return;\n }\n // check if correct objects are selected\n for ($h=0; $h < size($distToolSel); $h++ ) \n { \n if ( gmatch($distToolSel[$h], \"distanceDimension*\") != 1) \n {\n warning -n \" -- INFO -- Select first one or more DISTANCE TOOLS!\"; \n return;\n }\n } \n \n \n \n // get all and select the locators \n for ($eachDT in $distToolSel)\n {\n string $sel2[] = `listRelatives -s $eachDT`;\n string $fSelection[] = `listConnections -d 1 $sel2[0]`;\n \n $saveArray_DT += (\" \" + $fSelection[0] + \" \" + $fSelection[1]);\n }\n \n $locSel = stringToStringArray($saveArray_DT, \" \"); \n $saveArray_DT = \"\"; \n \n select -r $locSel;\n ScaleTool;\n}\n\n\n// Select locators - Global - all in the scene\nproc locGlobalSelect()\n{\n string $getAllDistanceNodesSel[] = `ls -type distanceDimShape`;\n\n string $getAllLocators[] = `listConnections -d 1 $getAllDistanceNodesSel`;\n select -r $getAllLocators; \n ScaleTool;\n}\n\n\n\n// Clear / Delete All Distance Tools\nproc clearAllDistanceTools()\n{\n string $getAllDistanceNodes[] = `ls -type distanceDimShape`;\n \n if (size ($getAllDistanceNodes) == 0 ) \n { \n warning -n \" -- INFO -- All ´Distance Tools` deleted! \"; \n return;\n }\n \n else \n {\n string $listAll[] = `listHistory $getAllDistanceNodes`; \n string $listAllTransforms[] = `listRelatives -p $listAll`; \n delete $listAllTransforms; \n } \n}\n\n\n// Clear / Delete SELECTED Distance Tools\nproc clearSelectedDistance()\n{\n // check is selected - it has to be only Distance Tools - else stop the command\n string $checkIfSelected[] = `ls -sl -fl`; \n // check if anything is selected\n if (size($checkIfSelected) == 0)\n {\n warning -n \" -- INFO -- Nothing is selected! Select one or more DISTANCE TOOLS to delete!\"; \n return;\n }\n\n // check if correct objects are selected\n for ($i=0; $i < size($checkIfSelected); $i++ ) \n { \n if ( gmatch($checkIfSelected[$i], \"distanceDimension*\") != 1) \n {\n warning -n \" -- INFO -- Select only one or more DISTANCE TOOLS to delete!\"; \n return;\n }\n } \n \n \n \n // get all and delete\n string $distToolsSel[] = `ls -sl -tr`;\n for ($eachD in $distToolsSel)\n {\n string $sel1[] = `listRelatives -s $eachD`;\n string $fSelection[] = `listConnections -d 1 $sel1[0]`;\n \n delete $eachD $fSelection;\n }\n\n}\n \n \n// Distance Measure\nproc distanceToolSelVert()\n{\n if (size (`ls -sl -fl`) == 2 ) \n {\n \n $selObjectM = `ls -hilite`; \n string $selVertices[] = `ls -sl -fl`;\n\n vector $a = `pointPosition -w $selVertices[0]`;\n vector $b = `pointPosition -w $selVertices[1]`;\n vector $mathVectors = $b - $a; \n float $lengthBetween = `mag $mathVectors`;\n \n textField -e -tx $lengthBetween distanceFiled; // Print distance between in field \n\n print \"Measure - Done!\"; \n } \n else \n {\n warning -n \" -- INFO -- Select only TWO vertices! \"; \n return; \n }\n\n}\n\n// Distance Tool\nproc distanceToolVert()\n{\n if (size (`ls -sl -fl`) == 2 ) \n {\n \n $selObject1 = `ls -hilite`; \n string $selLockVertices2[] = `ls -sl -fl`;\n \n // get position of selected vertices \n float $firstSelVerice1[] = `xform -q -t -ws $selLockVertices2[0]`;\n float $secondSelVerice1[] = `xform -q -t -ws $selLockVertices2[1]`;\n \n // create Distance Tool as fixed position (this is to avoid distance tool to use same locator if created at selected vertices immediatelly) \n distanceDimension -sp 0 0 0 -ep 0 0 1;\n \n // get requred nodes \n string $getObjects1[] = `ls -sl`;\n select -r -ne $getObjects1[1];\n $selectedDs1 = `ls -sl -dag -leaf`; \n string $list1[] = `listHistory $selectedDs1`; \n string $listTransforms1[] = `listRelatives -p $list1`; \n \n // position Distance Tools locators at selected vertices\n xform -t $firstSelVerice1[0] $firstSelVerice1[1] $firstSelVerice1[2] -ws $listTransforms1[1];\n xform -t $secondSelVerice1[0] $secondSelVerice1[1] $secondSelVerice1[2] -ws $listTransforms1[2];\n \n // Use PointOnPoly constrain if chececk \n $getValueConst = `iconTextCheckBox -q -v constrainOnOff`; \n if ( $getValueConst == 1)\n { \n //// Constraint to Vertices \n select -r $selLockVertices2[0]; \n select -add $listTransforms1[1]; \n //$constrain1 = `pointOnPolyConstraint -o 0 0 0 -w 1`; performPointOnPolyConstraint 0;\n //pointOnPolyConstraint -e -skip \"none\" $constrain1;\n doCreatePointOnPolyConstraintArgList 2 { \"0\" ,\"0\" ,\"0\" ,\"1\" ,\"\" ,\"1\" ,\"0\" ,\"0\" ,\"0\" ,\"0\" }; //performPointOnPolyConstraint 0;\n \n select -r $selLockVertices2[1]; select -add $listTransforms1[2]; \n //$constrain2 = `pointOnPolyConstraint -o 0 0 0 -w 1`; performPointOnPolyConstraint 0;\n //pointOnPolyConstraint -e -skip \"none\" $constrain2;\n doCreatePointOnPolyConstraintArgList 2 { \"0\" ,\"0\" ,\"0\" ,\"1\" ,\"\" ,\"1\" ,\"0\" ,\"0\" ,\"0\" ,\"0\" }; //performPointOnPolyConstraint 0;\n\n ////\n }\n\n // Distance Color\n setAttr ($listTransforms1[0] +\".overrideEnabled\") 1 ;\n setAttr ($listTransforms1[0] + \".overrideRGBColors\") 1 ;\n setAttr ($listTransforms1[0] + \".overrideColorRGB\") 1 1 1; \n \n // Locator Color\n select -r $listTransforms1[1] $listTransforms1[2];\n string $selLocatorColor[] = `ls -sl -tr`;\n for ($eachSelLoc in $selLocatorColor)\n {\n setAttr ($eachSelLoc +\".overrideEnabled\") 1 ;\n setAttr ($eachSelLoc + \".overrideRGBColors\") 1 ;\n setAttr ($eachSelLoc + \".overrideColorRGB\") 0.672 0.074 0.074; \n setAttr ($eachSelLoc + \".scale\") 0.5 0.5 0.5 ;\n }\n select -cl;\n \n // keep selection - still in vertice component mode\n select -r $selObject1;\n setSelectMode components Components; selectType -smp 1 -sme 0 -smf 0 -smu 0 -pv 1 -pe 0 -pf 0 -puv 0;\n select -cl;\n \n print \"Distance Tool - Created!\";\n \n }\n else \n {\n warning -n \" -- INFO -- Select only TWO vertices! \"; \n return; \n }\n\n}\n\n\n \n\n\nproc mmLayout()\n{\n // inch > milimeter\n floatField -e -v 0 -cc \"inputInchesMilli\" inchesInput;\n text -e -l \"Millimeter \" labelMeter1;\n floatField -e -v 0 -cc \"inputMilliInches\" meter1Input;\n // feet > milimeter\n floatField -e -v 0 -cc \"inputFeetMilli\" feetInput;\n text -e -l \"Millimeter \" labelMeter2;\n floatField -e -v 0 -cc \"inputMilliFeet\" meter2Input; \n // yard > milimeter\n floatField -e -v 0 -cc \"inputYardsMilli\" yardsInput;\n text -e -l \"Millimeter \" labelMeter3;\n floatField -e -v 0 -cc \"inputMilliYards\" meter3Input;\n \n\n formLayout -e \n -attachForm labelMeter1 \"top\" 42 -attachForm labelMeter1 \"left\" 150 \n -attachForm labelMeter2 \"top\" 67 -attachForm labelMeter2 \"left\" 150\n -attachForm labelMeter3 \"top\" 93 -attachForm labelMeter3 \"left\" 150 \n slicerOrient2; \n \n}\n\nproc cmLayout()\n{\n // inch > centi\n floatField -e -v 0 -cc \"inputInchesCenti\" inchesInput;\n text -e -l \"Centimeter \" labelMeter1;\n floatField -e -v 0 -cc \"inputCentiInches\" meter1Input;\n // feet > centi\n floatField -e -v 0 -cc \"inputFeetCenti\" feetInput;\n text -e -l \"Centimeter \" labelMeter2;\n floatField -e -v 0 -cc \"inputCentiFeet\" meter2Input; \n // yard > centi\n floatField -e -v 0 -cc \"inputYardsCenti\" yardsInput;\n text -e -l \"Centimeter \" labelMeter3;\n floatField -e -v 0 -cc \"inputCentiYards\" meter3Input;\n \n\n formLayout -e \n -attachForm labelMeter1 \"top\" 42 -attachForm labelMeter1 \"left\" 145 \n -attachForm labelMeter2 \"top\" 67 -attachForm labelMeter2 \"left\" 145\n -attachForm labelMeter3 \"top\" 93 -attachForm labelMeter3 \"left\" 145 \n slicerOrient2; \n \n}\n\n\nproc mLayout()\n{\n \n // inch > meter\n floatField -e -v 0 -cc \"inputInchesMeter\" inchesInput;\n text -e -l \"Meter \" labelMeter1;\n floatField -e -v 0 -cc \"inputMeterInches\" meter1Input;\n // feet > meter\n floatField -e -v 0 -cc \"inputFeetMeter\" feetInput;\n text -e -l \"Meter \" labelMeter2;\n floatField -e -v 0 -cc \"inputMeterFeet\" meter2Input; \n // yard > meter\n floatField -e -v 0 -cc \"inputYardsMeter\" yardsInput;\n text -e -l \"Meter \" labelMeter3;\n floatField -e -v 0 -cc \"inputMeterYards\" meter3Input;\n \n\n formLayout -e \n -attachForm labelMeter1 \"top\" 42 -attachForm labelMeter1 \"left\" 171 \n -attachForm labelMeter2 \"top\" 67 -attachForm labelMeter2 \"left\" 171\n -attachForm labelMeter3 \"top\" 93 -attachForm labelMeter3 \"left\" 171 \n slicerOrient2; \n \n}\n\n\n// Help\nproc getTutsVimeo1()\n{\n launch -web \"https://vimeo.com/203005947\";\n}\nproc getTutsVimeo2()\n{\n launch -web \"https://vimeo.com/220862014\";\n}\n\nproc getTutsVimeo3()\n{\n launch -web \"https://vimeo.com/255964700\";\n}\n\n\nproc scriptsGumroad()\n{\n launch -web \"http://gumroad.com/klaudio2u\";\n}\n\nproc webFacebook()\n{\n launch -web \"http://facebook.com/klaudio.ladavac\";\n}\nproc webArtStation()\n{\n launch -web \"http://artstation.com/klaudio2u\";\n}" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 1
-flexibleWidthValue 32
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "import maya.cmds as cmds\n\nlista = cmds.ls(sl=1)\n\nfor obj in lista:\n \n s = cmds.listRelatives(obj,s=1)[0]\n cmds.setAttr ( s + \".osdFvarBoundary\" , 1)" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "import maya.cmds as cmds\n\nlista = cmds.ls(sl=1)\n\nfor obj in list..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/uvEDGE.png" 
-image1 "C:/Users/MrPurple/Documents/maya/2018/prefs/icons/uvEDGE.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import maya.cmds as cmds\n\nlista = cmds.ls(sl=1)\n\nfor obj in lista:\n \n s = cmds.listRelatives(obj,s=1)[0]\n cmds.setAttr ( s + \".osdFvarBoundary\" , 1)" 
-sourceType "python" 
-doubleClickCommand "import maya.cmds as cmds\n\ndef UVsmoothEdge():\nlista = cmds.ls(sl=1)\n\nfor obj in lista:\n \n s = cmds.listRelatives(obj,s=1)[0]\n cmds.setAttr ( s + \".osdFvarBoundary\" , 1)" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 3
-flexibleWidthValue 32
-enable 1
-width 35
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "import maya.cmds as cmds\n\nlista = cmds.ls(sl=1)\n\nfor obj in lista:\n \n s = cmds.listRelatives(obj,s=1)[0]\n cmds.setAttr ( s + \".aiSubdivType\" , 1)\n cmds.setAttr ( s + \".aiSubdivIterations\" , 1)" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "import maya.cmds as cmds\n\nlista = cmds.ls(sl=1)\n\nfor obj in list..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "catclark" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "pythonFamily.png" 
-image1 "pythonFamily.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import maya.cmds as mc\n\n \n\ndef carmineWindow():\n \n if mc.window('smoothCarmineGUI', exists = True):\n mc.deleteUI('smoothCarmineGUI')\n\n\n \n \n def arnoldSubD(*args):\n sub = mc.intField(subd, q=1, v=1)\n lista = cmds.ls(sl=1)\n for obj in lista:\n \n s = cmds.listRelatives(obj,s=1)[0]\n cmds.setAttr ( s + \".aiSubdivType\" , 1)\n cmds.setAttr ( s + \".aiSubdivIterations\" , sub )\n \n def UVsmoothEdge(*args):\n lista = cmds.ls(sl=1)\n for obj in lista:\n s = cmds.listRelatives(obj,s=1)[0]\n cmds.setAttr ( s + \".osdFvarBoundary\" , 1)\n \n \n \n mc.window('smoothCarmineGUI' , rtf = True)\n mc.columnLayout()\n mc.frameLayout( label='::: ARNOLD :::')\n mc.text(label = 'Arnold subdivision level:'), \n subd = mc.intField('iterationsNumber')\n mc.button(label ='subdivide using catclark', command = arnoldSubD)\n mc.frameLayout( label=' ::: UV :::')\n mc.button(label ='Preserve Edges and Corners', command = UVsmoothEdge)\n \n \n mc.showWindow('smoothCarmineGUI')\n \ncarmineWindow()" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 3
-flexibleWidthValue 32
-enable 1
-width 35
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "import pymel.core as pm\nimport maya.mel as mel\nobjectsShape = []\nobjectsShape.append( pm.ls( type = 'mesh' , ni = 1 ) )\nobjectsShape.append( pm.ls( type = 'nurbsCurve' , ni = 1 ) )\nobjects = []\n\nfor obj in objectsShape:\n\n objects.append( pm.listRelatives( obj , p = 1 ) )\n\npm.select( objects )\ngr = pm.group( n = 'GRP_meshes_new' , w = 1 )\n\npm.select( all = 1 )\nlisSel = pm.ls( sl = 1 , type = 'transform' )\nlisSel.remove( 'GRP_meshes_new' )\n\npm.select( lisSel )\noldElem = pm.ls( sl = 1 )\ntry:\n pm.delete(oldElem)\nexcept:\n pass\nloc = pm.spaceLocator( p = ( 0.0 , 0.0 , 0.0 ) )\n\nfor obj in objects:\n\n if obj[0].find( 'eye' ) == -1 and obj[0].find( 'cornea' ) == -1:\n\n pm.select( obj , loc )\n mel.eval( 'MatchPivots;' )\n pm.makeIdentity( obj , a = 1 , t = 1 , r = 1 , s = 1 , pn = 1 , n = 0 )\n\npm.delete( loc )\ngr.rename('GRP_meshes')" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "import pymel.core as pm\nimport maya.mel as mel\nobjectsShape = []..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "finalize" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "pythonFamily.png" 
-image1 "pythonFamily.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import pymel.core as pm\nimport maya.mel as mel\nobjectsShape = []\nobjectsShape.append( pm.ls( type = 'mesh' , ni = 1 ) )\nobjectsShape.append( pm.ls( type = 'nurbsCurve' , ni = 1 ) )\nobjectsShape.append( pm.ls( type = 'lattice' , ni = 1 ) )\nobjectsShape.append( pm.ls( type = 'baseLattice' , ni = 1 ) )\nobjects = []\n\nfor obj in objectsShape:\n\n for obj2 in obj:\n\n objects.append( pm.listRelatives( obj2 , p = 1 )[0] )\n\npm.select( objects )\ngr = pm.group( n = 'GRP_meshes_new' , w = 1 )\n\npm.select( all = 1 )\nlisSel = pm.ls( sl = 1 , type = 'transform' )\nlisSel.remove( 'GRP_meshes_new' )\n\npm.select( lisSel )\noldElem = pm.ls( sl = 1 )\ngr.rename('GRP_meshes')\n\ntry:\n pm.delete(oldElem)\nexcept:\n pass\nloc = pm.spaceLocator( p = ( 0.0 , 0.0 , 0.0 ) )\n\nfor obj in objects:\n\n if ( obj.find( 'eye' ) == -1 and obj.find( 'EYE' ) == -1 ) and ( obj.find( 'cornea' ) == -1 and obj.find( 'CORNEA' ) == -1 ):\n\n pm.select( obj , loc )\n mel.eval( 'MatchPivots;' )\n pm.makeIdentity( obj , a = 1 , t = 1 , r = 1 , s = 1 , pn = 1 , n = 0 )\n pm.select( obj )\n mel.eval('doBakeNonDefHistory( 1, {\"prePost\" });')\n\npm.delete( loc )" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 3
-flexibleWidthValue 32
-enable 1
-width 35
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "def removeRogueModelPanelChangeEvents():\n EVIL_METHOD_NAMES = ['DCF_updateViewportList', 'CgAbBlastPanelOptChangeCallback']\n capitalEvilMethodNames = [name.upper() for name in EVIL_METHOD_NAMES]\n modelPanelLabel = mel.eval('localizedPanelLabel(\"ModelPanel\")')\n processedPanelNames = []\n panelName = cmds.sceneUIReplacement(getNextPanel=('modelPanel', modelPanelLabel))\n while panelName and panelName not in processedPanelNames:\n editorChangedValue = cmds.modelEditor(panelName, query=True, editorChanged=True)\n parts = editorChangedValue.split(';')\n newParts = []\n changed = False\n for part in parts:\n for evilMethodName in capitalEvilMethodNames:\n if evilMethodName in part.upper():\n changed = True\n break\n else:\n newParts.append(part)\n if changed:\n cmds.modelEditor(panelName, edit=True, editorChanged=';'.join(newParts))\n processedPanelNames.append(panelName)\n panelName = cmds.sceneUIReplacement(getNextPanel=('modelPanel', modelPanelLabel))" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "def removeRogueModelPanelChangeEvents():\n EVIL_METHOD_NAMES =..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "remove" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "pythonFamily.png" 
-image1 "pythonFamily.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "def removeRogueModelPanelChangeEvents():\n EVIL_METHOD_NAMES = ['DCF_updateViewportList', 'CgAbBlastPanelOptChangeCallback']\n capitalEvilMethodNames = [name.upper() for name in EVIL_METHOD_NAMES]\n modelPanelLabel = mel.eval('localizedPanelLabel(\"ModelPanel\")')\n processedPanelNames = []\n panelName = cmds.sceneUIReplacement(getNextPanel=('modelPanel', modelPanelLabel))\n while panelName and panelName not in processedPanelNames:\n editorChangedValue = cmds.modelEditor(panelName, query=True, editorChanged=True)\n parts = editorChangedValue.split(';')\n newParts = []\n changed = False\n for part in parts:\n for evilMethodName in capitalEvilMethodNames:\n if evilMethodName in part.upper():\n changed = True\n break\n else:\n newParts.append(part)\n if changed:\n cmds.modelEditor(panelName, edit=True, editorChanged=';'.join(newParts))\n processedPanelNames.append(panelName)\n panelName = cmds.sceneUIReplacement(getNextPanel=('modelPanel', modelPanelLabel))" 
-sourceType "python" 
-doubleClickCommand "removeRogueModelPanelChangeEvents()" 
-commandRepeatable 1
-flat 1
-mi "load script" ( "def removeRogueModelPanelChangeEvents():\n EVIL_METHOD_NAMES = ['DCF_updateViewportList', 'CgAbBlastPanelOptChangeCallback']\n capitalEvilMethodNames = [name.upper() for name in EVIL_METHOD_NAMES]\n modelPanelLabel = mel.eval('localizedPanelLabel(\"ModelPanel\")')\n processedPanelNames = []\n panelName = cmds.sceneUIReplacement(getNextPanel=('modelPanel', modelPanelLabel))\n while panelName and panelName not in processedPanelNames:\n editorChangedValue = cmds.modelEditor(panelName, query=True, editorChanged=True)\n parts = editorChangedValue.split(';')\n newParts = []\n changed = False\n for part in parts:\n for evilMethodName in capitalEvilMethodNames:\n if evilMethodName in part.upper():\n changed = True\n break\n else:\n newParts.append(part)\n if changed:\n cmds.modelEditor(panelName, edit=True, editorChanged=';'.join(newParts))\n processedPanelNames.append(panelName)\n panelName = cmds.sceneUIReplacement(getNextPanel=('modelPanel', modelPanelLabel))" )
-mip 0
-mi "run script" ( "removeRogueModelPanelChangeEvents()" )
-mip 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 3
-flexibleWidthValue 32
-enable 1
-width 35
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "bool" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "##--------------------------------------------------------------..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "speedCut" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "pythonFamily.png" 
-image1 "pythonFamily.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "##--------------------------------------------------------------------------\n##\n## ScriptName : SpeedCut \n## Contents : tool set for speed up maya boolean opeeration\n## Author : Joe Wu\n## URL : http://im3djoe.com\n## Since : 2019/08\n## Version \n## : 1.02 - fixed bug at line 960, refine setCutterBaseMesh funtion, now it can re- set exist Bool Grp, eg after re-open maya\n## : 1.01 - fixed bug when set basemesh #Error: RuntimeError: file <maya console> line 2771: setAttr: Not enough data was provided. The last 0 items will be skipped. # \n## Version : 1.0 - 2019/08/17 First version for public test\n## \n##\t \n## Other Note : only test in maya 2018.5 windows enviroment \n## report works fine in 2019\t\n## report error with 2016,2017.5\n##\n## Install : copy and paste script into a python tab in maya script editor\n##--------------------------------------------------------------------------\n\n\nimport maya.OpenMaya as om\nimport maya.OpenMayaUI as omui\nimport maya.cmds as mc\nimport math\nimport maya.api.OpenMaya as OpenMaya\nimport pymel.core as pm\nimport maya.mel as mel\n\n\ndef preBevelToggle():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n if mc.objExists(beseMesh+'_preBevel'):\n mc.delete(beseMesh+'_preBevel')\n mc.setAttr((beseMesh+'BoolGrp.visibility'),1)\n else:\n preBevelRemoveSymmetry()\n \ndef preBevelRemoveSymmetry():\n\tbeseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n\tmc.select(beseMesh+'_bool')\n\tnewNode = mc.duplicate()\n\tmc.rename(newNode,beseMesh+'_preBevel')\n\tgetSymX = 0\n\tgetSymY = 0\n\tgetSymZ = 0\n\tif mc.attributeQuery('symmetryX', node = beseMesh, ex=True ):\n\t\tgetSymX = mc.getAttr(beseMesh+'.symmetryX')\n\tif mc.attributeQuery('symmetryY', node = beseMesh, ex=True ):\n\t\tgetSymY = mc.getAttr(beseMesh+'.symmetryY')\n\tif mc.attributeQuery('symmetryZ', node = beseMesh, ex=True ):\n\t\tgetSymZ = mc.getAttr(beseMesh+'.symmetryZ') \n\tmc.setAttr((beseMesh+'BoolGrp.visibility'),0)\n\tmc.parent(beseMesh+'_preBevel',w=True)\n\tmc.setAttr((beseMesh+'_preBevel.visibility'),1)\n\tselPoly = (beseMesh+'_preBevel')\n\n\tif getSymX == 1:\n\t\tbboxObj = mc.xform(selPoly , q = True, ws =True, bb=True)\n\t\tlengthObj=math.sqrt((math.pow(bboxObj[0]-bboxObj[3],2)+math.pow(bboxObj[1]-bboxObj[4],2)+math.pow(bboxObj[2]-bboxObj[5],2))/3)\n\t\tcloseRange = lengthObj / 100\n\t\tbboxSel = mc.xform(selPoly,q = True, ws =True, bb=True)\n\t\tmidX = (bboxSel[3]+bboxSel[0])/2\n\t\tmidY = (bboxSel[4]+bboxSel[1])/2\n\t\tmidZ = (bboxSel[5]+bboxSel[2])/2\n\t\tinRangeCv = []\n\t\tvNo = mc.polyEvaluate(selPoly, v = True )\n\t\tcheckPoint = 0\n\t\tfor i in range(vNo):\n\t\t\tpositionV = mc.pointPosition((selPoly +'.vtx[' + str(i) + ']') , w = True)\n\t\t\tlength= math.sqrt(math.pow(positionV[checkPoint],2))\n\t\t\tif length <= closeRange:\n\t\t\t inRangeCv.append((selPoly +'.vtx[' + str(i) + ']'))\n\t\tfor n in inRangeCv:\n\t\t\tposiV = mc.pointPosition(n , w = True)\n\t\t\tif midX >= 0: \n\t\t\t\tmc.move((closeRange * -1.5) , posiV[1], posiV[2], n ,absolute=1) \n\t\t\telse:\n\t\t\t\tmc.move( (closeRange * 1.5) , posiV[1], posiV[2], n ,absolute=1) \n\t\tcutPlane= mc.polyCut(selPoly, ws = True, cd = 'X' , df = True , ch =True)\n\t\tmc.setAttr((cutPlane[0]+'.cutPlaneCenterX'), 0)\n\t\tmc.setAttr((cutPlane[0]+'.cutPlaneCenterY'), 0)\n\t\tmc.setAttr((cutPlane[0]+'.cutPlaneCenterZ'), 0)\n\t\tif midX > 0:\n\t\t\tmc.setAttr((cutPlane[0]+'.cutPlaneRotateY'), 90) \n\t\t\tmc.polyMirrorFace(selPoly,cutMesh =1, axis = 0, axisDirection = 1, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n\t\telse:\n\t\t\tmc.setAttr((cutPlane[0]+'.cutPlaneRotateY'), -90)\n\t\t\tmc.polyMirrorFace(selPoly,cutMesh =1, axis = 0, axisDirection = 0, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n\n\tif getSymY == 1:\n\t\tbboxObj = mc.xform(selPoly , q = True, ws =True, bb=True)\n\t\tlengthObj=math.sqrt((math.pow(bboxObj[0]-bboxObj[3],2)+math.pow(bboxObj[1]-bboxObj[4],2)+math.pow(bboxObj[2]-bboxObj[5],2))/3)\n\t\tcloseRange = lengthObj / 100\n\t\tbboxSel = mc.xform(selPoly,q = True, ws =True, bb=True)\n\t\tmidX = (bboxSel[3]+bboxSel[0])/2\n\t\tmidY = (bboxSel[4]+bboxSel[1])/2\n\t\tmidZ = (bboxSel[5]+bboxSel[2])/2\n\t\tinRangeCv = []\n\t\tvNo = mc.polyEvaluate(selPoly, v = True )\n\t\tcheckPoint = 1\n\t\tfor i in range(vNo):\n\t\t\tpositionV = mc.pointPosition((selPoly +'.vtx[' + str(i) + ']') , w = True)\n\t\t\tlength= math.sqrt(math.pow(positionV[checkPoint],2))\n\t\t\tif length <= closeRange:\n\t\t\t inRangeCv.append((selPoly +'.vtx[' + str(i) + ']'))\n\t\tfor n in inRangeCv:\n\t\t\t\tposiV = mc.pointPosition(n , w = True)\n\t\t\t\tif midY >= 0: \n\t\t\t\t\tmc.move(posiV[0], (closeRange * -1.5) , posiV[2], n ,absolute=1) \n\t\t\t\telse:\n\t\t\t\t\tmc.move(posiV[0], (closeRange * 1.5) , posiV[2], n ,absolute=1) \n\t\tcutPlane= mc.polyCut(selPoly, ws = True, cd = 'Y' , df = True , ch =True)\n\t\tmc.setAttr((cutPlane[0]+'.cutPlaneCenterX'), 0)\n\t\tmc.setAttr((cutPlane[0]+'.cutPlaneCenterY'), 0)\n\t\tmc.setAttr((cutPlane[0]+'.cutPlaneCenterZ'), 0)\n\t\tif midY > 0:\n\t\t\tmc.setAttr((cutPlane[0]+'.cutPlaneRotateX'), -90) \n\t\t\tmc.polyMirrorFace(selPoly,cutMesh =1, axis = 1, axisDirection = 1, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n\t\telse:\n\t\t\tmc.setAttr((cutPlane[0]+'.cutPlaneRotateX'), 90)\n\t\t\tmc.polyMirrorFace(selPoly,cutMesh =1, axis = 1, axisDirection = 0, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n\n\n\tif getSymZ == 1:\n\t\tbboxObj = mc.xform(selPoly , q = True, ws =True, bb=True)\n\t\tlengthObj=math.sqrt((math.pow(bboxObj[0]-bboxObj[3],2)+math.pow(bboxObj[1]-bboxObj[4],2)+math.pow(bboxObj[2]-bboxObj[5],2))/3)\n\t\tcloseRange = lengthObj / 100\n\t\tbboxSel = mc.xform(selPoly,q = True, ws =True, bb=True)\n\t\tmidX = (bboxSel[3]+bboxSel[0])/2\n\t\tmidY = (bboxSel[4]+bboxSel[1])/2\n\t\tmidZ = (bboxSel[5]+bboxSel[2])/2\n\t\tinRangeCv = []\n\t\tvNo = mc.polyEvaluate(selPoly, v = True )\n\t\tcheckPoint = 2\n\t\tfor i in range(vNo):\n\t\t\tpositionV = mc.pointPosition((selPoly +'.vtx[' + str(i) + ']') , w = True)\n\t\t\tlength= math.sqrt(math.pow(positionV[checkPoint],2))\n\t\t\tif length <= closeRange:\n\t\t\t inRangeCv.append((selPoly +'.vtx[' + str(i) + ']'))\n\t\tfor n in inRangeCv:\n\t\t\tposiV = mc.pointPosition(n , w = True)\n\t\t\tif midZ >= 0: \n\t\t\t\tmc.move(posiV[0], posiV[1],(closeRange * -1.5), n ,absolute=1) \n\t\t\telse:\n\t\t\t\tmc.move(posiV[0], posiV[1],(closeRange * 1.5), n ,absolute=1) \n\t\tcutPlane= mc.polyCut(selPoly, ws = True, cd = 'Z' , df = True , ch =True)\n\t\tmc.setAttr((cutPlane[0]+'.cutPlaneCenterX'), 0)\n\t\tmc.setAttr((cutPlane[0]+'.cutPlaneCenterY'), 0)\n\t\tmc.setAttr((cutPlane[0]+'.cutPlaneCenterZ'), 0)\n\t\tif midZ > 0:\n\t\t\tmc.setAttr((cutPlane[0]+'.cutPlaneRotateY'), 0) \n\t\t\tmc.polyMirrorFace(selPoly,cutMesh =1, axis = 2, axisDirection = 1, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n\t\telse:\n\t\t\tmc.setAttr((cutPlane[0]+'.cutPlaneRotateY'), 180)\n\t\t\tmc.polyMirrorFace(selPoly,cutMesh =1, axis = 2, axisDirection = 0, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n\tmc.select(selPoly)\n\tmc.BakeNonDefHistory()\n\tbevelPreviewAdd()\n\t\n\t\t\ndef bevelPreviewAdd():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n member = beseMesh + '_preBevel'\n mc.select(member)\n #Clean\n softNode = mc.polySoftEdge(angle=0.3)\n mc.rename(softNode,(beseMesh+'_bevelPreviewPolyEdgeSoft'))\n mel.eval(\"ConvertSelectionToEdges;\")\n mc.polySelectConstraint(t=0x8000, m=3, sm=2)\n mc.polySelectConstraint(disable =True)\n selectEdges=mc.ls(sl=1,fl=1)\n if len(selectEdges)>0:\n mel.eval(\"doDelete;\")\n mc.select(member)\n softNode = mc.polySoftEdge(angle=30)\n mc.rename(softNode,(beseMesh+'_bevelPreviewPolyEdgeHard'))\n mc.select(member)\n #Retop\n mc.polySelectConstraint(m=3,t=0x8000,sm=1)\n mc.polySelectConstraint(disable =True)\n triNode = mc.polyTriangulate(member,ch=0) \n mc.rename(triNode,(beseMesh+'_bevelPreviewPolyTriangulate'))\n quadNode = mc.polyQuad(member,a = 30, kgb = 0 ,ktb = 0, khe= 1, ws = 0, ch = 0)\n mc.rename(quadNode,(beseMesh+'_bevelPreviewPolyQuad'))\n mc.select(member)\n #Bevel\n mc.polySelectConstraint(m=3,t=0x8000,sm=1)\n mc.polySelectConstraint(disable =True)\n hardEdges = mc.ls(sl=1,fl=1)\n mc.DetachComponent()\n mc.select(member)\n mc.ConvertSelectionToFaces()\n sourceFaces = mc.ls(sl=1,fl=1)\n offsetData = mc.floatSliderGrp('offsetSliderPre', q=1, v = 1)\n createSupportNode = mc.polyExtrudeFacet(sourceFaces, constructionHistory =1, keepFacesTogether = 1, divisions = 1, off = offsetData, smoothingAngle = 30)\n faceLockNode = mc.rename(createSupportNode[0], (beseMesh+'_lcokFace'))\n mc.GrowPolygonSelectionRegion()\n shapeExtrude = mc.ls(sl=1,fl=1)\n mc.select(member)\n mc.ConvertSelectionToFaces()\n mc.select(shapeExtrude,d=1 )\n mc.delete()\n mc.select(member)\n mc.polyMergeVertex(d = 0.001, ch = 1)\n mc.setAttr((faceLockNode + \".offset\"), offsetData)\n mc.connectControl('offsetSliderPre', (faceLockNode + \".offset\")) \n mc.polySelectConstraint(m=3,t=0x8000,sm=1)\n mc.polySelectConstraint(disable =True)\n softNode = mc.polySoftEdge(angle= 180)\n mc.select(cl=True)\n\n\ndef onPressDraw():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n member =mc.editDisplayLayerMembers((beseMesh+'_BoolResult'),q=True)\n snapMesh = (beseMesh +'_boolShape')\n vpX, vpY, _ = mc.draggerContext('meshPlace', query=True, anchorPoint=True)\n #print(vpX, vpY)\n pos = om.MPoint()\n dir = om.MVector()\n hitpoint = om.MFloatPoint()\n omui.M3dView().active3dView().viewToWorld(int(vpX), int(vpY), pos, dir)\n pos2 = om.MFloatPoint(pos.x, pos.y, pos.z)\n shortestD = 99999999999999999\n getMesh = []\n shortPosition= []\n mesh = snapMesh\n selectionList = om.MSelectionList()\n selectionList.add(snapMesh)\n dagPath = om.MDagPath()\n selectionList.getDagPath(0, dagPath)\n fnMesh = om.MFnMesh(dagPath)\n intersection = fnMesh.closestIntersection(\n om.MFloatPoint(pos2),\n om.MFloatVector(dir),\n None,\n None,\n False,\n om.MSpace.kWorld,\n 99999,\n False,\n None,\n hitpoint,\n None,\n None,\n None,\n None,\n None)\n if intersection:\n x = hitpoint.x\n y = hitpoint.y\n z = hitpoint.z\n newName = mc.listRelatives(mesh, p=True )\n #intersection on closet obj, for multi intersections remove distrance check\n distanceBetween = math.sqrt( ((float(pos2[0]) - hitpoint.x)**2) + ((float(pos2[1]) - hitpoint.y)**2) + ((float(pos2[2]) - hitpoint.z)**2))\n if (shortestD > distanceBetween):\n shortestD = distanceBetween\n getMesh = newName\n shortPosition = [x, y, z]\n if len(shortPosition) > 0:\n mc.spaceLocator(p=(shortPosition[0],shortPosition[1],shortPosition[2]),n = (getMesh[0]+'_cutterPoint'))\n\n\ndef offPressDraw():\n pointPos = mc.ls(sl=True,fl=True)\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n boolNode = mc.listConnections(mc.listHistory((beseMesh+'_bool'),f=1),type='polyCBoolOp')\n member =mc.editDisplayLayerMembers((beseMesh+'_BoolResult'),q=True)\n snapMesh =[]\n if member != None:\n snapMesh = member[0]\n mc.setToolTo('moveSuperContext')\n snapObj=snapMesh\n mc.CenterPivot()\n mc.geometryConstraint( snapObj , pointPos[0], weight = 1)\n mc.normalConstraint( snapObj , pointPos[0], aimVector =(0, 1, 0) , upVector =(1, 0, 0))\n mc.intSliderGrp('snapGirdSize',e=1, en=1)\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n gridData= mc.intSliderGrp('snapGirdSize', q = True, v =True)\n mesh = (beseMesh +'_bool')\n bbox= mc.xform(mesh, q=1, ws=1, bb=1)\n length=math.sqrt((math.pow(bbox[0]-bbox[3],2)+math.pow(bbox[1]-bbox[4],2)+math.pow(bbox[2]-bbox[5],2))/3)\n length = int(length *1.1 )\n meshCOORD = mc.objectCenter(mesh,gl=True)\n constructionPlanePos=[]\n meshCOORD = mc.objectCenter(pointPos[0],gl=True)\n if mc.objExists('lineDrawPlane'):\n mc.delete('lineDrawPlane')\n if mc.objExists('drawPlaneGrp'):\n mc.delete('drawPlaneGrp')\n mc.plane(s=length, r=[90,0,0])\n mc.rename('lineDrawPlane')\n mc.group('lineDrawPlane')\n mc.rename('drawPlaneGrp')\n mc.select(pointPos,add=True)\n mc.MatchTransform()\n mc.setAttr(\"lineDrawPlane.translateY\", 0.1)\n mc.delete(pointPos)\n mc.makeLive('lineDrawPlane')\n mc.snapMode(grid=1)\n resizeSnapGrid()\n mc.CVCurveTool()\n mc.curveCVCtx(mc.currentCtx(), e=True, d=1, bez= 0) \n mc.connectControl('snapGirdRot', 'lineDrawPlane.rotateY')\n \ndef goPressDraw():\n ctx = 'meshPlace'\n if mc.draggerContext(ctx, exists=True):\n mc.deleteUI(ctx)\n mc.draggerContext(ctx, pressCommand = onPressDraw, rc = offPressDraw, name=ctx, cursor='crossHair')\n mc.setToolTo(ctx)\n\ndef goDraw():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n snapMesh = beseMesh + '_bool'\n mc.optionVar(iv = ('inViewMessageEnable', 0))\n mc.makeLive(snapMesh) \n xrayOn()\n mc.evalDeferred('drawBoxRun()')\n\n\ndef drawBoxRun():\n mc.setToolTo( \"CreatePolyCubeCtx\" )\n mc.scriptJob ( runOnce=True, event = [\"PostToolChanged\", xrayOff])\n \n \ndef xrayOn():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n snapMesh = beseMesh + '_bool'\n mc.displaySurface(snapMesh , x =1)\n\ndef xrayOff():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n snapMesh = beseMesh + '_bool'\n mc.displaySurface(snapMesh , x =0)\n mc.makeLive( none=True )\n newCut = mc.ls(sl=1,tr=1)\n mc.select(newCut, r=1)\n mc.evalDeferred('useOwnCutterShape()')\n newCut = mc.ls(sl=1,tr=1)\n mc.setAttr((newCut[0]+\".scaleX\") ,1.01)\n mc.setAttr((newCut[0]+\".scaleY\") ,1.01)\n mc.setAttr((newCut[0]+\".scaleZ\") ,1.01)\n \n\ndef boolSymmetryFreeze():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n bakeCutter()\n \n if mc.objExists((beseMesh +'_mirrorGrp')) == 1:\n mc.delete((beseMesh +'_mirrorGrp'))\n\n selPoly = beseMesh\n getSymX = 0\n getSymY = 0\n getSymZ = 0\n if mc.attributeQuery('symmetryX', node = beseMesh, ex=True ):\n getSymX = mc.getAttr(beseMesh+'.symmetryX')\n if mc.attributeQuery('symmetryY', node = beseMesh, ex=True ):\n getSymY = mc.getAttr(beseMesh+'.symmetryY')\n if mc.attributeQuery('symmetryZ', node = beseMesh, ex=True ):\n getSymZ = mc.getAttr(beseMesh+'.symmetryZ') \n mc.setAttr((selPoly+'.visibility'),1)\n if getSymX == 1:\n bboxObj = mc.xform(selPoly , q = True, ws =True, bb=True)\n lengthObj=math.sqrt((math.pow(bboxObj[0]-bboxObj[3],2)+math.pow(bboxObj[1]-bboxObj[4],2)+math.pow(bboxObj[2]-bboxObj[5],2))/3)\n closeRange = lengthObj / 100\n bboxSel = mc.xform(selPoly,q = True, ws =True, bb=True)\n midX = (bboxSel[3]+bboxSel[0])/2\n midY = (bboxSel[4]+bboxSel[1])/2\n midZ = (bboxSel[5]+bboxSel[2])/2\n inRangeCv = []\n vNo = mc.polyEvaluate(selPoly, v = True )\n checkPoint = 0\n mc.setAttr((selPoly+'.symmetryX'),1)\n for i in range(vNo):\n positionV = mc.pointPosition((selPoly +'.vtx[' + str(i) + ']') , w = True)\n length= math.sqrt(math.pow(positionV[checkPoint],2))\n if length <= closeRange:\n inRangeCv.append((selPoly +'.vtx[' + str(i) + ']'))\n for n in inRangeCv:\n posiV = mc.pointPosition(n , w = True)\n if midX >= 0: \n mc.move((closeRange * -1.5) , posiV[1], posiV[2], n ,absolute=1) \n else:\n mc.move( (closeRange * 1.5) , posiV[1], posiV[2], n ,absolute=1) \n cutPlane= mc.polyCut(selPoly, ws = True, cd = 'X' , df = True , ch =True)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterX'), 0)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterY'), 0)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterZ'), 0)\n if midX > 0:\n mc.setAttr((cutPlane[0]+'.cutPlaneRotateY'), 90) \n mc.polyMirrorFace(selPoly,cutMesh =1, axis = 0, axisDirection = 1, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n else:\n mc.setAttr((cutPlane[0]+'.cutPlaneRotateY'), -90)\n mc.polyMirrorFace(selPoly,cutMesh =1, axis = 0, axisDirection = 0, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n \n if getSymY == 1:\n bboxObj = mc.xform(selPoly , q = True, ws =True, bb=True)\n lengthObj=math.sqrt((math.pow(bboxObj[0]-bboxObj[3],2)+math.pow(bboxObj[1]-bboxObj[4],2)+math.pow(bboxObj[2]-bboxObj[5],2))/3)\n closeRange = lengthObj / 100\n bboxSel = mc.xform(selPoly,q = True, ws =True, bb=True)\n midX = (bboxSel[3]+bboxSel[0])/2\n midY = (bboxSel[4]+bboxSel[1])/2\n midZ = (bboxSel[5]+bboxSel[2])/2\n inRangeCv = []\n vNo = mc.polyEvaluate(selPoly, v = True )\n checkPoint = 1\n for i in range(vNo):\n positionV = mc.pointPosition((selPoly +'.vtx[' + str(i) + ']') , w = True)\n length= math.sqrt(math.pow(positionV[checkPoint],2))\n if length <= closeRange:\n inRangeCv.append((selPoly +'.vtx[' + str(i) + ']'))\n for n in inRangeCv:\n posiV = mc.pointPosition(n , w = True)\n if midY >= 0: \n mc.move(posiV[0], (closeRange * -1.5) , posiV[2], n ,absolute=1) \n else:\n mc.move(posiV[0], (closeRange * 1.5) , posiV[2], n ,absolute=1) \n cutPlane= mc.polyCut(selPoly, ws = True, cd = 'Y' , df = True , ch =True)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterX'), 0)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterY'), 0)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterZ'), 0)\n if midY > 0:\n mc.setAttr((cutPlane[0]+'.cutPlaneRotateX'), -90) \n mc.polyMirrorFace(selPoly,cutMesh =1, axis = 1, axisDirection = 1, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n else:\n mc.setAttr((cutPlane[0]+'.cutPlaneRotateX'), 90)\n mc.polyMirrorFace(selPoly,cutMesh =1, axis = 1, axisDirection = 0, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n \n \n if getSymZ == 1:\n bboxObj = mc.xform(selPoly , q = True, ws =True, bb=True)\n lengthObj=math.sqrt((math.pow(bboxObj[0]-bboxObj[3],2)+math.pow(bboxObj[1]-bboxObj[4],2)+math.pow(bboxObj[2]-bboxObj[5],2))/3)\n closeRange = lengthObj / 100\n bboxSel = mc.xform(selPoly,q = True, ws =True, bb=True)\n midX = (bboxSel[3]+bboxSel[0])/2\n midY = (bboxSel[4]+bboxSel[1])/2\n midZ = (bboxSel[5]+bboxSel[2])/2\n inRangeCv = []\n vNo = mc.polyEvaluate(selPoly, v = True )\n checkPoint = 2\n for i in range(vNo):\n positionV = mc.pointPosition((selPoly +'.vtx[' + str(i) + ']') , w = True)\n length= math.sqrt(math.pow(positionV[checkPoint],2))\n if length <= closeRange:\n inRangeCv.append((selPoly +'.vtx[' + str(i) + ']'))\n for n in inRangeCv:\n posiV = mc.pointPosition(n , w = True)\n if midZ >= 0: \n mc.move(posiV[0], posiV[1],(closeRange * -1.5), n ,absolute=1) \n else:\n mc.move(posiV[0], posiV[1],(closeRange * 1.5), n ,absolute=1) \n cutPlane= mc.polyCut(selPoly, ws = True, cd = 'Z' , df = True , ch =True)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterX'), 0)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterY'), 0)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterZ'), 0)\n if midZ > 0:\n mc.setAttr((cutPlane[0]+'.cutPlaneRotateY'), 0) \n mc.polyMirrorFace(selPoly,cutMesh =1, axis = 2, axisDirection = 1, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n else:\n mc.setAttr((cutPlane[0]+'.cutPlaneRotateY'), 180)\n mc.polyMirrorFace(selPoly,cutMesh =1, axis = 2, axisDirection = 0, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n mc.select(selPoly)\n mc.BakeNonDefHistory()\n mc.setAttr((selPoly+'.visibility'),0)\n mc.setAttr((selPoly+'.symmetryX'),0)\n mc.setAttr((selPoly+'.symmetryY'),0)\n mc.setAttr((selPoly+'.symmetryZ'),0)\n\ndef boolSymmetryCut(axis):\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n selPoly = beseMesh\n checkState = mc.radioButtonGrp('symDirButton',q=True, sl = True)\n \n if not mc.attributeQuery('symmetryX', node = selPoly, ex=True ):\n mc.addAttr(selPoly, ln='symmetryX', at = \"long\" )\n mc.setAttr((selPoly+'.symmetryX'),0)\n if not mc.attributeQuery('symmetryY', node = selPoly, ex=True ):\n mc.addAttr(selPoly, ln='symmetryY', at = \"long\" )\n mc.setAttr((selPoly+'.symmetryY'),0)\n if not mc.attributeQuery('symmetryZ', node = selPoly, ex=True ):\n mc.addAttr(selPoly, ln='symmetryZ', at = \"long\" )\n mc.setAttr((selPoly+'.symmetryZ'),0)\n #get selected bbox\n bboxObj = mc.xform(selPoly , q = True, ws =True, bb=True)\n lengthObj=math.sqrt((math.pow(bboxObj[0]-bboxObj[3],2)+math.pow(bboxObj[1]-bboxObj[4],2)+math.pow(bboxObj[2]-bboxObj[5],2))/3)\n closeRange = lengthObj / 100\n bboxSel = mc.xform(selPoly,q = True, ws =True, bb=True)\n midX = (bboxSel[3]+bboxSel[0])/2\n midY = (bboxSel[4]+bboxSel[1])/2\n midZ = (bboxSel[5]+bboxSel[2])/2\n inRangeCv = []\n vNo = mc.polyEvaluate(selPoly, v = True )\n checkPoint = 0\n if axis == 'x' :\n checkPoint = 0\n mc.setAttr((selPoly+'.symmetryX'),1)\n\n elif axis == 'y' :\n checkPoint = 1\n mc.setAttr((selPoly+'.symmetryY'),1)\n\n else:\n checkPoint = 2\n mc.setAttr((selPoly+'.symmetryZ'),1)\n\n for i in range(vNo):\n positionV = mc.pointPosition((selPoly +'.vtx[' + str(i) + ']') , w = True)\n length= math.sqrt(math.pow(positionV[checkPoint],2))\n if length <= closeRange:\n inRangeCv.append((selPoly +'.vtx[' + str(i) + ']'))\n mc.select(inRangeCv, r=True)\n \n # push those point off center a bit then mirror cut\n if axis == 'x' :\n for n in inRangeCv:\n posiV = mc.pointPosition(n , w = True)\n if checkState == 1:\n mc.move((closeRange * -1.5) , posiV[1], posiV[2], n ,absolute=1) \n else:\n mc.move( (closeRange * 1.5) , posiV[1], posiV[2], n ,absolute=1) \n cutPlane= mc.polyCut(selPoly, ws = True, cd = 'X' , df = True , ch =True)\n if checkState == 2:\n mc.setAttr((cutPlane[0]+'.cutPlaneRotateY'),-90)\n \n if axis == 'y' :\n for n in inRangeCv:\n posiV = mc.pointPosition(n , w = True)\n if midY >= 0: \n mc.move(posiV[0], (closeRange * -1.5) , posiV[2], n ,absolute=1) \n else:\n mc.move(posiV[0], (closeRange * 1.5) , posiV[2], n ,absolute=1) \n cutPlane= mc.polyCut(selPoly, ws = True, cd = 'Y' , df = True , ch =True)\n if checkState == 2:\n mc.setAttr((cutPlane[0]+'.cutPlaneRotateX'),90)\n \n if axis == 'z' :\n for n in inRangeCv:\n posiV = mc.pointPosition(n , w = True)\n if midZ >= 0: \n mc.move(posiV[0], posiV[1],(closeRange * -1.5), n ,absolute=1) \n else:\n mc.move(posiV[0], posiV[1],(closeRange * 1.5), n ,absolute=1) \n cutPlane= mc.polyCut(selPoly, ws = True, cd = 'Z' , df = True , ch =True)\n if checkState == 2:\n mc.setAttr((cutPlane[0]+'.cutPlaneRotateX'),180)\n \n mc.setAttr((cutPlane[0]+'.cutPlaneCenterX'), 0)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterY'), 0)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterZ'), 0)\n mc.select(selPoly)\n mc.FillHole()\n boolSymmetryRestore()\n \ndef boolSymmetryRestore():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n selPoly = beseMesh\n \n if mc.objExists((beseMesh +'_mirrorGrp')) == 1:\n mc.delete((beseMesh +'_mirrorGrp'))\n \n mc.CreateEmptyGroup()\n mc.rename((beseMesh +'_mirrorGrp'))\n mc.parent((beseMesh +'_mirrorGrp'),(beseMesh +'BoolGrp'))\n \n \n checkSX = mc.getAttr(selPoly+'.symmetryX')\n if checkSX == 1:\n mc.select(selPoly+'_bool*')\n newMesh = mc.ls(sl=1,fl=1,tr =1)\n mc.select(newMesh)\n mc.instance()\n newMesh = mc.ls(sl=1,fl=1,tr =1)\n for n in newMesh:\n mc.xform(n, ws = 1, piv =[0, 0, 0])\n mc.setAttr((n+'.scaleX'),-1)\n parentNode = mc.listRelatives(n, allParents=True )\n if parentNode[0] != (beseMesh +'_mirrorGrp'):\n mc.parent(n,(beseMesh +'_mirrorGrp'))\n \n checkSY = mc.getAttr(selPoly+'.symmetryY')\n if checkSY == 1:\n mc.select(selPoly+'_bool*')\n newMesh = mc.ls(sl=1,fl=1,tr =1)\n mc.select(newMesh)\n mc.instance()\n newMesh = mc.ls(sl=1,fl=1,tr =1)\n for n in newMesh:\n mc.xform(n, ws = 1, piv =[0, 0, 0])\n mc.setAttr((n+'.scaleY'),-1)\n parentNode = mc.listRelatives(n, allParents=True )\n if parentNode[0] != (beseMesh +'_mirrorGrp'):\n mc.parent(n,(beseMesh +'_mirrorGrp'))\n \n \n checkSZ = mc.getAttr(selPoly+'.symmetryZ')\n if checkSZ == 1:\n mc.select(selPoly+'_bool*')\n newMesh = mc.ls(sl=1,fl=1,tr =1)\n mc.select(newMesh)\n mc.instance()\n newMesh = mc.ls(sl=1,fl=1,tr =1)\n for n in newMesh:\n mc.xform(n, ws = 1, piv =[0, 0, 0])\n mc.setAttr((n+'.scaleZ'),-1)\n parentNode = mc.listRelatives(n, allParents=True )\n if parentNode[0] != (beseMesh +'_mirrorGrp'):\n mc.parent(n,(beseMesh +'_mirrorGrp'))\n \n mc.select(cl=1)\n \n \ndef alignCutterToBase():\n my = mc.ls(sl=True,fl=True)\n bboxMy= mc.xform(my[0], q=1, ws=1, bb=1)\n cenmyList = [((bboxMy[3] + bboxMy[0] ) /2),((bboxMy[4] + bboxMy[1] ) /2),((bboxMy[5] + bboxMy[2] ) /2)]\n movList = []\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n bbox= mc.xform((beseMesh +'_bool'), q=1, ws=1, bb=1)\n \n for i in range(3):\n movX =[]\n minX = bbox[i] \n cenX =(bbox[i+3] + bbox[i] ) /2\n maxX = bbox[i+3] \n length= math.sqrt(math.pow(bbox[i]-bbox[i+3],2))\n quarXDis = length /6\n startX = []\n endX = []\n if minX > maxX:\n startX = maxX + quarXDis\n endX = minX - quarXDis\n else:\n startX = minX + quarXDis\n endX = maxX - quarXDis\n \n if cenmyList[i] >= startX and cenmyList[i] <= endX:\n movX = cenX\n \n elif cenmyList[i] < startX:\n movX = minX\n else:\n movX = maxX\n movList.append(movX)\n \n mc.move(movList[0],movList[1],movList[2],absolute=1) \n\ndef combineSelCutters():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n selList = mc.ls(sl=True,fl=True)\n if len(selList) > 1:\n #bake array \n for s in selList:\n if mc.objExists(s):\n mc.select(s)\n myType = checkInstType()\n if myType[1] != 'new':\n instBake()\n newNode = mc.ls(sl=1,fl=1)\n selList.append(newNode[0])\n #bug, some transform node does not kill after boolean\n while len(selList) > 1:\n mc.polyCBoolOp(selList[0], selList[1], op=1, ch=1, preserveColor=0, classification=1, name=selList[0])\n mc.DeleteHistory()\n if mc.objExists(selList[1]):\n mc.delete(selList[1])\n mc.rename(selList[0])\n selList.remove(selList[1])\n newCutter = mc.ls(sl=1,fl=1)\n if mc.objExists((beseMesh +'_cutterGrp')) == 0:\n mc.CreateEmptyGroup()\n mc.rename((beseMesh +'_cutterGrp'))\n mc.parent((beseMesh +'_cutterGrp'),(beseMesh +'BoolGrp')) \n mc.parent(newCutter,(beseMesh +'_cutterGrp'))\n if not mc.attributeQuery('cutterDir', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='cutterDir', dt= 'string')\n if not mc.attributeQuery('cutterType', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='cutterType', dt= 'string')\n mc.setAttr((newCutter[0]+'.cutterDir'),e=True, keyable=True)\n mc.setAttr((newCutter[0]+'.cutterType'),e=True, keyable=True)\n mc.setAttr((newCutter[0]+'.cutterDir'),'x',type=\"string\")\n mc.setAttr((newCutter[0]+'.cutterType'),'custom',type=\"string\")\n \n if not mc.attributeQuery('cutterOp', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='cutterOp', dt= 'string')\n mc.setAttr((newCutter[0]+'.cutterOp'),e=True, keyable=True)\n mc.setAttr((newCutter[0]+'.cutterOp'),'subs',type=\"string\")\n \n if not mc.attributeQuery('statePanel', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='statePanel', at = \"float\" )\n if not mc.attributeQuery('panelGap', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='panelGap', at = \"float\" )\n if not mc.attributeQuery('intPanelGap', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='intPanelGap', at = \"float\" )\n if not mc.attributeQuery('intScaleX', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='intScaleX', at = \"float\" )\n if not mc.attributeQuery('stateCap', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='stateCap', at = \"float\" )\n mc.setAttr((newCutter[0]+'.stateCap'),1)\n mc.setAttr((newCutter[0]+'.statePanel'),0)\n fixBoolNodeConnection()\n shapeNode = mc.listRelatives(newCutter[0], s=True )\n mc.setAttr((shapeNode[0]+'.overrideEnabled'), 1)\n mc.setAttr((shapeNode[0]+'.overrideShading'), 0)\n mc.setAttr((shapeNode[0]+'.overrideColor'), 28)\n mc.select(selList)\n else:\n print 'need more then one cutter!'\n \ndef recreateBool():\n#recreate bool\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n if mc.objExists(beseMesh +'_preBoolBox'):\n mc.delete(beseMesh +'_preBoolBox')\n \n mc.polyCube(w = 0.01, h=0.01, d=0.01 ,sx =1 ,sy= 1, sz= 1)\n mc.rename(beseMesh +'_preBoolBox') \n mc.polyCBoolOp(beseMesh, (beseMesh +'_preBoolBox') , op= 2, ch= 1, preserveColor= 0, classification= 1, name= (beseMesh +'_bool')) \n \n boolNode = mc.listConnections(mc.listHistory((beseMesh +'_bool'),f=1),type='polyCBoolOp')\n if (boolNode[0] != (beseMesh +'_myBool')):\n mc.rename(boolNode[0],(beseMesh +'_myBool'))\n mc.setAttr((beseMesh + '.visibility'), 0)\n baseShapeNode = mc.listRelatives(beseMesh, f = True)\n \n mc.parent(baseShapeNode,(beseMesh +'BoolGrp'))\n mc.delete(beseMesh)\n mc.rename(beseMesh)\n fullName = mc.ls(sl=True,l=True)\n baseShapeNode = mc.listRelatives(fullName[0], f = True)\n mc.rename(baseShapeNode[0],(beseMesh+'Shape'))\n \n mc.setAttr((beseMesh+'Shape.intermediateObject'), 0)\n mc.setAttr((beseMesh + '.visibility'), 0)\n mc.parent((beseMesh +'_bool'),(beseMesh +'BoolGrp'))\n \n mc.editDisplayLayerMembers( (beseMesh +'_BoolResult'),(beseMesh +'_bool')) # store my selection into the display layer\n mc.setAttr((beseMesh +'_BoolResult.displayType'),2) \n \ndef restoreCutter():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n if mc.objExists(beseMesh +'_bakeBaseMesh'): \n bakeCutter()\n mc.delete(beseMesh+'_bool') \n mc.delete(beseMesh) \n mc.parent((beseMesh +'_bakeBaseMesh'), (beseMesh+'BoolGrp'))\n mc.rename((beseMesh +'_bakeBaseMesh'), beseMesh) \n baseShape = mc.listRelatives((beseMesh), shapes=True,f=True)\n mc.setAttr((baseShape[0] + '.overrideShading'), 1)\n \n #recreate bool\n recreateBool()\n \n #restore cutters\n mc.select((beseMesh+'_bakeStep'), hi=True)\n mc.select((beseMesh+'_bakeStep'),d=True)\n restoreCutter = mc.ls(sl=1,fl=1,type='transform')\n for r in restoreCutter:\n shapeNode = mc.listRelatives(r, f = True, shapes=True)\n mc.setAttr( (shapeNode[0]+\".overrideEnabled\") , 1)\n mc.setAttr( (shapeNode[0]+\".overrideShading\") , 0)\n mc.setAttr( (shapeNode[0]+\".castsShadows\") , 0)\n mc.setAttr( (shapeNode[0]+\".receiveShadows\") , 0)\n mc.setAttr( (shapeNode[0]+\".primaryVisibility\") , 0)\n mc.setAttr( (shapeNode[0]+\".visibleInReflections\") , 0)\n mc.setAttr( (shapeNode[0]+\".visibleInRefractions\") , 0)\n mc.select(r)\n fixBoolNodeConnection()\n \n mc.rename(r , r.replace(\"bake\", \"box\"))\n if mc.objExists((beseMesh +'_cutterGrp')):\n mc.delete(beseMesh +'_cutterGrp')\n \n mc.rename((beseMesh +'_bakeStep'),(beseMesh +'_cutterGrp'))\n getCutters = mc.ls((beseMesh+'_cutterGrp|boxCutter*'),type = 'transform')\n mc.hide(getCutters)\n if len(getCutters)>0:\n mc.select(getCutters[-1])\n mc.showHidden(getCutters[-1])\n showAllCutter()\n\n \n\ndef bakeUnselectCutter():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n \n #store any symmtry\n getSymX = 0\n getSymY = 0\n getSymZ = 0\n if mc.attributeQuery('symmetryX', node = beseMesh, ex=True ):\n getSymX = mc.getAttr(beseMesh+'.symmetryX')\n if mc.attributeQuery('symmetryY', node = beseMesh, ex=True ):\n getSymY = mc.getAttr(beseMesh+'.symmetryY')\n if mc.attributeQuery('symmetryZ', node = beseMesh, ex=True ):\n getSymZ = mc.getAttr(beseMesh+'.symmetryZ') \n \n selectedCutter = mc.ls(sl=1,fl=1)\n #flatten all cutters\n flattenAlllCutter()\n #getList after flattern\n cleanList = []\n for s in selectedCutter:\n if 'ArrayGrp' in s:\n s = s.replace(\"ArrayGrp\", \"\")\n if mc.objExists(s.split('|')[-1]):\n cleanList.append(s.split('|')[-1])\n mc.select(cleanList)\n \n #disconnect from bool\n for c in cleanList:\n shapeNode = mc.listRelatives(c, f = True, shapes=True)\n if len(shapeNode)>0:\n listConnect = mc.connectionInfo((shapeNode[0]+'.outMesh'), dfs=True )\n if len(listConnect)>0:\n for a in listConnect:\n mc.disconnectAttr((shapeNode[0]+'.outMesh'), a)\n \n listConnectMa = mc.connectionInfo((shapeNode[0]+'.worldMatrix[0]'), dfs=True )\n if len(listConnectMa)>0:\n for b in listConnectMa:\n mc.disconnectAttr((shapeNode[0]+'.worldMatrix[0]'), b)\n \n \n # move to temp grp\n if mc.objExists((beseMesh +'_tempStoreGrp')) == 0:\n mc.CreateEmptyGroup()\n mc.rename((beseMesh +'_tempStoreGrp'))\n mc.parent((beseMesh +'_tempStoreGrp'), (beseMesh+'BoolGrp'))\n \n mc.parent(cleanList , (beseMesh +'_tempStoreGrp'))\n \n #step up\n #make bool mesh as new base mesh\n newMesh = mc.duplicate((beseMesh+'_bool'),rr=1)\n mc.delete(beseMesh+'_bool')\n #create Step up Group\n if mc.objExists((beseMesh +'_bakeStep')) == 0:\n mc.CreateEmptyGroup()\n mc.rename((beseMesh +'_bakeStep'))\n mc.parent((beseMesh +'_bakeStep'), (beseMesh+'BoolGrp'))\n mc.setAttr((beseMesh +'_bakeStep.visibility'),0)\n \n \n if mc.objExists((beseMesh +'_bakeBaseMesh')) ==0: \n #bake base mesh \n bakeMesh = mc.duplicate(beseMesh, rr=1)\n mc.delete(beseMesh)\n mc.parent(bakeMesh,(beseMesh +'_bakeStep'))\n mc.rename(bakeMesh,(beseMesh +'_bakeBaseMesh'))\n bakeShape = mc.listRelatives((beseMesh +'_bakeBaseMesh'), shapes=True,f=True)\n mc.setAttr((bakeShape[0] + '.overrideShading'), 1)\n mc.rename(newMesh,beseMesh)\n else:\n mc.delete(beseMesh)\n mc.rename(newMesh,beseMesh)\n \n if mc.objExists(beseMesh +'_myBool'):\n mc.delete(beseMesh+'_myBool')\n #reNumber\n mc.select((beseMesh+'_bakeStep'), hi=True)\n mc.select((beseMesh+'_bakeStep'),(beseMesh +'_bakeBaseMesh'),d=True)\n existCutterList = mc.ls(sl=1,fl=1,type='transform')\n \n #start rename old cutters\n mc.select((beseMesh+'_cutterGrp'), hi=True)\n mc.select((beseMesh+'_cutterGrp'),d=True)\n oldCutterList = mc.ls(sl=1,fl=1,type='transform')\n \n initalIndex = len(existCutterList) + 1\n for o in oldCutterList:\n newName = ('bakeCutter' + str(initalIndex))\n mc.rename(o, newName)\n initalIndex += 1\n newList= mc.ls(sl=1,fl=1,type='transform')\n if len(newList)>0:\n mc.parent(newList,(beseMesh +'_bakeStep'))\n \n #unlock connection\n shape = mc.listRelatives(beseMesh, shapes=True,f=True)\n checkConnection = mc.listConnections((shape[0]+'.drawOverride'),c=1,p=1)\n if checkConnection != None:\n mc.disconnectAttr(checkConnection[1],checkConnection[0])\n \n #recreate bool\n recreateBool()\n \n checkPreBoolGrp = mc.ls((beseMesh +'_preBoolBox'), l=True)\n \n if 'BoolGrp' not in checkPreBoolGrp[0]:\n mc.parent(checkPreBoolGrp[0],(beseMesh +'BoolGrp'))\n \n shapeNode = mc.listRelatives((beseMesh+'Shape'), s=True )\n if shapeNode != None:\n if len(shapeNode)>0:\n mc.setAttr((shapeNode[0]+'.intermediateObject'), 0)\n mc.parent((beseMesh+'Shape'),(beseMesh +'BoolGrp'))\n mc.delete(beseMesh)\n mc.rename(beseMesh)\n \n #reconnect selected Cutters\n newCutterList = []\n for c in cleanList:\n mc.select(c)\n fixBoolNodeConnection()\n newC = mc.ls(sl=1)\n newCutterList.append(newC[0])\n \n mc.parent(newCutterList , (beseMesh +'_cutterGrp'))\n if mc.objExists((beseMesh +'_tempStoreGrp')): \n mc.delete((beseMesh +'_tempStoreGrp'))\n #rebuild symmtry \n \n if not mc.attributeQuery('symmetryX', node = beseMesh, ex=True ):\n mc.addAttr(beseMesh, ln='symmetryX', at = \"long\" )\n mc.setAttr((beseMesh+'.symmetryX'),getSymX)\n if not mc.attributeQuery('symmetryY', node = beseMesh, ex=True ):\n mc.addAttr(beseMesh, ln='symmetryY', at = \"long\" )\n mc.setAttr((beseMesh+'.symmetryY'),getSymY)\n if not mc.attributeQuery('symmetryZ', node = beseMesh, ex=True ):\n mc.addAttr(beseMesh, ln='symmetryZ', at = \"long\" )\n mc.setAttr((beseMesh+'.symmetryZ'),getSymZ)\n \n boolSymmetryRestore()\n mc.select(newCutterList)\n \ndef bakeCutter():\n #step up\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n #store any symmtry\n getSymX = 0\n getSymY = 0\n getSymZ = 0\n if mc.attributeQuery('symmetryX', node = beseMesh, ex=True ):\n getSymX = mc.getAttr(beseMesh+'.symmetryX')\n if mc.attributeQuery('symmetryY', node = beseMesh, ex=True ):\n getSymY = mc.getAttr(beseMesh+'.symmetryY')\n if mc.attributeQuery('symmetryZ', node = beseMesh, ex=True ):\n getSymZ = mc.getAttr(beseMesh+'.symmetryZ') \n #flatten all cutters\n flattenAlllCutter() \n #make bool mesh as new base mesh\n newMesh = mc.duplicate((beseMesh+'_bool'),rr=1)\n mc.delete(beseMesh+'_bool')\n #create Step up Group\n if mc.objExists((beseMesh +'_bakeStep')) == 0:\n mc.CreateEmptyGroup()\n mc.rename((beseMesh +'_bakeStep'))\n mc.parent((beseMesh +'_bakeStep'), (beseMesh+'BoolGrp'))\n mc.setAttr((beseMesh +'_bakeStep.visibility'),0)\n \n if mc.objExists((beseMesh +'_bakeBaseMesh')) == 0: \n #bake base mesh \n bakeMesh = mc.duplicate(beseMesh, rr=1)\n mc.delete(beseMesh)\n mc.parent(bakeMesh,(beseMesh +'_bakeStep'))\n mc.rename(bakeMesh,(beseMesh +'_bakeBaseMesh'))\n bakeShape = mc.listRelatives((beseMesh +'_bakeBaseMesh'), shapes=True,f=True)\n #mc.setAttr((bakeShape[0] + '.overrideShading'), 1)\n mc.rename(newMesh,beseMesh)\n else:\n mc.delete(beseMesh)\n mc.rename(newMesh,beseMesh)\n \n if mc.objExists(beseMesh +'_myBool'):\n mc.delete(beseMesh+'_myBool')\n #reNumber\n mc.select((beseMesh+'_bakeStep'), hi=True)\n mc.select((beseMesh+'_bakeStep'),(beseMesh +'_bakeBaseMesh'),d=True)\n existCutterList = mc.ls(sl=1,fl=1,type='transform')\n \n #start rename old cutters\n mc.select((beseMesh+'_cutterGrp'), hi=True)\n mc.select((beseMesh+'_cutterGrp'),d=True)\n oldCutterList = mc.ls(sl=1,fl=1,type='transform')\n \n initalIndex = len(existCutterList) + 1\n for o in oldCutterList:\n newName = ('bakeCutter' + str(initalIndex))\n mc.rename(o, newName)\n initalIndex += 1\n newList= mc.ls(sl=1,fl=1,type='transform')\n if len(newList)>0:\n mc.parent(newList,(beseMesh +'_bakeStep'))\n \n #unlock connection\n shape = mc.listRelatives(beseMesh, shapes=True,f=True)\n checkConnection = mc.listConnections((shape[0]+'.drawOverride'),c=1,p=1)\n if checkConnection != None:\n mc.disconnectAttr(checkConnection[1],checkConnection[0])\n \n #recreate bool\n recreateBool()\n \n checkPreBoolGrp = mc.ls((beseMesh +'_preBoolBox'), l=True)\n \n if 'BoolGrp' not in checkPreBoolGrp[0]:\n mc.parent(checkPreBoolGrp[0],(beseMesh +'BoolGrp'))\n \n shapeNode = mc.listRelatives((beseMesh+'Shape'), s=True )\n if shapeNode != None:\n if len(shapeNode)>0:\n mc.setAttr((shapeNode[0]+'.intermediateObject'), 0)\n mc.parent((beseMesh+'Shape'),(beseMesh +'BoolGrp'))\n mc.delete(beseMesh)\n mc.rename(beseMesh)\n \n #rebuild symmtry \n \n if not mc.attributeQuery('symmetryX', node = beseMesh, ex=True ):\n mc.addAttr(beseMesh, ln='symmetryX', at = \"long\" )\n mc.setAttr((beseMesh+'.symmetryX'),getSymX)\n if not mc.attributeQuery('symmetryY', node = beseMesh, ex=True ):\n mc.addAttr(beseMesh, ln='symmetryY', at = \"long\" )\n mc.setAttr((beseMesh+'.symmetryY'),getSymY)\n if not mc.attributeQuery('symmetryZ', node = beseMesh, ex=True ):\n mc.addAttr(beseMesh, ln='symmetryZ', at = \"long\" )\n mc.setAttr((beseMesh+'.symmetryZ'),getSymZ)\n boolSymmetryRestore()\n mc.select(cl=True)\n\n \ndef flattenAlllCutter():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n mc.select((beseMesh+'_cutterGrp'), hi=True)\n mc.select((beseMesh+'_cutterGrp'),d=True)\n if mc.objExists('bakeCutter*'):\n mc.select('bakeCutter*',d=True)\n selList = mc.ls(sl=1,fl=1,type='transform')\n if len(selList) > 1:\n #bake array \n for s in selList:\n if mc.objExists(s):\n mc.select(s)\n myType = checkInstType()\n if myType[1] != 'new':\n instBake()\n newNode = mc.ls(sl=1,fl=1)\n selList.append(newNode[0])\n \ndef instTypeCommandChange():\n checkState = mc.radioButtonGrp('arrayTypeButton',q=True, sl = True)\n if checkState == 1:\n #Lin\n mc.intSliderGrp('instNumSlider', e=1 ,dc = 'instReNew()' )\n mc.button('instXButton', e =True , c = 'instAdd(\"X\")') \n mc.button('instYButton', e =True , c = 'instAdd(\"Y\")') \n mc.button('instZButton', e =True , c = 'instAdd(\"Z\")') \n else:\n #Rad\n mc.intSliderGrp('instNumSlider', e=1 ,dc = 'instRadReNew()' )\n mc.button('instXButton', e =True , c = 'instRadAdd(\"X\")') \n mc.button('instYButton', e =True , c = 'instRadAdd(\"Y\")') \n mc.button('instZButton', e =True , c = 'instRadAdd(\"Z\")') \n\ndef instTypeToggle():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n currentSel =mc.ls(sl=1,fl=1)\n if len(currentSel) == 1:\n #case one Linear to Radial\n myType = checkInstType()\n if myType[1] != 'new':\n getNumber = mc.getAttr(myType[0]+'.arrayNumber')\n getDis = mc.getAttr(myType[0]+'.arrayOffset')\n getDir = mc.getAttr(myType[0]+'.arrayDirection')\n \n if myType[1] == 'linear':\n instRemove()\n mc.setAttr((myType[0]+'.arrayType'),'radial',type=\"string\")\n if mc.objExists((beseMesh +'_cutterGrp')) == 0:\n mc.CreateEmptyGroup()\n mc.rename((beseMesh +'_cutterGrp'))\n mc.parent((beseMesh +'_cutterGrp'),(beseMesh +'BoolGrp'))\n mc.parent(myType[0],(beseMesh +'_cutterGrp'))\n if mc.objExists(myType[0]+'ArrayGrp'):\n mc.delete(myType[0]+'ArrayGrp')\n \n instRadAdd(getDir)\n \n elif myType[1] == 'radial':\n removeRadArray()\n mc.setAttr((myType[0]+'.arrayType'),'linear',type=\"string\")\n mc.setAttr((myType[0]+'.arrayOffset'),getDis)\n \n #in case cutterGrp will get delete when delete history\n if mc.objExists((beseMesh +'_cutterGrp')) == 0:\n mc.CreateEmptyGroup()\n mc.rename((beseMesh +'_cutterGrp'))\n mc.parent((beseMesh +'_cutterGrp'),(beseMesh +'BoolGrp'))\n instAdd(getDir)\n mc.floatSliderGrp('disSlider',e=True, v= getDis ) \n instTypeCommandChange()\n\ndef freeResultMesh():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n boolSymmetryFreeze()\n resultMesh = beseMesh +'_bool'\n mc.select(resultMesh)\n mc.duplicate(rr=True)\n mc.rename(beseMesh)\n newNode = mc.ls(sl=True,fl=True)\n shapeNew = mc.listRelatives(newNode[0], s=True )\n mc.parent(w=True)\n mc.layerButton((beseMesh +'_BoolResult'), e=True ,lv=0)\n mc.setAttr((beseMesh +'BoolGrp.visibility'),0) \n mc.disconnectAttr((beseMesh+'_BoolResult.drawInfo'), (shapeNew[0]+'.drawOverride'))\n mc.editDisplayLayerMembers('defaultLayer',newNode)\n mc.textField(\"setMeshField\", e = True, text = '')\n \ndef checkInstType():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n arraySample = []\n checkGrp = mc.ls(sl=1,fl=1,l=1)\n if 'ArrayGrp' in checkGrp[0]:\n mc.connectControl('disSlider', (''))\n allChild = mc.listRelatives(checkGrp[0], ad=True)\n getShapeNode = mc.ls(allChild,type ='shape')\n listTransNode = mc.listRelatives(getShapeNode, p=True )\n arraySample = listTransNode\n checkMaster = mc.getAttr(arraySample[0]+'.arrayMaster')\n checkMasterType = mc.getAttr(arraySample[0]+'.arrayType')\n mc.floatSliderGrp('disSlider',e=True, en= True ) \n mc.intSliderGrp('instNumSlider',e=True, en= True )\n return (checkMaster,checkMasterType)\n else:\n if mc.attributeQuery('arrayMaster', node = checkGrp[0], ex=True ):\n checkMaster = mc.getAttr(checkGrp[0]+'.arrayMaster')\n checkMasterType = mc.getAttr(checkGrp[0]+'.arrayType')\n if checkMasterType != None:\n return (checkMaster,checkMasterType)\n else:\n return ('new','new')\n\n\ndef removeArrayGrp():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n selCutterCheck = mc.ls(sl=1, fl=1, l=1, type='transform')\n if len(selCutterCheck) == 1 and 'boxCutter' in selCutterCheck[0] and 'ArrayGrp' in selCutterCheck[0]:\n myType = checkInstType()\n mc.select(myType[0])\n if myType[1] == 'radial':\n removeRadArray()\n elif myType[1] == 'linear':\n instRemove()\n mc.parent(myType[0],(beseMesh +'_cutterGrp'))\n mc.delete(myType[0]+'ArrayGrp')\n mc.setAttr((myType[0]+'.arrayType'),'new',type=\"string\")\n mc.setAttr((myType[0]+'.arrayMaster'),'new',type=\"string\")\n \ndef instLink():\n myType = checkInstType()\n arraySample = myType[0]\n if myType[1] != 'new':\n if myType[1] == 'radial':\n #Rad\n mc.intSliderGrp('instNumSlider', e=1 ,dc = 'instRadReNew()' )\n mc.button('instXButton', e =True , c = 'instRadAdd(\"X\")') \n mc.button('instYButton', e =True , c = 'instRadAdd(\"Y\")') \n mc.button('instZButton', e =True , c = 'instRadAdd(\"Z\")') \n mc.radioButtonGrp('arrayTypeButton',e=True, sl = 2)\n #link\n checkMasterDir = mc.getAttr(arraySample+'.arrayDirection')\n OffsetDir =[]\n \n if checkMasterDir == 'X':\n OffsetDir = 'Y'\n elif checkMasterDir == 'Y':\n OffsetDir = 'X'\n else: \n OffsetDir = 'X'\n mc.connectControl('instNumSlider', (arraySample+\".arrayNumber\"))\n mc.floatSliderGrp('disSlider',e=True, en= True ) \n mc.connectControl('disSlider', (arraySample+\".arrayOffset\"))\n \n else:\n #Lin\n mc.intSliderGrp('instNumSlider', e=1 ,dc = 'instReNew()' )\n mc.button('instXButton', e =True , c = 'instAdd(\"X\")') \n mc.button('instYButton', e =True , c = 'instAdd(\"Y\")') \n mc.button('instZButton', e =True , c = 'instAdd(\"Z\")') \n mc.radioButtonGrp('arrayTypeButton',e=True, sl = 1)\n mc.connectControl('instNumSlider', (arraySample+\".arrayNumber\"))\n mc.connectControl('disSlider', (arraySample+\".arrayOffset\"))\n mc.select((arraySample+'ArrayGrp'))\n\n \ndef instRadReNew():\n mc.radioButtonGrp('arrayTypeButton',e=True, sl = 2)\n myType = checkInstType()\n if myType[1] != 'radial':#lin\n instLink()\n removeRadArray()\n checkMaster = myType[0]\n if mc.attributeQuery('arrayDirection', node = checkMaster, ex=True ):\n currentDir = mc.getAttr(checkMaster+'.arrayDirection')\n instRadAdd(currentDir)\n \n \ndef instRadAdd(direction):\n selCutterCheck = mc.ls(sl=1, fl=1, l=1, type='transform')\n if len(selCutterCheck) == 1 and 'boxCutter' in selCutterCheck[0] :\n mc.radioButtonGrp('arrayTypeButton',e=True, sl = 2)\n myType = checkInstType()\n #cutterOPDate = mc.getAttr(myType[0] +'.cutterOp')\n if myType[1] != 'radial' and myType[1] != 'new':#lin\n instAdd(direction)\n else: \n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n arraySample = mc.ls(sl=1,fl=1)\n if 'boxCutter' in arraySample[0] and len(arraySample)==1:\n removeRadArray()\n arraySample = mc.ls(sl=1,fl=1)\n dir = direction\n if myType[1] == 'new':\n rNumber = 3\n rDistance = 1\n else:\n rNumber = mc.intSliderGrp('instNumSlider', q=True, v = True)\n rDistance = mc.floatSliderGrp('disSlider', q=True, v = True)\n collection =[]\n \n #create Attr\n if not mc.attributeQuery('arrayNumber', node = arraySample[0], ex=True ):\n mc.addAttr(arraySample[0], ln='arrayNumber')\n \n if not mc.attributeQuery('arrayDirection', node = arraySample[0], ex=True ):\n mc.addAttr(arraySample[0], ln='arrayDirection' ,dt= 'string')\n \n if not mc.attributeQuery('arrayType', node = arraySample[0], ex=True ):\n mc.addAttr(arraySample[0], ln='arrayType',dt= 'string')\n \n if not mc.attributeQuery('arrayOffset', node = arraySample[0], ex=True ):\n mc.addAttr(arraySample[0], ln='arrayOffset') \n \n if not mc.attributeQuery('arrayMaster', node = arraySample[0], ex=True ):\n mc.addAttr(arraySample[0], ln='arrayMaster' ,dt= 'string')\n mc.setAttr((arraySample[0]+'.arrayOffset'),1)\n if not mc.attributeQuery('arrayLength', node = arraySample[0], ex=True ):\n mc.addAttr(arraySample[0], ln='arrayLength') \n \n mc.setAttr((arraySample[0]+'.arrayNumber'),rNumber)\n mc.setAttr((arraySample[0]+'.arrayOffset'),rDistance)\n mc.setAttr((arraySample[0]+'.arrayDirection'),dir,type=\"string\")\n mc.setAttr((arraySample[0]+'.arrayType'),'radial',type=\"string\")\n mc.setAttr((arraySample[0]+'.arrayMaster'),arraySample[0],type=\"string\")\n \n \n bbox= mc.xform(arraySample[0], q=1, ws=1, bb=1)\n length=math.sqrt((math.pow(bbox[0]-bbox[3],2)+math.pow(bbox[1]-bbox[4],2)+math.pow(bbox[2]-bbox[5],2))/3)\n mc.setAttr((arraySample[0]+'.arrayLength'),length)\n \n sourcePivot = mc.xform(arraySample[0], q=1, ws=1 ,rp=1) \n mc.group()\n mc.rename(arraySample[0]+'_Trans')\n mc.group()\n mc.rename(arraySample[0]+'_Rot')\n \n collection.append((arraySample[0]+'_Rot'))\n rAngle = 360.0 / rNumber \n \n mc.xform((arraySample[0]+'_Rot') ,ws=1, piv = (sourcePivot[0],sourcePivot[1],sourcePivot[2]))\n #inst\n boolNode = mc.listConnections(mc.listHistory((beseMesh +'_bool'),f=1),type='polyCBoolOp')\n for i in range(rNumber-1):\n\n mc.select((arraySample[0]+'_Rot'))\n mc.instance()\n newCutterRot = mc.ls(sl=1,fl=1)\n collection.append(newCutterRot[0])\n if dir == 'X':\n mc.rotate((rAngle*(i)+rAngle), 0 ,0, r=True, ws=True, fo=True)\n elif dir == 'Y':\n mc.rotate(0,(rAngle*(i)+rAngle),0, r=True, ws=True, fo=True)\n else: \n mc.rotate(0,0,(rAngle*(i)+rAngle), r=True, ws=True, fo=True)\n \n #Bool\n shapeNode = mc.listRelatives((newCutterRot[0]+'|'+ arraySample[0] +'_Trans|'+arraySample[0]), s=True )\n nextIndex = get_latest_free_multi_index((boolNode[0]+'.inputPoly'),0)\n mc.connectAttr( (shapeNode[0]+\".worldMatrix[\" + str(int(i)+ int(1)) + \"]\"), ((boolNode[0]+'.inputMat['+str(nextIndex)+']')),f=True)\n mc.connectAttr( (shapeNode[0]+\".outMesh\"), ((boolNode[0]+'.inputPoly['+str(nextIndex)+']')),f=True)\n \n mc.select(collection)\n mc.group()\n mc.rename(arraySample[0]+'ArrayGrp')\n OffsetDir =[]\n \n if dir == 'X':\n OffsetDir = 'Y'\n elif dir == 'Y':\n OffsetDir = 'X'\n else: \n OffsetDir = 'X'\n #mc.connectAttr( (arraySample[0]+\".arrayOffset\"), (arraySample[0]+\"_Trans.translate\" + OffsetDir),f=True)\n cmdTextA = (arraySample[0] + '_Trans.translate' + OffsetDir + '= ' + arraySample[0] + '.arrayLength *' + arraySample[0] + '.arrayOffset;')\n mc.expression( s = cmdTextA, o = (arraySample[0] + '_Trans.translate'), ae = True, uc = all)\n \n mc.select((arraySample[0]+'ArrayGrp'))\n mc.xform((arraySample[0]+'ArrayGrp') ,ws=1, piv = (sourcePivot[0],sourcePivot[1],sourcePivot[2]))\n mc.connectControl('instNumSlider', (arraySample[0]+\".arrayNumber\"))\n mc.floatSliderGrp('disSlider',e=True, en= True ) \n mc.connectControl('disSlider', (arraySample[0]+\".arrayOffset\"))\n\n\ndef removeRadArray():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n boolNode = mc.listConnections(mc.listHistory((beseMesh +'_bool'),f=1),type='polyCBoolOp')\n myType = checkInstType()\n if myType[1] == 'radial':\n arraySample = myType[0]\n mc.setAttr( (arraySample+\".arrayOffset\"),0)\n if mc.objExists(arraySample+'_Rot*'):\n mc.select(arraySample+'_Rot*')\n listRArray = mc.ls(sl=1,fl=1)\n mc.delete(listRArray[1:len(listRArray)])\n mc.parent(arraySample,beseMesh+'_cutterGrp')\n sourcePivot = mc.xform((arraySample+'_Rot'), q=1, ws=1 ,rp=1) \n mc.select(arraySample)\n mc.move( sourcePivot[0],sourcePivot[1],sourcePivot[2],rpr=True)\n if mc.objExists(arraySample+'ArrayGrp'):\n mc.delete(arraySample+'ArrayGrp')\n if mc.objExists(arraySample+'ArrayGrp'):\n mc.delete(arraySample+'ArrayGrp')\n \n shapeNode = mc.listRelatives(arraySample, s=True )\n listConnect = mc.connectionInfo((shapeNode[0]+'.outMesh'), dfs=True )\n if len(listConnect)>0:\n for a in listConnect:\n mc.disconnectAttr((shapeNode[0]+'.outMesh'), a)\n checkNumber = ''.join([n for n in arraySample.split('|')[-1] if n.isdigit()]) \n mc.connectAttr( (shapeNode[0]+\".outMesh\"), ((boolNode[0]+'.inputPoly['+str(checkNumber)+']')),f=True) \n mc.connectAttr( (shapeNode[0]+\".worldMatrix[0]\"), ((boolNode[0]+'.inputMat['+str(checkNumber)+']')),f=True)\n mc.select(arraySample) \n\n\ndef get_latest_free_multi_index( attr_name, start_index ):\n '''Find the latest unconnected multi index starting at the passed in index.'''\n listCuttersIndex = []\n while start_index < 100:\n if mc.connectionInfo( '{}[{}]'.format(attr_name,start_index), sfd=True ):\n listCuttersIndex.append(start_index)\n start_index += 1\n nextIndex = (listCuttersIndex[-1]+1)\n return nextIndex\n\ndef get_next_free_multi_index( attr_name, start_index ):\n\t'''Find the next unconnected multi index starting at the passed in index.'''\n\t# assume a max of 100 connections\n\twhile start_index < 100:\n\t\tif len( mc.connectionInfo( '{}[{}]'.format(attr_name,start_index), sfd=True ) or [] ) == 0:\n\t\t\treturn start_index\n\t\tstart_index += 1\n\n\t# No connections means the first index is available\n\treturn 0\t\t\t\n\ndef instBake():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n myType = checkInstType()\n if myType[1] != 'new':\n if myType[1] == 'radial':\n arraySample = myType[0]\n mc.select(arraySample+'ArrayGrp')\n mc.select(arraySample+'_Rot*')\n mc.select((arraySample+'_Rot'),d=1)\n listInstance = mc.ls(sl=1,fl=1, l=1)\n \n mc.select((arraySample+'_Rot'))\n mc.ConvertInstanceToObject()\n \n unInstanceMesh = mc.ls(sl=1,fl=1, l=1)\n mc.select(listInstance)\n mel.eval(\"pickWalk -d down\")\n mc.delete()\n \n for l in listInstance:\n mc.select(unInstanceMesh)\n mc.duplicate()\n mc.select(l,add=1)\n mc.MatchTransform()\n mc.delete(l)\n \n mc.select((arraySample+'ArrayGrp'))\n mc.select(hi=True)\n mc.select((arraySample+'ArrayGrp'),d=True)\n getShapeNode = mc.ls(sl=1,type ='shape')\n mc.select(getShapeNode)\n mel.eval(\"pickWalk -d up\")\n listNew=mc.ls(sl=1,fl=1,l=1)\n mc.parent(listNew,(arraySample+'ArrayGrp'))\n listNew=mc.ls(sl=1,fl=1,l=1)\n \n for n in listNew:\n mc.rename(n,'tempCutter01')\n \n listBake=mc.ls('tempCutter0*',s=1)\n \n while len(listBake) > 1:\n mc.polyCBoolOp(listBake[0], listBake[1], op=1, ch=1, preserveColor=0, classification=1, name=listBake[0])\n mc.DeleteHistory()\n #if mc.objExists(listBake[0]):\n #mc.delete(listBake[0])\n if mc.objExists(listBake[1]):\n mc.delete(listBake[1])\n mc.rename(listBake[0])\n listBake.remove(listBake[1])\n #in case cutterGrp will get delete when delete history\n if mc.objExists((beseMesh +'_cutterGrp')) == 0:\n mc.CreateEmptyGroup()\n mc.rename((beseMesh +'_cutterGrp'))\n mc.parent((beseMesh +'_cutterGrp'),(beseMesh +'BoolGrp'))\n mc.select(listBake)\n useOwnCutterShape()\n mc.rename(arraySample)\n sourcePivot = mc.xform((arraySample+'ArrayGrp'), q=1, ws=1 ,rp=1) \n mc.xform(arraySample ,ws=1, piv = (sourcePivot[0],sourcePivot[1],sourcePivot[2]))\n if mc.objExists(arraySample+'ArrayGrp'):\n mc.delete(arraySample+'ArrayGrp')\n mc.ogs(reset =1)\n else:\n arraySample = myType[0]\n mc.select(arraySample+'ArrayGrp')\n mc.select(hi=True)\n mc.select(arraySample+'ArrayGrp',arraySample,d=1)\n collectInst = mc.ls(sl=1,fl=1,type = 'transform')\n mc.select(collectInst)\n mc.ConvertInstanceToObject()\n collectInst.append(arraySample)\n collectInst.reverse()\n listBake = collectInst\n while len(listBake) > 1:\n mc.polyCBoolOp(listBake[0], listBake[1], op=1, ch=0, preserveColor=0, classification=1, name=listBake[0])\n mc.DeleteHistory()\n mc.rename('tempMergeShape')\n if mc.objExists(listBake[0]):\n mc.delete(listBake[0])\n if mc.objExists(listBake[1]):\n mc.delete(listBake[1])\n mc.rename(listBake[0])\n listBake.remove(listBake[1])\n \n #in case cutterGrp will get delete when delete history\n if mc.objExists((beseMesh +'_cutterGrp')) == 0:\n mc.CreateEmptyGroup()\n mc.rename((beseMesh +'_cutterGrp'))\n mc.parent((beseMesh +'_cutterGrp'),(beseMesh +'BoolGrp'))\n mc.select(listBake)\n useOwnCutterShape()\n mc.rename(listBake[0])\n if mc.objExists(listBake[0]+'ArrayGrp'):\n mc.delete(listBake[0]+'ArrayGrp')\n mc.select(arraySample) \n fixBoolNodeConnection()\n\ndef fixBoolNodeConnection():\n transNode = mc.ls(sl=1,fl=1)\n checkNumber = ''.join([n for n in transNode[0].split('|')[-1] if n.isdigit()]) \n shapeNode = mc.listRelatives(transNode[0], s=True ,f=True)\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n boolNode = mc.listConnections(mc.listHistory((beseMesh +'_bool'),f=1),type='polyCBoolOp')\n if len(shapeNode)>0:\n listConnect = mc.connectionInfo((shapeNode[0]+'.outMesh'), dfs=True )\n if len(listConnect)>0:\n for a in listConnect:\n mc.disconnectAttr((shapeNode[0]+'.outMesh'), a)\n mc.connectAttr( (shapeNode[0]+\".outMesh\"), ((boolNode[0]+'.inputPoly['+str(checkNumber)+']')),f=True) \n \n listConnectMa = mc.connectionInfo((shapeNode[0]+'.worldMatrix[0]'), dfs=True )\n if len(listConnectMa)>0:\n for b in listConnectMa:\n mc.disconnectAttr((shapeNode[0]+'.worldMatrix[0]'), b)\n mc.connectAttr( (shapeNode[0]+\".worldMatrix[0]\"), ((boolNode[0]+'.inputMat['+str(checkNumber)+']')),f=True) \n\ndef instReNew():\n myType = checkInstType()\n if myType[1] != 'new':\n mc.radioButtonGrp('arrayTypeButton',e=True, sl = 1)\n myType = checkInstType()\n if myType[1] != 'linear':#lin\n instLink()\n instRemove()\n checkMaster = myType[0]\n currentDir = mc.getAttr(checkMaster+'.arrayDirection')\n instAdd(currentDir) \n \n\ndef instRemove():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n boolNode = mc.listConnections(mc.listHistory((beseMesh+'_bool'),f=1),type='polyCBoolOp')\n myType = checkInstType()\n if myType[1] == 'linear':\n arraySample = myType[0]\n listA = mc.listConnections(arraySample,type = 'expression')\n if listA != None:\n listA = set(listA)\n collectInst=[]\n for l in listA:\n checkConnection = mc.connectionInfo( (l+'.output[0]'), dfs=True)\n mesh = checkConnection[0].split(\".\")[0]\n collectInst.append(mesh)\n mc.delete(collectInst)\n shapeNode = mc.listRelatives(arraySample, s=True )\n listConnect = mc.connectionInfo((shapeNode[0]+'.outMesh'), dfs=True )\n if len(listConnect)>0:\n for a in listConnect:\n mc.disconnectAttr((shapeNode[0]+'.outMesh'), a)\n checkNumber = ''.join([n for n in arraySample.split('|')[-1] if n.isdigit()]) \n mc.connectAttr( (shapeNode[0]+\".outMesh\"), ((boolNode[0]+'.inputPoly['+str(checkNumber)+']')),f=True) \n mc.connectAttr( (shapeNode[0]+\".worldMatrix[0]\"), ((boolNode[0]+'.inputMat['+str(checkNumber)+']')),f=True)\n mc.select(arraySample) \n \ndef instAdd(direction):\n selCutterCheck = mc.ls(sl=1, fl=1, l=1, type='transform')\n if len(selCutterCheck) == 1 and 'boxCutter' in selCutterCheck[0]:\n mc.radioButtonGrp('arrayTypeButton',e=True, sl = 1)\n myType = checkInstType()\n\n if myType[1] == 'radial':#lin\n instRadAdd(direction)\n else: \n instRemove()\n dir = direction\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n if len(beseMesh) > 0:\n arraySample = mc.ls(sl=1,fl=1)\n sourcePivot = mc.xform(arraySample[0], q=1, ws=1 ,rp=1) \n if 'boxCutter' in arraySample[0] and len(arraySample)==1:\n bbox= mc.xform(arraySample[0], q=1, ws=1, bb=1)\n myLength = []\n if dir == 'X':\n myLength=math.sqrt((math.pow(bbox[0]-bbox[3],2)))\n if dir == 'Y':\n myLength=math.sqrt((math.pow(bbox[1]-bbox[4],2)))\n if dir == 'Z':\n myLength=math.sqrt((math.pow(bbox[2]-bbox[5],2)))\n \n getIntNumber = []\n getDist = []\n if myType[1] == 'new':\n getIntNumber = 2\n getDist = 1.5\n \n else:\n getIntNumber = mc.intSliderGrp('instNumSlider', q=True, v = True)\n getDist = mc.floatSliderGrp('disSlider', q=True, v = True)\n \n #create Attr\n if not mc.attributeQuery('arrayNumber', node = arraySample[0], ex=True ):\n mc.addAttr(arraySample[0], ln='arrayNumber')\n \n if not mc.attributeQuery('arrayDirection', node = arraySample[0], ex=True ):\n mc.addAttr(arraySample[0], ln='arrayDirection' ,dt= 'string')\n \n if not mc.attributeQuery('arrayType', node = arraySample[0], ex=True ):\n mc.addAttr(arraySample[0], ln='arrayType',dt= 'string')\n \n if not mc.attributeQuery('arrayLength', node = arraySample[0], ex=True ):\n mc.addAttr(arraySample[0], ln='arrayLength') \n \n if not mc.attributeQuery('arrayOffset', node = arraySample[0], ex=True ):\n mc.addAttr(arraySample[0], ln='arrayOffset') \n \n if not mc.attributeQuery('arrayMaster', node = arraySample[0], ex=True ):\n mc.addAttr(arraySample[0], ln='arrayMaster' ,dt= 'string')\n mc.setAttr((arraySample[0]+'.arrayOffset'),1)\n \n mc.setAttr((arraySample[0]+'.arrayNumber'),getIntNumber)\n mc.setAttr((arraySample[0]+'.arrayDirection'),dir,type=\"string\")\n mc.setAttr((arraySample[0]+'.arrayType'),'linear',type=\"string\")\n mc.setAttr((arraySample[0]+'.arrayLength'),myLength)\n mc.setAttr((arraySample[0]+'.arrayMaster'),arraySample[0],type=\"string\")\n \n dirA = (arraySample[0]+'.translate'+dir)\n collections=[] \n boolNode = mc.listConnections(mc.listHistory((beseMesh +'_bool'),f=1),type='polyCBoolOp')\t\t\t\t\t\n for i in range(getIntNumber-1):\n mc.select(arraySample[0])\n mc.instance()\n newIns = mc.ls(sl=1,fl=1)\n collections.append(newIns[0])\n if not mc.attributeQuery('arrayOrder', node = newIns[0], ex=True ):\n mc.addAttr(newIns[0], ln='arrayOrder')\n mc.setAttr((newIns[0]+'.arrayOrder'),(i+1)) \n mc.setAttr((arraySample[0] + '.arrayOffset'),getDist)\n cmdTextA = (newIns[0] + '.translate' + dir + '= ' + arraySample[0] + '.arrayLength *' + arraySample[0] + '.arrayOffset *' + newIns[0] + '.arrayOrder +'+ dirA +';')\n mc.expression( s = cmdTextA, o = newIns[0], ae = True, uc = all)\n #Bool\n shapeNode = mc.listRelatives(newIns[0], s=True )\n nextIndex = get_latest_free_multi_index((boolNode[0]+'.inputPoly'),0)\n mc.connectAttr( (shapeNode[0]+\".worldMatrix[\" + str(int(i)+ int(1)) + \"]\"), ((boolNode[0]+'.inputMat['+str(nextIndex)+']')),f=True)\n mc.connectAttr( (shapeNode[0]+\".outMesh\"), ((boolNode[0]+'.inputPoly['+str(nextIndex)+']')),f=True)\n \n \n \n mc.select(arraySample[0],collections)\n \n parent = mc.listRelatives(arraySample[0], p=True )\n if not 'ArrayGrp' in parent[0]:\n mc.group()\n mc.rename(arraySample[0]+'ArrayGrp')\n mc.xform((arraySample[0]+'ArrayGrp') ,ws=1, piv = (sourcePivot[0],sourcePivot[1],sourcePivot[2]))\n mc.intSliderGrp('instNumSlider',e=True, en= True ) \n mc.connectControl('instNumSlider', (arraySample[0]+\".arrayNumber\"))\n mc.floatSliderGrp('disSlider',e=True, en= True ) \n mc.connectControl('disSlider', (arraySample[0]+\".arrayOffset\"))\n mc.select((arraySample[0]+'ArrayGrp'))\n #if cutterOPDate == 'subs':\n # cutterType(\"subs\")\n #elif cutterOPDate == 'union':\n # cutterType(\"union\")\n #else:\n # cutterType(\"inter\")\n\ndef makeDrawBlock():\n mc.ScaleTool()\n curveSel = mc.ls(sl=1,fl=1)\n if len(curveSel) == 1 :\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n if mc.objExists('drawPlaneGrp') == 0:\n if mc.objExists('lineDrawPlane'):\n mc.delete('lineDrawPlane*')\n mc.snapMode(grid=0)\n shapeNode = mc.listRelatives(curveSel[0], f = True, shapes=True)\n checkOpen = mc.getAttr(shapeNode[0]+'.form')\n if checkOpen == 0:\n mc.closeCurve( curveSel[0], ch=True, rpo=True )\n \n mc.select(curveSel)\n mc.duplicate()\n mc.group(w=True)\n mc.rename('tempMirrorGrp')\n \n if mc.objExists('drawPlaneGrp'):\n mc.parent('tempMirrorGrp','drawPlaneGrp')\n mc.FreezeTransformations()\n mc.setAttr('tempMirrorGrp.translateY',-1)\n \n \n else:\n current = mc.textField(\"camPlane\" ,q=True, text = True)\n mesh = (beseMesh +'_bool')\n meshCOORD = mc.objectCenter(mesh,gl=True)\n mc.xform(ws=True, pivots =[meshCOORD[0],meshCOORD[1],meshCOORD[2]])\n if current == 'front' or current == 'back':\n mc.scale(1,1,-1)\n \n elif current == 'top' or current == 'buttom':# check y asix\n mc.scale(1,-1,1)\n \n elif current == 'left' or current == 'right':# check x asix\n mc.scale(-1,1,1)\n \n mc.Ungroup()\n mc.select(curveSel,add=1)\n mc.FreezeTransformations()\n curveSel = mc.ls(sl=1,fl=1)\n mc.select(curveSel)\n loftNode = mc.loft(ch =1, u=1, c= 0, ar= 1, d= 3, ss= 1, rn= 0, po =1, rsn= True)\n list = mc.listConnections(loftNode, type = 'nurbsTessellate')\n \n mc.setAttr((list[0]+'.polygonType'), 1)\n mc.setAttr((list[0]+'.format'), 2)\n mc.setAttr((list[0]+'.uNumber'), 1)\n mc.setAttr((list[0]+'.vNumber'), 1)\n mc.FillHole()\n mc.delete(curveSel)\n mc.rename('drawBlock')\n blockSel = mc.listRelatives(mc.listRelatives(f = True, shapes=True), parent=1 , f=1 )\n mc.CenterPivot()\n mc.polyMergeVertex(blockSel,d = 0.01, am= 1,ch=0)\n mc.polySetToFaceNormal()\n renew = mc.listRelatives(mc.listRelatives(f = True, shapes=True), parent=1 , f=1 )\n mc.DeleteHistory()\n #fix normal direction\n checkNormalMehs = mc.ls(sl=1,fl=1,l=1)\n mc.polyExtrudeFacet(constructionHistory = 1, keepFacesTogether= 1, ltz = 0.001) \n mc.polySeparate(checkNormalMehs,ch=0)\n testMesh = mc.ls(sl=1,fl=1)\n \n worldFaceA = mc.polyEvaluate(testMesh[0],wa=True)\n worldFaceB = mc.polyEvaluate(testMesh[1],wa=True)\n if worldFaceA > worldFaceB:\n mc.delete(testMesh[1])\n else:\n mc.delete(testMesh[0])\n mc.parent(w=True)\n mc.delete(checkNormalMehs[0])\n mc.rename('drawBlock1')\n newBlock = mc.ls(sl=1,fl=1)\n mc.select(newBlock[0])\n mc.DeleteHistory()\n if mc.objExists('drawPlaneGrp'):\n mc.parent(newBlock[0],'drawPlaneGrp')\n mc.FreezeTransformations() \n mc.CenterPivot()\n mc.parent(newBlock[0],w=True)\n if mc.objExists('drawPlaneGrp'):\n mc.delete('drawPlaneGrp*')\n if mc.objExists('lineDrawPlane'):\n mc.delete('lineDrawPlane*')\n \n\ndef resizeSnapGrid():\n if mc.objExists('lineDrawPlane'):\n gridData= mc.intSliderGrp('snapGirdSize', q = True, v =True)\n #change gridSize\n mc.makeLive(n=True)\n mc.grid( spacing=10, d= gridData )\n mc.makeLive('lineDrawPlane')\n mc.snapMode(grid=1)\n\n\ndef drawGirdToggle():\n if mc.objExists('lineDrawPlane'):\n mc.delete('lineDrawPlane')\n if mc.objExists('drawPlaneGrp'):\n mc.delete('drawPlaneGrp')\n drawGirdOff()\n else:\n current = mc.textField(\"camPlane\" ,q=True, text = True)\n curPanel = mc.getPanel(wf=1)\n \n if not 'modelPanel' in curPanel:\n curPanel = 'modelPanel4'\n mc.modelEditor( curPanel,e=1, planes=1)\n curCam = mc.modelPanel(curPanel,q=1, cam=1)\n orthoValue = mc.camera(curCam,q=1, o=1)\n if orthoValue ==0:\n camRot = mc.camera(curCam,q=1, rot=1)\n camRotFixed = []\n for i in range(2):\n camRotTemp = camRot[i] / 360\n intOfTemp = int(camRotTemp)\n rotOver = 360 * intOfTemp\n camRotFixed.append( camRot[i] - rotOver)\n \n for i in range(2):\n if camRotFixed[i] < 0 :\n \t camRotFixed[i]= camRotFixed[i] +360;\n \n cameraUsed=[]\n if (camRotFixed[0] >= 45 and camRotFixed[0] < 135):\n cameraUsed = 'buttom'\n elif (camRotFixed[0] >= 225 and camRotFixed[0] < 315):\n cameraUsed = 'top'\n elif (camRotFixed[1] < 45):\n cameraUsed = 'front'\n elif (camRotFixed[1] >= 315 ):\n cameraUsed = 'front'\n elif (camRotFixed[1] >= 45 and camRotFixed[1] < 135):\n cameraUsed = 'right'\n elif (camRotFixed[1] >= 135 and camRotFixed[1] < 225):\n cameraUsed = 'back'\n elif (camRotFixed[1] >= 225 and camRotFixed[1] < 315):\n cameraUsed = 'left'\n \n if len(current) ==0 :\n mc.textField(\"camPlane\" ,e=True, text = cameraUsed)\n drawGirdOn()\n else:\n if current == cameraUsed:\n if mc.objExists('lineDrawPlane'):\n mc.delete('lineDrawPlane*')\n if mc.objExists('tempScaleOffset'):\n mc.delete('tempScaleOffset*')\n mc.snapMode(grid=0)\n mc.MoveTool()\n drawGirdOff()\n else:\n mc.textField(\"camPlane\" ,e=True, text = cameraUsed)\n drawGirdOn()\n else:\n if mc.objExists('lineDrawPlane'):\n mc.delete('lineDrawPlane*')\n if mc.objExists('tempScaleOffset'):\n mc.delete('tempScaleOffset*')\n mc.textField(\"camPlane\" ,e=True, text = cameraUsed)\n drawGirdOn()\n\ndef drawGirdOff():\n mc.connectControl('snapGirdSize', (''))\n mc.intSliderGrp('snapGirdSize',e=1, en=0)\n if mc.objExists('lineDrawPlane'):\n mc.delete('lineDrawPlane*')\n if mc.objExists('tempScaleOffset'):\n mc.delete('tempScaleOffset*')\n mc.snapMode(grid=0)\n mc.MoveTool()\n\ndef drawGirdOn():\n mc.intSliderGrp('snapGirdSize',e=1, en=1)\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n gridData= mc.intSliderGrp('snapGirdSize', q = True, v =True)\n curPanel = mc.getPanel(wf=1)\n if not 'modelPanel' in curPanel:\n curPanel = 'modelPanel4'\n curCam = mc.modelPanel(curPanel,q=1, cam=1)\n cameraPos = mc.xform(curCam,q=1,ws=1,t=1)\n \n mesh = (beseMesh +'_bool')\n bbox= mc.xform(mesh, q=1, ws=1, bb=1)\n length=math.sqrt((math.pow(bbox[0]-bbox[3],2)+math.pow(bbox[1]-bbox[4],2)+math.pow(bbox[2]-bbox[5],2))/3)\n length = int(length *1.1 )\n meshCOORD = mc.objectCenter(mesh,gl=True)\n cameraUsed = mc.textField(\"camPlane\" ,q=True, text = True)\n constructionPlanePos=[]\n if mc.objExists('lineDrawPlane'):\n mc.delete('lineDrawPlane')\n if mc.objExists('drawPlaneGrp'):\n mc.delete('drawPlaneGrp')\n if cameraUsed == 'front' or cameraUsed == 'back':\n if cameraUsed == 'front':\n planePos = bbox[5]\n elif cameraUsed == 'back':\n if (bbox[2] - cameraPos[2]) > 0:\n planePos = bbox[2]\n \n constructionPlanePos = [meshCOORD[0],meshCOORD[1],planePos] \n mc.plane(s=length, r=[0,0,90])\n \n elif cameraUsed == 'top' or cameraUsed == 'buttom':# check y asix\n if cameraUsed == 'top':\n planePos = bbox[4]\n elif cameraUsed == 'buttom': \n planePos = bbox[1]\n constructionPlanePos = [meshCOORD[0],planePos,meshCOORD[2]] \n mc.plane(s=length, r=[90,0,0])\n\n elif cameraUsed == 'left' or cameraUsed == 'right':# check x asix\n if cameraUsed == 'right':\n planePos = bbox[3]\n elif cameraUsed == 'left':\n planePos = bbox[0]\n constructionPlanePos = [planePos,meshCOORD[1],meshCOORD[2]] \n mc.plane(s=length, r=[0,90,0])\n \n else:# later\n pass\n \n mc.move(constructionPlanePos[0],constructionPlanePos[1],constructionPlanePos[2],absolute=1)\n mc.rename('lineDrawPlane')\n mc.group()\n mc.rename('tempScaleOffset')\n mc.xform(ws=True, pivots =[meshCOORD[0],meshCOORD[1],meshCOORD[2]])\n mc.setAttr('tempScaleOffset.scaleX', 1.05)\n mc.setAttr('tempScaleOffset.scaleY', 1.05)\n mc.setAttr('tempScaleOffset.scaleZ', 1.05)\n mc.parent('lineDrawPlane',w=True)\n mc.delete('tempScaleOffset')\n mc.makeLive('lineDrawPlane')\n mc.snapMode(grid=1)\n resizeSnapGrid()\n mc.CVCurveTool()\n mc.curveCVCtx(mc.currentCtx(), e=True, d=1, bez= 0) \n\n\ndef reBuildCutter():# when cutter has too much history and start getting funny, this can rebuild cutter\n newCutter = mc.ls(sl=True,fl=True,type = 'transform')\n checkSelType = mc.filterExpand(sm=12 )\n if checkSelType != None:\n checkNoCustom = mc.getAttr(newCutter[0]+'.cutterType')\n if checkNoCustom != \"custom\" :\n QlinkSlider()\n cutterDirData = mc.getAttr(newCutter[0]+'.cutterDir')\n cutterTypeData = mc.getAttr(newCutter[0]+'.cutterType')\n cutterPanelGap = mc.getAttr(newCutter[0]+'.panelGap')\n cutterIntPanelGap = mc.getAttr(newCutter[0]+'.intPanelGap')\n cutterIntScaleX = mc.getAttr(newCutter[0]+'.intScaleX')\n cutterStateCap = mc.getAttr(newCutter[0]+'.stateCap')\n cutterStatePanel = mc.getAttr(newCutter[0]+'.statePanel')\n \n fractionSliderData = mc.floatSliderGrp('fractionSlider', q = True, v =True)\n segmentSliderData= mc.intSliderGrp('segmentSlider', q = True, v =True)\n depthSliderData= mc.floatSliderGrp('depthSlider', q = True, v =True)\n gapSliderData = mc.floatSliderGrp('gapSlider', q = True, v =True)\n removePanel()\n QBoxBevelRemove()\n QBoxBevel()\n QlinkSlider()\n \n bevelNode = mc.listConnections(mc.listHistory(newCutter,f=1),type='polyBevel3')\n if bevelNode != None:\n mc.setAttr((bevelNode[0] + '.fraction'), fractionSliderData)\n mc.setAttr((bevelNode[0] + '.segments'), segmentSliderData) \n mc.setAttr((bevelNode[0] + '.depth'), depthSliderData) \n \n if cutterStatePanel == 1:\n makeSelPanel()\n \n if cutterStateCap == 0:\n makeSelPanelNoCap()\n else:\n makeSelPanelReCap()\n else:\n print 'function do not supple custom shape!'\n else:\n print 'function ONLY supple obj!'\n \ndef bevelPreviewSetting():\n checkState = mc.frameLayout( 'bevelPreSettingLayer', q=1, vis = 1)\n if checkState == 1:\n mc.frameLayout( 'bevelPreSettingLayer', e=1 ,vis = 0)\n mc.window(\"jwSpeedCutWin\",e=1, h = 850)\n else:\n mc.frameLayout( 'bevelPreSettingLayer', e=1 ,vis = 1)\n mc.window(\"jwSpeedCutWin\",e=1, h = 1000)\n\n \ndef toggleCapPanel():\n newCutter = mc.ls(sl=True,fl=True,type = 'transform')\n myType = checkInstType()\n if myType[1] != 'new':\n newCutter[0] = myType[0]\n checkSelType = mc.filterExpand(sm=12 )\n if checkSelType != None:\n checkBevelType = mc.getAttr(newCutter[0]+'.cutterType')\n checkCapState = mc.getAttr(newCutter[0]+'.stateCap')\n mc.select(newCutter[0])\n if checkBevelType == 'smooth':\n makeSelPanel()\n mc.setAttr((newCutter[0]+'.stateCap'),1)\n else:\n if checkCapState == 0:\n makeSelPanelReCap()\n mc.setAttr((newCutter[0]+'.stateCap'),1)\n else:\n makeSelPanelNoCap()\n mc.setAttr((newCutter[0]+'.stateCap'),0)\n \n #reBuildCutter()#question this will change shape a lot, [] --> O, rebuild ---> (==)\n else:\n print 'function ONLY supple obj!' \n\ndef makeSelPanelReCap():\n newCutter = mc.ls(sl=True,fl=True,type = 'transform')\n extrudeNode = mc.listConnections(mc.listHistory(newCutter,f=1),type='polyExtrudeFace')\n if extrudeNode != None:\n mc.delete(extrudeNode)\n mc.polySelectConstraint(mode = 3, type = 0x8000, where =1)\n mc.polySelectConstraint(disable =True)\n holeEdge = mc.ls(sl=True,fl=True)\n if len(holeEdge)>0:\n mc.polyCloseBorder(ch = 0)\n mc.setAttr((newCutter[0]+'.stateCap'),1)\n mc.select(newCutter) \n if extrudeNode != None:\n makeSelPanel()\n mc.select(newCutter)\n \ndef makeSelPanelNoCap():\n newCutter = mc.ls(sl=True,fl=True,type = 'transform')\n checkSelType = mc.filterExpand(sm=12 )\n if checkSelType != None:\n #check cutter type, if no Ngon = a box\n #Ngon = bevel or cylider\n mc.polySelectConstraint( mode = 3, type = 0x0008, size = 1)\n mc.polySelectConstraint(disable =True)\n triPolys = mc.polyEvaluate(faceComponent =True)\n #if triPolys == 0: #not sphere, go next\n mc.setAttr((newCutter[0]+'.stateCap'),0)\n mc.polySelectConstraint( mode = 3, type = 0x0008, size = 3)\n mc.polySelectConstraint(disable =True)\n nPolys = mc.ls(sl=True,fl=True)\n deleteList = []\n if len(nPolys) > 0:\n deleteList = nPolys\n else:\n deleteList = (newCutter[0]+'.f[4]',newCutter[0]+'.f[5]')\n \n extrudeNode = mc.listConnections(mc.listHistory(newCutter,f=1),type='polyExtrudeFace')\n if extrudeNode != None:\n mc.delete(extrudeNode)\n \n gapV = []\n storeX = mc.getAttr( newCutter[0] + '.scaleX')\n gapV = mc.floatSliderGrp('gapSlider', q=True, v = True)\n if gapV == 0:\n gapV = 0.01\n mc.floatSliderGrp('gapSlider', e = True, v=0.01)\n mc.setAttr((newCutter[0]+'.panelGap'),gapV)\n mc.setAttr((newCutter[0]+'.intPanelGap'),gapV)\n mc.setAttr((newCutter[0]+'.intScaleX'),storeX)\n \n mc.delete(deleteList)\n mc.select(newCutter)\n extNode = mc.polyExtrudeFacet( constructionHistory=True, keepFacesTogether = True, smoothingAngle=30, tk = gapV )\n cmdText = (extNode[0] + '.thickness = ' + newCutter[0] + '.intScaleX/' + newCutter[0] + '.scaleX*' + str(gapV) + '*' + newCutter[0] + '.panelGap/' + newCutter[0] + '.intPanelGap')\n mc.expression( s = cmdText, o = extNode[0], ae = True, uc = all)\n \n mc.select(newCutter) \n mc.floatSliderGrp('gapSlider', e = True, en=1)\n mc.connectControl('gapSlider', (newCutter[0]+\".panelGap\")) \n mc.select(newCutter)\n else:\n print 'function ONLY supple obj!' \n \ndef removePanel():\n newCutter = mc.ls(sl=True,fl=True,type = 'transform')\n checkSelType = mc.filterExpand(sm=12 )\n if checkSelType != None:\n extrudeNode = mc.listConnections(mc.listHistory(newCutter,f=1),type='polyExtrudeFace')\n if extrudeNode != None:\n mc.delete(extrudeNode)\n mc.polySelectConstraint(mode = 3, type = 0x8000, where =1)\n mc.polySelectConstraint(disable =True)\n holeEdge = mc.ls(sl=True,fl=True)\n if len(holeEdge)>0:\n mc.polyCloseBorder(ch = 0)\n mc.setAttr((newCutter[0]+'.statePanel'),0)\n mc.setAttr((newCutter[0]+'.stateCap'),1)\n mc.select(newCutter)\n mc.connectControl('gapSlider', (''))\n mc.floatSliderGrp('gapSlider', e = True, en=0)\n else:\n print 'function ONLY supple obj!' \n \ndef makeSelPanel():\n newCutter = mc.ls(sl=True,fl=True,type = 'transform')\n checkSelType = mc.filterExpand(sm=12 )\n if checkSelType != None:\n extrudeNode = mc.listConnections(mc.listHistory(newCutter,f=1),type='polyExtrudeFace')\n if extrudeNode != None:\n mc.delete(extrudeNode)\n \n gapV = []\n storeX = mc.getAttr( newCutter[0] + '.scaleX')\n gapV = mc.floatSliderGrp('gapSlider', q=True, v = True)\n if gapV == 0:\n gapV = 0.01\n mc.floatSliderGrp('gapSlider', e = True, v=0.01)\n mc.setAttr((newCutter[0]+'.panelGap'),gapV)\n mc.setAttr((newCutter[0]+'.intPanelGap'),gapV)\n mc.setAttr((newCutter[0]+'.intScaleX'),storeX)\n extNode = mc.polyExtrudeFacet( constructionHistory=True, keepFacesTogether = True, smoothingAngle=30, tk = gapV )\n cmdText = (extNode[0] + '.thickness = ' + newCutter[0] + '.intScaleX/' + newCutter[0] + '.scaleX*' + str(gapV) + '*' + newCutter[0] + '.panelGap/' + newCutter[0] + '.intPanelGap')\n mc.expression( s = cmdText, o = extNode[0], ae = True, uc = all)\n \n mc.select(newCutter) \n mc.floatSliderGrp('gapSlider', e = True, en=1)\n mc.connectControl('gapSlider', (newCutter[0]+\".panelGap\")) \n mc.setAttr((newCutter[0]+'.statePanel'),1)\n\n else:\n print 'function ONLY supple obj!'\n\n \n\ndef hideAllCutter():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n getCutters = mc.ls((beseMesh+'_cutterGrp|boxCutter*'),type = 'transform',l=True)\n mc.hide(getCutters)\n\ndef showLastCutter():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n currentOne = mc.ls(sl=True,fl=True)\n getCutters = mc.ls((beseMesh+'_cutterGrp|boxCutter*'),type = 'transform')\n checkVis = []\n \n for g in getCutters:\n checkme = mc.getAttr(g+'.visibility')\n if checkme == 1:\n checkVis.append(g) \n if len(currentOne) == 1:\n checkSel = mc.getAttr(currentOne[0]+'.visibility')\n mc.hide(getCutters)\n if checkSel == 0:\n mc.setAttr((currentOne[0]+'.visibility'), 1)\n else:\n if len(checkVis) > 1:\n mc.select(currentOne)\n mc.showHidden(currentOne)\n elif len(checkVis) == 1:\n preCutter = 0\n for i in range(len(getCutters)):\n if getCutters[i] == currentOne[0]:\n preCutter = i - 1\n mc.select(getCutters[preCutter])\n mc.showHidden(getCutters[preCutter])\n else:\n mc.select(getCutters[-1])\n mc.showHidden(getCutters[-1])\n \n else:\n mc.hide(getCutters)\n mc.select(getCutters[-1])\n mc.showHidden(getCutters[-1])\n mc.setAttr((beseMesh+'_cutterGrp.visibility'), 1)\n\ndef showAllCutter():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n getCutters = mc.ls((beseMesh+'_cutterGrp|boxCutter*'),type = 'transform',l=True)\n mc.showHidden(getCutters)\n mc.setAttr((beseMesh+'_cutterGrp.visibility'), 1)\n\n \ndef toggleCutters():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n currentSel = mc.ls(sl= True)\n state = mc.getAttr((beseMesh+'_cutterGrp.visibility'))\n if state == 0:\n mc.setAttr((beseMesh+'_cutterGrp.visibility'), 1)\n else:\n mc.setAttr((beseMesh+'_cutterGrp.visibility'), 0)\n mc.select(currentSel)\n\ndef QlinkSliderRemove():\n newCutter = mc.ls(sl=True,fl=True,type = 'transform')\n mc.connectControl('fractionSlider', (''))\n mc.connectControl('segmentSlider', (''))\n mc.connectControl('depthSlider', (''))\n mc.connectControl('gapSlider', (''))\n\n \n mc.floatSliderGrp('fractionSlider',e=True, en= False ) \n mc.intSliderGrp('segmentSlider',e=True, en= False ) \n mc.floatSliderGrp('depthSlider',e=True, en= False )\n mc.floatSliderGrp('gapSlider',e=True, en= False )\n \n \n \ndef QlinkSlider():\n QlinkSliderRemove()\n newCutter = mc.ls(sl=True,fl=True,type = 'transform')\n if len(newCutter) < 1:\n newCutter = mc.ls(hl=True)\n if len(newCutter) < 1:\n print 'no cutter Selected'\n else:\n bevelNode = mc.listConnections(mc.listHistory(newCutter,f=1),type='polyBevel3')\n if bevelNode != None:\n mc.floatSliderGrp('fractionSlider',e=True, en= True ) \n mc.intSliderGrp('segmentSlider',e=True, en= True ) \n mc.floatSliderGrp('depthSlider',e=True, en= True ) \n mc.connectControl('fractionSlider', (bevelNode[0]+\".fraction\"))\n mc.connectControl('segmentSlider', (bevelNode[0]+\".segments\"))\n mc.connectControl('depthSlider', (bevelNode[0]+\".depth\"))\n extrudeNode = mc.listConnections(mc.listHistory(newCutter,f=1),type='polyExtrudeFace')\n if extrudeNode != None:\n mc.floatSliderGrp('gapSlider',e=True, en= True )\n mc.connectControl('gapSlider', (newCutter[0]+\".panelGap\")) \n\n\ndef jwMirror(axis):\n selPoly = mc.filterExpand(sm = 12)\n checkSel = mc.ls(sl=True,fl=True)\n \n #get center cv\n if selPoly == None:\n selPoly = mc.ls(hl=True)\n mc.FreezeTransformations()\n #get selected bbox\n bboxObj = mc.xform(selPoly[0] , q = True, ws =True, bb=True)\n \n #mirror or mirrorCut\n #mirror\n mirrorMode = 0\n \n if axis == 'x' :\n if bboxObj[3] > 0 and bboxObj[0] > 0:\n mirrorMode = 1\n elif bboxObj[3] < 0 and bboxObj[0] < 0:\n mirrorMode = 1\n \n elif axis == 'y' :\n if bboxObj[4] > 0 and bboxObj[1] > 0:\n mirrorMode = 1\n elif bboxObj[4] < 0 and bboxObj[1] < 0:\n mirrorMode = 1\n \n elif axis == 'z' :\n if bboxObj[5] > 0 and bboxObj[2] > 0:\n mirrorMode = 1\n elif bboxObj[5] < 0 and bboxObj[2] < 0:\n mirrorMode = 1\n else:\n pass\n \n if mirrorMode == 1:\n mc.select(selPoly[0])\n cutterMirror(axis)\n #mirrorCut\n else:\n \n lengthObj=math.sqrt((math.pow(bboxObj[0]-bboxObj[3],2)+math.pow(bboxObj[1]-bboxObj[4],2)+math.pow(bboxObj[2]-bboxObj[5],2))/3)\n closeRange = lengthObj / 100\n \n bboxSel = mc.xform(q = True, ws =True, bb=True)\n midX = (bboxSel[3]+bboxSel[0])/2\n midY = (bboxSel[4]+bboxSel[1])/2\n midZ = (bboxSel[5]+bboxSel[2])/2\n inRangeCv = []\n if len(selPoly) == 1:\n vNo = mc.polyEvaluate(selPoly[0], v = True )\n checkPoint = 0\n if axis == 'x' :\n checkPoint = 0\n elif axis == 'y' :\n checkPoint = 1\n else:\n checkPoint = 2\n for i in range(vNo):\n positionV = mc.pointPosition((selPoly[0] +'.vtx[' + str(i) + ']') , w = True)\n length= math.sqrt(math.pow(positionV[checkPoint],2))\n if length <= closeRange:\n inRangeCv.append((selPoly[0] +'.vtx[' + str(i) + ']'))\n mc.select(inRangeCv, r=True)\n \n # push those point off center a bit then mirror cut\n if axis == 'x' :\n for n in inRangeCv:\n posiV = mc.pointPosition(n , w = True)\n if midX >= 0: \n mc.move((closeRange * -1.5) , posiV[1], posiV[2], n ,absolute=1) \n else:\n mc.move( (closeRange * 1.5) , posiV[1], posiV[2], n ,absolute=1) \n cutPlane= mc.polyCut(selPoly[0], ws = True, cd = 'X' , df = True , ch =True)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterX'), 0)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterY'), 0)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterZ'), 0)\n if midX > 0:\n mc.setAttr((cutPlane[0]+'.cutPlaneRotateY'), 90) \n mc.polyMirrorFace(selPoly[0],cutMesh =1, axis = 0, axisDirection = 1, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n else:\n mc.setAttr((cutPlane[0]+'.cutPlaneRotateY'), -90)\n mc.polyMirrorFace(selPoly[0],cutMesh =1, axis = 0, axisDirection = 0, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n \n if axis == 'y' :\n for n in inRangeCv:\n posiV = mc.pointPosition(n , w = True)\n if midY >= 0: \n mc.move(posiV[0], (closeRange * -1.5) , posiV[2], n ,absolute=1) \n else:\n mc.move(posiV[0], (closeRange * 1.5) , posiV[2], n ,absolute=1) \n cutPlane= mc.polyCut(selPoly[0], ws = True, cd = 'Y' , df = True , ch =True)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterX'), 0)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterY'), 0)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterZ'), 0)\n if midY > 0:\n mc.setAttr((cutPlane[0]+'.cutPlaneRotateX'), -90) \n mc.polyMirrorFace(selPoly[0],cutMesh =1, axis = 1, axisDirection = 1, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n else:\n mc.setAttr((cutPlane[0]+'.cutPlaneRotateX'), 90)\n mc.polyMirrorFace(selPoly[0],cutMesh =1, axis = 1, axisDirection = 0, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n \n if axis == 'z' :\n for n in inRangeCv:\n posiV = mc.pointPosition(n , w = True)\n if midZ >= 0: \n mc.move(posiV[0], posiV[1],(closeRange * -1.5), n ,absolute=1) \n else:\n mc.move(posiV[0], posiV[1],(closeRange * 1.5), n ,absolute=1) \n cutPlane= mc.polyCut(selPoly[0], ws = True, cd = 'Z' , df = True , ch =True)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterX'), 0)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterY'), 0)\n mc.setAttr((cutPlane[0]+'.cutPlaneCenterZ'), 0)\n if midZ > 0:\n mc.setAttr((cutPlane[0]+'.cutPlaneRotateY'), 0) \n mc.polyMirrorFace(selPoly[0],cutMesh =1, axis = 2, axisDirection = 1, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n else:\n mc.setAttr((cutPlane[0]+'.cutPlaneRotateY'), 180)\n mc.polyMirrorFace(selPoly[0],cutMesh =1, axis = 2, axisDirection = 0, mergeMode = 1, mergeThresholdType = 1, mergeThreshold =0.001, mirrorAxis = 0 ,mirrorPosition = 0 ,smoothingAngle= 30 ,flipUVs =0 ,ch = 0)\n mc.select(selPoly[0])\n mc.BakeNonDefHistory()\n\ndef cutterMirror(direction):\n listSel = mc.ls(sl=True, fl=True ,l=True)\n if len(listSel) > 0 and 'boxCutter' in listSel[0] and 'ArrayGrp' not in listSel[0]:\n mc.duplicate(rr=True, un=True)\n mc.group()\n if mc.objExists('tempPivot'):\n mc.delete('tempPivot')\n mc.rename('tempPivot')\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n meshCOORD = mc.objectCenter(beseMesh,gl=True)\n mc.xform(ws=True, pivots =[meshCOORD[0],meshCOORD[1],meshCOORD[2]])\n \n if direction == 'x':\n mc.setAttr( ('tempPivot.scaleX'),-1) \n if direction == 'y':\n mc.setAttr( ('tempPivot.scaleY'),-1) \n if direction == 'z':\n mc.setAttr( ('tempPivot.scaleZ'),-1) \n mc.FreezeTransformations()\n \n mc.select(mc.listRelatives('tempPivot', c=True, f = True, typ='transform'))\n mc.select((beseMesh+'_cutterGrp'), add=True)\n mc.parent()\n listNew = mc.ls(sl=True, fl=True ,l=True)\n boolNode = mc.listConnections(mc.listHistory((beseMesh +'_bool'),f=1),type='polyCBoolOp')\n for l in listNew:\n shapeNode = mc.listRelatives(l, f = True, shapes=True)\n nextIndex = get_latest_free_multi_index((boolNode[0]+'.inputPoly'),0)\n mc.connectAttr( (shapeNode[0]+\".worldMatrix[0]\"), ((boolNode[0]+'.inputMat['+str(nextIndex)+']')),f=True)\n mc.connectAttr( (shapeNode[0]+\".outMesh\"), ((boolNode[0]+'.inputPoly['+str(nextIndex)+']')),f=True)\n \n mc.delete('tempPivot')\n for s in listSel:\n mc.setAttr((s+'.visibility'),0)\n mc.select(listNew)\n\ndef useOwnCutterShape(): \n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n ownCutter = mc.ls(sl=True, fl=True ,l=True)\n if len(ownCutter) == 1 :\n if ('_cutterGrp') in ownCutter[0]:\n print 'shape already been used'\n else:\n mc.parent(ownCutter,(beseMesh+'_cutterGrp'))\n listOldCutter = mc.ls((beseMesh+'_cutterGrp|box*'))\n number = 1\n if len(listOldCutter)>0:\n for l in listOldCutter:\n checkNumber = ''.join([n for n in l.split('|')[-1] if n.isdigit()])\n if int(checkNumber) > int(number):\n number = checkNumber\n newNumber = int(1)+ int(number)\n number = newNumber\n newName = 'boxCutter'+str(number)\n mc.rename(newName)\n newCutter = mc.ls(sl=True, fl=True)\n shapeNode = mc.listRelatives(newCutter[0], f = True, shapes=True)\n mc.setAttr( (shapeNode[0]+\".overrideEnabled\") , 1)\n mc.setAttr( (shapeNode[0]+\".overrideShading\") , 0)\n mc.setAttr( (shapeNode[0]+\".castsShadows\") , 0)\n mc.setAttr( (shapeNode[0]+\".receiveShadows\") , 0)\n mc.setAttr( (shapeNode[0]+\".primaryVisibility\") , 0)\n mc.setAttr( (shapeNode[0]+\".visibleInReflections\") , 0)\n mc.setAttr( (shapeNode[0]+\".visibleInRefractions\") , 0)\n mc.setAttr( (shapeNode[0]+'.overrideColor'), 28)\n \n boolNode = mc.listConnections(mc.listHistory((beseMesh +'_bool'),f=1),type='polyCBoolOp')\n if boolNode != None:\n nextIndex = get_latest_free_multi_index((boolNode[0]+'.inputPoly'),0)\n mc.connectAttr( (shapeNode[0]+\".worldMatrix[0]\"), ((boolNode[0]+'.inputMat['+str(nextIndex)+']')),f=True)\n mc.connectAttr( (shapeNode[0]+\".outMesh\"), ((boolNode[0]+'.inputPoly['+str(nextIndex)+']')),f=True)\n \n if not mc.attributeQuery('cutterDir', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='cutterDir', dt= 'string')\n if not mc.attributeQuery('cutterType', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='cutterType', dt= 'string')\n mc.setAttr((newCutter[0]+'.cutterDir'),e=True, keyable=True)\n mc.setAttr((newCutter[0]+'.cutterType'),e=True, keyable=True)\n \n if not mc.attributeQuery('statePanel', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='statePanel', at = \"float\" )\n if not mc.attributeQuery('panelGap', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='panelGap', at = \"float\" )\n if not mc.attributeQuery('intPanelGap', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='intPanelGap', at = \"float\" )\n if not mc.attributeQuery('intScaleX', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='intScaleX', at = \"float\" )\n if not mc.attributeQuery('stateCap', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='stateCap', at = \"float\" )\n mc.setAttr((newCutter[0]+'.stateCap'),1)\n mc.setAttr((newCutter[0]+'.statePanel'),0)\n mc.select(newCutter[0])\n mc.setAttr((newCutter[0]+'.cutterType'),'custom' ,type=\"string\")\n mc.select(cl=True)\n showLastCutter()\n else:\n print 'nothing select!'\n \ndef cutterDulpicate():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n dulCutter = mc.ls(sl=True, fl=True , l=True)\n checkParent = dulCutter[0].split('|')\n if len(checkParent)>2 and 'boxCutter' in dulCutter[0] and 'cutterGrp' in dulCutter[0]: \n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n mc.duplicate(rr = True, un=True)\n number = ''.join([n for n in checkParent[-1] if n.isdigit()])\n newNumber = int(1) + int(number)\n newName = 'boxCutter'+str(newNumber)\n while mc.objExists(newName):\n newNumber = newNumber +1\n newName = 'boxCutter'+str(newNumber)\n mc.rename(newName)\n newCutter = mc.ls(sl=True, fl=True)\n shapeNode = mc.listRelatives(newCutter[0], f = True, shapes=True)\n mc.setAttr( (shapeNode[0]+\".overrideEnabled\") , 1)\n mc.setAttr( (shapeNode[0]+\".overrideShading\") , 0)\n mc.setAttr( (shapeNode[0]+\".castsShadows\") , 0)\n mc.setAttr( (shapeNode[0]+\".receiveShadows\") , 0)\n mc.setAttr( (shapeNode[0]+\".primaryVisibility\") , 0)\n mc.setAttr( (shapeNode[0]+\".visibleInReflections\") , 0)\n mc.setAttr( (shapeNode[0]+\".visibleInRefractions\") , 0)\n boolNode = mc.listConnections(mc.listHistory((beseMesh +'_bool'),f=1),type='polyCBoolOp')\n if boolNode != None:\n nextIndex = get_latest_free_multi_index((boolNode[0]+'.inputPoly'),0)\n mc.connectAttr( (shapeNode[0]+\".worldMatrix[0]\"), ((boolNode[0]+'.inputMat['+str(nextIndex)+']')),f=True)\n mc.connectAttr( (shapeNode[0]+\".outMesh\"), ((boolNode[0]+'.inputPoly['+str(nextIndex)+']')),f=True)\n mc.select(newCutter[0])\n QlinkSlider()\n showLastCutter()\n else:\n print 'select geo is not an existing cutter!!'\n\ndef QChangeCutterDir():\n selObj = mc.ls(sl=1, fl=1,l=True, type='transform')\n if len(selObj) == 1:\n \n checkMasterDir = []\n checkMasterNumber = []\n checkMasterDis = []\n arraySample = []\n myType = checkInstType()\n if 'ArrayGrp' in selObj[0]:\n myType = checkInstType()\n arraySample = myType[0]\n if myType[1] != 'new':\n checkMasterDir = mc.getAttr(arraySample+'.arrayDirection')\n checkMasterNumber = mc.getAttr(arraySample+'.arrayNumber')\n checkMasterDis = mc.getAttr(arraySample+'.arrayOffset')\n checkMasterType = myType[1]\n if myType[1] == 'radial':\n removeRadArray()\n else:\n instRemove()\n selObj = mc.ls(sl=1, fl=1,l=True, type='transform')\n\tmc.setAttr((selObj[0]+'.rotateX'), 0)\n mc.setAttr((selObj[0]+'.rotateY'), 0)\n mc.setAttr((selObj[0]+'.rotateZ'), 0) \n\tcutterDirection = mc.getAttr(selObj[0]+'.cutterDir')\n nextDir = []\n if cutterDirection == 'x':\n nextDir = 'Z'\n mc.setAttr((selObj[0]+'.cutterDir'),'z',type=\"string\")\n elif cutterDirection == 'y':\n nextDir = 'X'\n mc.setAttr((selObj[0]+'.cutterDir'),'x',type=\"string\")\n else:\n nextDir = 'Y'\n mc.setAttr((selObj[0]+'.cutterDir'),'y',type=\"string\")\n parnetGrp = mc.listRelatives(selObj[0], parent =1, f=1)\n mc.group(em=True, name = (selObj[0]+'_offset'),parent = parnetGrp[0])\n newNode = mc.ls(sl=True,fl=True)\n mc.FreezeTransformations()\n sourcePivot = mc.xform(selObj[0], q=1, ws=1 ,rp=1) \n mc.xform(newNode ,ws=1, piv = (sourcePivot[0],sourcePivot[1],sourcePivot[2]))\n mc.parent(selObj[0],newNode)\n mc.setAttr((newNode[0]+'.rotate' + nextDir), 90)\n newNode = mc.ls(sl=True,fl=True)\n parnetGrpRemove = mc.listRelatives(newNode[0], parent =1, f=1)\n mc.parent(newNode[0],parnetGrp)\n mc.delete(parnetGrpRemove)\n newNode = mc.ls(sl=True,fl=True)\n if myType[1] != 'new':\n if myType[1] == 'radial':\n instRadAdd(checkMasterDir)\n else:\n instAdd(checkMasterDir)\n mc.setAttr((newNode[0]+'.arrayNumber'),checkMasterNumber)\n mc.setAttr((newNode[0]+'.arrayOffset'),checkMasterDis)\n\ndef QBoxSmooth():\n newCutter = mc.ls(sl=True,fl=True,type = 'transform')\n if len(newCutter) == 1 and 'boxCutter' in newCutter[0]:\n if 'ArrayGrp' in newCutter[0]:\n myType = checkInstType()\n newCutter[0] = (myType[0])\n #in case gap exist\n extrudeNode = mc.listConnections(mc.listHistory(newCutter,f=1),type='polyExtrudeFace')\n if extrudeNode != None: \n removePanel()\n bevelNode = mc.listConnections(mc.listHistory(newCutter,f=1),type='polyBevel3')\n bevelType = [] \n getFrac = []\n getSeg = []\n getDep = []\n mc.select(newCutter)\n if bevelNode != None:\n mc.makeIdentity( newCutter, apply=True, scale=True ) \n #record old setting\n getFrac = mc.getAttr(bevelNode[0]+'.fraction')\n getSeg = mc.getAttr(bevelNode[0]+'.segments')\n getDep = mc.getAttr(bevelNode[0]+'.depth')\n mc.delete(bevelNode)\n mc.DeleteHistory() \n bevelNodeNew = mc.polyBevel3(newCutter[0], mv = 1, mvt =0.01, fn = 1, fraction = 0.5, offsetAsFraction = 1, autoFit = 1, depth = 1, mitering = 0, miterAlong = 0, chamfer = 1, segments = 5, ch = 1)\n if bevelNode != None: \n mc.setAttr((bevelNodeNew[0]+'.fraction'),getFrac)\n mc.setAttr((bevelNodeNew[0]+'.segments'),getSeg)\n mc.setAttr((bevelNodeNew[0]+'.depth'),getDep)\n QlinkSlider() \n mc.setAttr((newCutter[0]+'.cutterType'),'smooth',type=\"string\") \n \ndef QBoxBevel():\n newCutter = mc.ls(sl=True,fl=True,type = 'transform')\n if len(newCutter) == 1 and 'boxCutter' in newCutter[0]:\n if 'ArrayGrp' in newCutter[0]:\n myType = checkInstType()\n newCutter[0] = (myType[0])\n #in case gap exist\n extrudeNode = mc.listConnections(mc.listHistory(newCutter,f=1),type='polyExtrudeFace')\n gapV = []\n if extrudeNode != None: \n gapV = mc.getAttr(extrudeNode[0]+'.localTranslateZ')\n removePanel()\n bevelNode = mc.listConnections(mc.listHistory(newCutter,f=1),type='polyBevel3')\n bevelList = []\n bevelType = [] \n getFrac = []\n getSeg = []\n getDep = []\n mc.select(newCutter)\n mc.makeIdentity( newCutter, apply=True, scale=True ) \n if bevelNode != None:\n #record old setting\n getFrac = mc.getAttr(bevelNode[0]+'.fraction')\n getSeg = mc.getAttr(bevelNode[0]+'.segments')\n getDep = mc.getAttr(bevelNode[0]+'.depth')\n mc.delete(bevelNode)\n mc.DeleteHistory() \n \n mc.select(newCutter)\n mc.polySelectConstraint(mode = 3, type = 0x0008, size=1)\n mc.polySelectConstraint(disable =True)\n triFind = mc.ls(sl=1,fl=1)\n mc.select(newCutter)\n mc.polySelectConstraint(mode = 3, type = 0x0008, size=3)\n mc.polySelectConstraint(disable =True)\n ngonFind = mc.ls(sl=1,fl=1)\n \n if len(triFind) > 0 or len(ngonFind) > 0:\n if len(triFind) > 0:\n mc.select(triFind)\n else: \n mc.select(ngonFind)\n mc.select(newCutter) \n mc.ConvertSelectionToFaces()\n mc.select(ngonFind,d=True)\n mc.ConvertSelectionToContainedEdges()\n bevelList = mc.ls(sl=1,fl=1)\n else:#case is cube\n checkNoCustom = mc.getAttr(newCutter[0]+'.cutterType')\n if checkNoCustom == 'custom':\n mc.select(str(newCutter[0] + '.e[4:5]'))\n mc.select(str(newCutter[0] + '.e[8:9]'), add =1 )\n bevelList = mc.ls(sl=1,fl=1)\n else:\n bevelList = str(newCutter[0] + '.e[8:11]')\n \n bevelNodeNew = mc.polyBevel3(bevelList, mv = 1, mvt =0.01, fn = 1, fraction = 0.5, offsetAsFraction = 1, autoFit = 1, depth = 1, mitering = 0, miterAlong = 0, chamfer = 1, segments = 5, ch = 1)\n if bevelNode != None: \n mc.setAttr((bevelNodeNew[0]+'.fraction'),getFrac)\n mc.setAttr((bevelNodeNew[0]+'.segments'),getSeg)\n mc.setAttr((bevelNodeNew[0]+'.depth'),getDep)\n \n if extrudeNode != None:\n makeSelPanel()\n mc.select(newCutter) \n QlinkSlider()\n instLink()\n else:\n mc.ConvertSelectionToEdges()\n selEdges =mc.filterExpand(ex =1, sm =32)\n if len(selEdges)>0:\n bevelNodeNew = mc.polyBevel3(selEdges, mv = 1, mvt =0.01, fn = 1, fraction = 0.5, offsetAsFraction = 1, autoFit = 1, depth = 1, mitering = 0, miterAlong = 0, chamfer = 1, segments = 5, ch = 1)\n newCutter=mc.ls(hl=True)\n mc.select(newCutter)\n QlinkSlider()\n mc.setAttr((newCutter[0]+'.cutterType'),'bevel',type=\"string\") \n \ndef QBoxBevelRemove():\n newCutter = mc.ls(sl=True,fl=True,type = 'transform')\n checkSelType = mc.filterExpand(sm=12 )\n if checkSelType != None:\n if 'ArrayGrp' in newCutter[0]:\n myType = checkInstType()\n newCutter[0] = (myType[0])\n checkNoCustom = mc.getAttr(newCutter[0]+'.cutterType')\n\n mc.makeIdentity( newCutter, apply=True, scale=True )\n shapeNode = mc.listRelatives(newCutter, f = True, shapes=True)\n bevelNode = mc.listConnections(mc.listHistory(shapeNode,f=1),type='polyBevel3')\n if bevelNode != None:\n mc.delete(bevelNode)\n mc.DeleteHistory()\n mc.setAttr((newCutter[0]+'.cutterType'),'none',type=\"string\")\n instLink()\n\n\ndef addBevelDirectionAttr():\n newCutter = mc.ls(sl=True, fl=True)\n mc.setAttr((newCutter[0]+'.cutterDir'),'x',type=\"string\")\n mc.setAttr((newCutter[0]+'.cutterType'),'bevel',type=\"string\")\n\n\ndef onPressCutter():\n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n member =mc.editDisplayLayerMembers((beseMesh+'_BoolResult'),q=True)\n snapMesh = (beseMesh +'_boolShape')\n vpX, vpY, _ = mc.draggerContext('meshPlace', query=True, anchorPoint=True)\n #print(vpX, vpY)\n pos = om.MPoint()\n dir = om.MVector()\n hitpoint = om.MFloatPoint()\n omui.M3dView().active3dView().viewToWorld(int(vpX), int(vpY), pos, dir)\n pos2 = om.MFloatPoint(pos.x, pos.y, pos.z)\n shortestD = 99999999999999999\n getMesh = []\n shortPosition= []\n mesh = snapMesh\n selectionList = om.MSelectionList()\n selectionList.add(snapMesh)\n dagPath = om.MDagPath()\n selectionList.getDagPath(0, dagPath)\n fnMesh = om.MFnMesh(dagPath)\n intersection = fnMesh.closestIntersection(\n om.MFloatPoint(pos2),\n om.MFloatVector(dir),\n None,\n None,\n False,\n om.MSpace.kWorld,\n 99999,\n False,\n None,\n hitpoint,\n None,\n None,\n None,\n None,\n None)\n if intersection:\n x = hitpoint.x\n y = hitpoint.y\n z = hitpoint.z\n newName = mc.listRelatives(mesh, p=True )\n #intersection on closet obj, for multi intersections remove distrance check\n distanceBetween = math.sqrt( ((float(pos2[0]) - hitpoint.x)**2) + ((float(pos2[1]) - hitpoint.y)**2) + ((float(pos2[2]) - hitpoint.z)**2))\n if (shortestD > distanceBetween):\n shortestD = distanceBetween\n getMesh = newName\n shortPosition = [x, y, z]\n if len(shortPosition) > 0:\n mc.spaceLocator(p=(shortPosition[0],shortPosition[1],shortPosition[2]),n = (getMesh[0]+'_cutterPoint'))\n\n\ndef offPressCutter():\n sideNumber = mc.intSliderGrp('cutterSideSlider', q=1, v = True)\n preRotAngle = []\n if sideNumber == 3:\n preRotAngle = 60\n elif sideNumber == 4:\n preRotAngle = 45\n elif sideNumber == 5:\n preRotAngle = 72\n elif sideNumber == 6:\n preRotAngle = 30 \n \n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n boolNode = mc.listConnections(mc.listHistory((beseMesh+'_bool'),f=1),type='polyCBoolOp')\n nextIndex = get_latest_free_multi_index((boolNode[0]+'.inputPoly'),0)\n \n member =mc.editDisplayLayerMembers((beseMesh+'_BoolResult'),q=True)\n snapMesh =[]\n if member != None:\n snapMesh = member[0]\n mc.setToolTo('moveSuperContext')\n newlocator =mc.ls('*_cutterPoint',sl =True)\n if len(newlocator) > 0:\n snapObj=snapMesh\n mc.CenterPivot()\n mc.geometryConstraint( snapObj , newlocator[0], weight = 1)\n mc.normalConstraint( snapObj , newlocator[0], aimVector =(0, 1, 0) , upVector =(1, 0, 0))\n mc.rename('sampleLocCtrl')\n mc.polyCylinder(r = 1, h= 1.5 ,sx= sideNumber, sy =0, sz=0, rcp= 0 , cuv =3 ,ch=1)\n mc.rename('boxCutter'+str(nextIndex))\n newCutter = mc.ls(sl=True, fl=True)\n mc.setAttr( (newCutter[0]+'.rotateY'), preRotAngle)\n mc.makeIdentity((newCutter[0]),apply =1, t = 0, r = 1, s =0, n =0, pn= 1)\n #mc.CenterPivot()\n mc.group()\n mc.rename('sampleLoc')\n mc.xform(ws =True, piv =(0,0,0))\n refTopNode = mc.ls(sl = True,fl =True, type= 'transform')[0]\n mc.parent(refTopNode,'sampleLocCtrl')\n locX = mc.getAttr(\"sampleLocCtrl.localPositionX\")\n locY = mc.getAttr(\"sampleLocCtrl.localPositionY\")\n locZ = mc.getAttr(\"sampleLocCtrl.localPositionZ\")\n mc.setAttr(\"sampleLoc.translateX\", locX)\n mc.setAttr(\"sampleLoc.translateY\", locY) \n mc.setAttr(\"sampleLoc.translateZ\", locZ)\n mc.setAttr(\"sampleLoc.rotateX\", 0)\n mc.setAttr(\"sampleLoc.rotateY\", 0) \n mc.setAttr(\"sampleLoc.rotateZ\", 0) \n transDownNode = mc.listRelatives('sampleLoc', c=True,f=True )\n mc.select(transDownNode)\n mc.parent(w=True)\n mc.delete('sampleLocCtrl*')\n #cutter in position\n #add attr\n shapeNode = mc.listRelatives(newCutter[0], shapes=True ,f =True)\n mc.setAttr( (shapeNode[0]+\".overrideEnabled\") , 1)\n mc.setAttr( (shapeNode[0]+\".overrideShading\") , 0)\n mc.setAttr( (shapeNode[0]+\".castsShadows\") , 0)\n mc.setAttr( (shapeNode[0]+\".receiveShadows\") , 0)\n mc.setAttr( (shapeNode[0]+\".primaryVisibility\") , 0)\n mc.setAttr( (shapeNode[0]+\".visibleInReflections\") , 0)\n mc.setAttr( (shapeNode[0]+\".visibleInRefractions\") , 0)\n mc.setAttr( (shapeNode[0]+'.overrideColor'), 28)\n \n if not mc.attributeQuery('cutterDir', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='cutterDir', dt= 'string')\n if not mc.attributeQuery('cutterType', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='cutterType', dt= 'string')\n mc.setAttr((newCutter[0]+'.cutterDir'),e=True, keyable=True)\n mc.setAttr((newCutter[0]+'.cutterType'),e=True, keyable=True)\n \n if not mc.attributeQuery('cutterOp', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='cutterOp', dt= 'string')\n mc.setAttr((newCutter[0]+'.cutterOp'),e=True, keyable=True)\n mc.setAttr((newCutter[0]+'.cutterOp'),'subs',type=\"string\")\n \n if not mc.attributeQuery('statePanel', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='statePanel', at = \"float\" )\n if not mc.attributeQuery('panelGap', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='panelGap', at = \"float\" )\n if not mc.attributeQuery('intPanelGap', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='intPanelGap', at = \"float\" )\n if not mc.attributeQuery('intScaleX', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='intScaleX', at = \"float\" )\n if not mc.attributeQuery('stateCap', node = newCutter[0], ex=True ):\n mc.addAttr(newCutter[0], ln='stateCap', at = \"float\" )\n mc.setAttr((newCutter[0]+'.stateCap'),1)\n mc.setAttr((newCutter[0]+'.statePanel'),0)\n #group it\n mc.parent(newCutter,(beseMesh+'_cutterGrp'))\n fixBoolNodeConnection()\n addBevelDirectionAttr()\n QlinkSliderRemove()\n showLastCutter()\n \ndef goPressCutter(boxSide):\n mc.intSliderGrp('cutterSideSlider', e=1, v = boxSide)\n ctx = 'meshPlace'\n if mc.draggerContext(ctx, exists=True):\n mc.deleteUI(ctx)\n mc.draggerContext(ctx, pressCommand = onPressCutter, rc = offPressCutter, name=ctx, cursor='crossHair')\n mc.setToolTo(ctx)\n \n\n\ndef setCutterBaseMesh():\n beseMesh = mc.ls(sl=True,fl=True,type='transform')\n topNode = mel.eval('rootOf '+beseMesh[0])\n\n if 'BoolGrp' in topNode:\n removeGrp = topNode.replace('BoolGrp','')\n removeParent = removeGrp.replace('|','')\n mc.textField(\"setMeshField\" , e = True, text = removeParent)\n else: \n mc.textField(\"setMeshField\" , e = True, text = beseMesh[0])\n \n beseMesh = mc.textField(\"setMeshField\", q = True, text = True)\n if mc.objExists((beseMesh +'_cutterGrp')) == 0:\n mc.CreateEmptyGroup()\n mc.rename((beseMesh +'_cutterGrp'))\n\n if mc.objExists((beseMesh +'_bool')) ==0:\n mc.polyCube(w = 0.01, h=0.01, d=0.01 ,sx =1 ,sy= 1, sz= 1)\n mc.rename(beseMesh +'_preBoolBox') \n mc.polyCBoolOp(beseMesh, (beseMesh +'_preBoolBox') , op= 2, ch= 1, preserveColor= 0, classification= 1, name= (beseMesh +'_bool')) \n \n boolNode = mc.listConnections(mc.listHistory((beseMesh +'_bool'),f=1),type='polyCBoolOp')\n if boolNode[0] != (beseMesh +'_myBool'):\n mc.rename(boolNode[0],(beseMesh +'_myBool'))\n \n \n if mc.objExists((beseMesh +'BoolGrp')) == 0:\n mc.select(beseMesh,(beseMesh +'_cutterGrp'),(beseMesh +'_bool'))\n mc.group()\n mc.rename((beseMesh +'BoolGrp'))\n \n mc.setAttr((beseMesh + '.visibility'), 0)\n baseNodes = mc.listRelatives(beseMesh, ad = True, f = True)\n baseTransNode = mc.ls(baseNodes,type = 'transform')\n baseMeshNode = mc.ls(baseNodes,type = 'mesh')\n mc.setAttr((baseMeshNode[0]+'.intermediateObject'), 0)\n mc.parent(baseMeshNode[0],(beseMesh +'BoolGrp'))\n mc.delete(beseMesh)\n mc.rename(beseMesh)\n \n if not mc.objExists((beseMesh +'_BoolResult')):\n mc.createDisplayLayer(name = (beseMesh +'_BoolResult'))\n mc.editDisplayLayerMembers( (beseMesh +'_BoolResult'),(beseMesh +'_bool')) # store my selection into the display layer\n mc.setAttr((beseMesh +'_BoolResult.displayType'),2) \n \n checkList = ['_cutterGrp','_preBoolBox']\n for c in checkList:\n checkGrp = mc.ls((beseMesh + c), l=True)\n if 'BoolGrp' not in checkGrp[0]:\n mc.parent(checkGrp[0],(beseMesh +'BoolGrp'))\n\n mc.select(cl=True)\n\n\ndef jwSpeedCutUI():\n if mc.window(\"jwSpeedCutWin\", exists = True):\n mc.deleteUI(\"jwSpeedCutWin\")\n jwSpeedCutWin = mc.window(\"jwSpeedCutWin\",title = \"speedCut 1.02\",w = 320,h = 780, mxb = False, s = 1 ,bgc = [0.14, 0.17, 0.2 ])\n mc.columnLayout()\n mc.text(l ='')\n mc.rowColumnLayout(nc=7 ,cw=[(1,60),(2, 5),(3,125),(4, 5),(5,50),(6, 5),(7,35)])\n mc.text(l ='BaseMesh')\n mc.text(l ='')\n mc.textField(\"setMeshField\" ,ed =False,w = 100,bgc = [0.2,0.2,0.2])\n mc.text(l ='')\n mc.button('setBaseButton',w = 50, l= \"Set\", c = 'setCutterBaseMesh()', bgc = [0.24, 0.24, 0.24 ] )\n mc.text(l ='')\n mc.button('freeResultButton',w = 35, l= \"Done\", c = 'freeResultMesh()', bgc = [0.54, 0.24, 0.24 ] )\n mc.setParent( '..' )\n mc.separator( height=15, style='none' )\n \n mc.rowColumnLayout(nc=9 ,cw=[(1,40),(2,60),(3, 38),(4,5),(5, 38),(6,5),(7,38),(8,5),(9,58)])\n mc.text(l ='Sym',h=20)\n mc.radioButtonGrp('symDirButton', numberOfRadioButtons = 2, sl= 1, labelArray2 = ['+', '-'],cw2 =(30,20))\n \n mc.button( w = 30, l= \"X\", c = 'boolSymmetryCut(\"x\")', bgc = [0.08,0.08,0.08] )\n mc.text(l ='')\n mc.button(w = 30, l= \"Y\", c ='boolSymmetryCut(\"y\")', bgc = [0.08,0.08,0.08])\n mc.text(l ='')\n mc.button(w = 30, l= \"Z\", c ='boolSymmetryCut(\"z\")', bgc = [0.08,0.08,0.08] )\n mc.text(l ='')\n mc.button(w = 40, l= \"Freeze\", c ='boolSymmetryFreeze()', bgc = [0.54, 0.24, 0.24 ] )\n mc.setParent( '..' )\n mc.separator( height= 15, style='none' )\n \n mc.rowColumnLayout(nc=8 ,cw=[(1,40),(2, 58),(3,5),(4, 58),(5,5),(6,58),(7,5),(8,58)])\n mc.text(l ='Display',h=20)\n mc.iconTextButton('ToggleCutters', w=40,style='textOnly', l= \"Toggle\", rpt = True, c = 'toggleCutters()', bgc = [0.24,0.24,0.24 ] )\n mc.text(l ='')\n mc.iconTextButton( w = 40, style='textOnly', l= \"All\", c = 'showAllCutter()', bgc = [0.24, 0.24, 0.24] )\n mc.text(l ='')\n mc.iconTextButton( w = 40, style='textOnly', l= \"None\", c = 'hideAllCutter()', bgc = [0.24, 0.24, 0.24] )\n mc.text(l ='',h=20)\n mc.iconTextButton( w = 40, style='textOnly', l= \"Select\", rpt = True, c = 'showLastCutter()', bgc = [0.24,0.24,0.24] )\n mc.setParent( '..' )\n mc.text(l ='')\n mc.separator( height= 5, style='none' )\n mc.text(l =' ____________________ Cutter Options _________________')\n mc.separator( height=10, style='none' )\n mc.rowColumnLayout(nc=5, cw=[(1,40),(2,50),(3,5),(4,110),(5,85)])\n mc.columnLayout()\n mc.text(l =' Cutter',h=50)\n mc.setParent( '..' ) \n mc.columnLayout()\n mc.separator( height= 1, style='none' )\n mc.iconTextButton('newCutButton', h= 23 ,w = 50, style='textOnly', l= \"[ * ]\", rpt = True, c = 'goPressCutter(4)', bgc = [0.36, 0.6, 0.49] )\n mc.separator( height= 3, style='none' )\n mc.iconTextButton('drawCutButton', h= 23 ,w = 50, style='textOnly', l= \"Draw\", rpt = True, c = 'goDraw()', bgc = [0.49,0.6,0.36 ] )\n mc.setParent( '..' ) \n mc.text(l ='')\n mc.columnLayout()\n mc.rowColumnLayout(nc=5, cw=[(1,30),(2,5),(3,30),(4,5),(5,30)])\n mc.iconTextButton('triButton', w = 30, style='textOnly', l= \"3\", rpt = True, c = 'goPressCutter(3)', bgc = [0.36, 0.6, 0.49])\n mc.text(l ='')\n mc.iconTextButton('pentaButton', w = 30, style='textOnly', l= \"5\", rpt = True, c = 'goPressCutter(5)', bgc = [0.36, 0.6, 0.49] )\n mc.text(l ='')\n mc.iconTextButton('hexButton', w = 30, style='textOnly', l= \"6\", rpt = True, c = 'goPressCutter(6)', bgc = [0.36, 0.6, 0.49] )\n mc.separator( height= 1, style='none' )\n mc.setParent( '..' ) \n mc.columnLayout()\n mc.iconTextButton('selCutButton', w = 100, style='textOnly', l= \"Selected\", rpt = True, c = 'useOwnCutterShape()', bgc = [0.26, 0.56, 0.39] )\n mc.setParent( '..' ) \n mc.setParent( '..' ) \n mc.columnLayout()\n mc.iconTextButton('dulCutButton', w = 80, style='textOnly', l= \"Duplicate\", rpt = True, c = 'cutterDulpicate()', bgc = [0.24, 0.24, 0.24] )\n mc.separator( height= 4, style='none' )\n mc.iconTextButton('comCutButton', w = 80, style='textOnly', l= \"Combine\", rpt = True, c = 'combineSelCutters()', bgc = [0.24, 0.24, 0.24] )\n mc.setParent( '..' ) \n mc.setParent( '..' )\n mc.separator( height= 5, style='none' )\n mc.columnLayout()\n mc.intSliderGrp('cutterSideSlider', en=1, vis = 0, v = 4, min = 3, max = 6, s = 1, cw3 = [35,40,200] , label = \"side \" ,field =True )\n mc.setParent( '..' ) \n mc.separator( height= 15, style='none' )\n mc.columnLayout()\n mc.rowColumnLayout(nc=6 ,cw=[(1,40),(2, 80),(3,5),(4, 80),(5,5),(6,80)])\n mc.text(l ='Mirror',h=20)\n mc.button( w = 50, l= \"X\", c = 'jwMirror(\"x\")', bgc = [0.20, 0.24, 0.24] )\n mc.text(l ='')\n mc.button(w = 50, l= \"Y\", c = 'jwMirror(\"y\")', bgc = [0.20, 0.24, 0.24] )\n mc.text(l ='')\n mc.button(w = 50, l= \"Z\", c = 'jwMirror(\"z\")', bgc = [0.20, 0.24, 0.24] )\n mc.setParent( '..' )\n mc.separator( height= 5, style='none' )\n \n mc.rowColumnLayout(nc=6, cw=[(1,40),(2,80),(3,5),(4,80),(5,5),(6,80)])\n mc.text(l ='Rotate',h=20)\n mc.iconTextButton(w = 50, style='textOnly', l= \"Toggle\",rpt = True, c = 'QChangeCutterDir()', bgc = [0.28,0.28,0.28] )\n mc.text(l ='')\n mc.iconTextButton(w = 50,style='textOnly' , l= \"Align\", rpt = True, c = 'alignCutterToBase()', bgc = [0.28,0.28,0.28] )\n mc.text(l ='')\n mc.setParent( '..' )\n mc.separator( height=15, style='none' )\n \n mc.text(l =' ________________________ Control _____________________')\n mc.text(l ='')\n\n mc.rowColumnLayout(nc=3 ,cw=[(1,240),(2,12),(3,30)])\n mc.columnLayout()\n mc.floatSliderGrp('fractionSlider', en=0, v = 0.2, min = 0.001, max = 1, s = 0.01, cw3 = [55,40,140] , label = \" Fraction\" ,field =True)\n mc.intSliderGrp('segmentSlider', en=0, v = 1, min = 1 , max = 10, fmx = 20, s = 1, cw3 = [55,40,140] , label = \"Segments\" ,field =True)\n mc.floatSliderGrp('depthSlider', en=0, v = 1, min = -1 , max = 1, fmn = -3, fmx = 3, s = 1, cw3 = [55,40,140] , label = \"Depth\" ,field =True)\n mc.floatSliderGrp('gapSlider', en=0, v = 0.3, min = 0.01, max = 1, s = 0.01, cw3 = [55,40,140] , label = \"Gap \" ,field =True)\n mc.setParent( '..' )\n mc.text(l ='',h=20)\n mc.button( w = 30, l= \"Link\", c = 'QlinkSlider()', bgc = [0.08,0.08,0.08] )\n mc.setParent( '..' )\n mc.text(l ='')\n mc.rowColumnLayout(nc=6, cw=[(1,40),(2,80),(3,5),(4,80),(5,5),(6,80)])\n mc.text(l ='Type',h=20)\n mc.button( w = 50, l= \"Bevel\", c = 'QBoxBevel()', bgc = [0.08,0.08,0.08] )\n mc.text(l ='')\n mc.button(w = 50, l= \"Smooth\", c = 'QBoxSmooth()', bgc = [0.08,0.08,0.08])\n mc.text(l ='')\n mc.button(w = 50, l= \"X\", c = 'QBoxBevelRemove()', bgc = [0.08,0.08,0.08] )\n mc.setParent( '..' )\n mc.separator( height=5, style='none' )\n mc.rowColumnLayout(nc=6, cw=[(1,40),(2,80),(3,5),(4,80),(5,5),(6,80)])\n mc.text(l ='Panel',h=10)\n mc.button('makePanelButton', w = 50, l= \"Panel/Gap\", c = 'toggleCapPanel()', bgc = [0.08,0.08,0.08] )\n mc.text(l ='')\n mc.button('reBuildButton', w = 50, l= \"ReBuild\", c = 'reBuildCutter()', bgc = [0.08,0.08,0.08] )\n mc.text(l ='')\n mc.button('removePanelButton', w = 50, l= \"X\", c = 'removePanel()', bgc = [0.08,0.08,0.08] )\n mc.setParent( '..' )\n mc.separator( height= 5, style='none' )\n\n mc.text(l =' _______________________ Pattern _______________________')\n mc.text(l ='')\n mc.rowColumnLayout(nc=3 ,cw=[(1,240),(2,12),(3,30)])\n mc.columnLayout()\n mc.intSliderGrp('instNumSlider', en=0, v = 1, min = 1, max = 10, fmx = 20 ,s = 1, cw3 = [35,40,160] , label = \"Num \" ,field =True,dc = 'instReNew()' )\n mc.floatSliderGrp('disSlider', en=0, v = 1, min = -3, max = 3, fmx = 20 ,fmn = -20, s = 0.01, cw3 = [35,40,160] , label = \"Dist \", field =True, )\n mc.setParent( '..' )\n mc.text(l ='',h=5)\n mc.button('instLinkButton', w = 30, l= \"Link\", c = 'instLink()', bgc = [0.24, 0.20, 0.24] )\n mc.setParent( '..' )\n mc.separator( height=5, style='none' )\n mc.columnLayout()\n mc.rowColumnLayout(nc=8 ,cw=[(1,40),(2, 10),(3,105),(4,45),(5,5),(6,45),(7,5),(8,30)])\n mc.text(l ='Array')\n mc.text(l ='')\n mc.radioButtonGrp('arrayTypeButton', numberOfRadioButtons = 2, sl= 1, labelArray2 = ['Lin', 'Rad'],cc = 'instTypeCommandChange()',cw2 =(50,80))\n mc.button( w = 45, l= \"Switch\", c = 'instTypeToggle()', bgc = [0.24, 0.20, 0.24] )\n mc.text(l ='')\n mc.button( w = 45, l= \"Done\", c = 'instBake()', bgc = [0.24, 0.20, 0.24] )\n mc.text(l ='')\n mc.button( w = 30, l= \"X\", c = 'removeArrayGrp()', bgc = [0.24, 0.20, 0.24] )\n mc.setParent( '..' )\n mc.separator( height=5, style='none' )\n mc.rowColumnLayout(nc=6 ,cw=[(1,40),(2, 78),(3,5),(4, 78),(5,5),(6,78)])\n mc.text(l ='')\n mc.button('instXButton', w = 50, l= \"X\", c = 'instAdd(\"X\")', bgc = [0.24, 0.20, 0.24] )\n mc.text(l ='')\n mc.button('instYButton', w = 50, l= \"Y\", c = 'instAdd(\"Y\")', bgc = [0.24, 0.20, 0.24] )\n mc.text(l ='')\n mc.button('instZButton' ,w = 50, l= \"Z\", c = 'instAdd(\"Z\")', bgc = [0.24, 0.20, 0.24] )\n mc.setParent( '..' )\n \n mc.separator( height=15, style='none' )\n mc.text(l =' ______________________ Box Draw _____________________')\n mc.text(l ='')\n mc.rowColumnLayout(nc=9, cw=[(1,40),(2,60),(3,5),(4,60),(5,5),(6,60),(7,5),(8,60),(9,20)])\n mc.text(l ='',h=10)\n mc.button('snapGridVisButton', w = 50, l= \"On/Off\", c = 'drawGirdToggle()', bgc = [0.36, 0.6, 0.49] )\n mc.text(l ='')\n mc.button('snapGridPointVisButton', w = 50, l= \"Point\", c = 'goPressDraw()', bgc = [0.49, 0.6, 0.36] )\n mc.text(l ='')\n mc.button('cureveDrawButtton', w = 50, l= \"Draw\", c = 'mc.CVCurveToolOptions()',bgc = [0.24, 0.24, 0.24] )\n mc.text(l ='')\n mc.button('buildBlockButton', w = 50, l= \"Block\", c = 'makeDrawBlock()', bgc = [0.24, 0.24, 0.24] )\n mc.textField(\"camPlane\" ,ed =False,w = 20,vis=0)\n mc.setParent( '..' )\n mc.separator( height=15, style='none' ) \n mc.columnLayout()\n mc.intSliderGrp('snapGirdSize', en=0, v = 10, min = 1, max = 50, fmx=100 ,s = 1, cw3 = [35,40,200] , label = \"Grid \" ,field =True, dc ='resizeSnapGrid()')\n mc.intSliderGrp('snapGirdRot',en=0, v = 0, min = 0, max = 90, s = 1, cw3 = [35,40,200], label = \"Rot \" ,field =True)\n mc.setParent( '..' )\n \n mc.separator( height= 5, style='none' )\n mc.text(l =' ________________ Bake Cutter Options _______________')\n mc.separator( height=15, style='none' )\n mc.rowColumnLayout(nc=6, cw=[(1,40),(2,80),(3,5),(4,80),(5,5),(6,80)])\n mc.text(l ='',h=10)\n mc.button('bakeUnSelButton', w = 50, l= \"Unselect\", c = 'bakeUnselectCutter()', bgc = [0.1,0.2,0.2] )\n mc.text(l ='')\n mc.button('bakeAllButton', w = 50, l= \"All\", c = 'bakeCutter()', bgc = [0.2,0.1,0.1] )\n mc.text(l ='')\n mc.button('bakeRestoreButton', w = 50, l= \"Restore\",c = 'restoreCutter()', bgc = [0.08,0.08,0.08] )\n mc.text(l ='')\n mc.setParent( '..' )\n\n mc.text(l =' _______________ PreView Boolean Bevel ______________')\n mc.separator( height=15, style='none' )\n mc.rowColumnLayout(nc=4 ,cw=[(1,40),(2, 185),(3,5),(4, 58)])\n mc.text(l ='',h=20)\n mc.iconTextButton('preBevelButton', w=40,style='textOnly', l= \"On / Off\", rpt = True, c = 'preBevelToggle()', bgc = [0.49,0.6,0.36 ] )\n mc.text(l ='',h=20)\n mc.iconTextButton('preBevelSettingButton', w=40,style='textOnly', l= \"Setting\", rpt = True, c = 'bevelPreviewSetting()', bgc =[0.24, 0.24, 0.24] )\n mc.text(l ='',h=20)\n mc.setParent( '..' )\n mc.frameLayout( 'bevelPreSettingLayer', labelVisible = 0,vis = 0)\n mc.floatSliderGrp('offsetSliderPre', en=1, v = 0.1, min = 0.001, max = 1, fmx = 10, s = 0.01, cw3 = [55,40,180] , label = \"Offset \" ,field =True)\n mc.text(l ='',h=20)\n mc.showWindow(jwSpeedCutWin)\n mc.window(\"jwSpeedCutWin\",e=True,w = 320,h = 770)\n mc.commandEcho( state=False )\njwSpeedCutUI()\n" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 3
-flexibleWidthValue 32
-enable 1
-width 35
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "import rjQualityAssurance.ui\nrjQualityAssurance.ui.show(\"modeling\")" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "import rjQualityAssurance.ui\nrjQualityAssurance.ui.show(\"modelin..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "QA" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "pythonFamily.png" 
-image1 "pythonFamily.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "import rjQualityAssurance.ui\nrjQualityAssurance.ui.show(\"modeling\")" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 3
-flexibleWidthValue 32
-enable 1
-width 35
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "Reset Display" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "Reset Display" 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-imageOverlayLabel "RESET" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "commandButton.png" 
-image1 "commandButton.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "PolyDisplayReset" 
-sourceType "mel" 
-commandRepeatable 1
-flat 1
;
shelfButton
-enableCommandRepeat 1
-flexibleWidthType 3
-flexibleWidthValue 32
-enable 1
-width 35
-height 34
-manage 1
-visible 1
-preventOverride 0
-annotation "# SelectBadGeo v1.1\n# License: MIT Licence (See LICENSE.txt or https://choosealicense.com/licenses/mit/)\n# Copyright (c) 2017 Erik Lehmann\n# Date: 01/16/18\n#\n# Description: \n#\tSelect Triangles, Quads, N-Gons, Concave, Hole, Lamina and Non Manifold geometry.\n# \n# How to use:\n#\t1. Select object(s).\n#\t2. Choose geometry type.\n#\n# Installation: \n# \t1. \tCopy BadGeo.py to '\\Users\\[USER]\\Documents\\maya\\[MAYAVERSION]\\prefs\\scripts'\n# \t2. \tLaunch / Restart Maya\n#\t3.\tType into 'Script Editor' (Python tab) and execute:\n# import SelectBadGeo as BG\n# MCBG = BG.MainClassBadGeo()\n# MCBG.badGeoUI()\n \n\nimport maya.cmds as cmds\nimport maya.mel as mel\n\nclass MainClassBadGeo3:\n \t\n def __init__(self):\n self.bG_output = \"\" \n \n def badGeoUI(self):\n\n # C H E C K W I N D O W\n \n if (cmds.window(\"bGWin\", exists=True)):\n \tcmds.deleteUI(\"bGWin\", wnd=True)\n \tcmds.windowPref(\"bGWin\", r=True) \t \n \n # C R E A T E U I\n \n cmds.window(\"bGWin\", s=False, tlb=True, rtf=True, t=\"Select Bad Geometry\", w = 145)\n cmds.columnLayout(adj=True)\n \n \n # B A D G E O M E T R Y\n \t\t\n cmds.frameLayout(label=(\"Geometry Type\"), bgc=(0.3, 0.3, 0.3), collapsable=False, collapse=False, w=120)\n \n cmds.columnLayout(adj=True)\n \n cmds.button(label=\"Triangles\", h=25, c = self.bGTriangles)\n cmds.button(label=\"Quads\", h=25, c = self.bGQuads)\n cmds.button(label=\"N-Gons\", h=25, c = self.bGNGons)\n cmds.button(label=\"Concave\", h=25, c = self.bGConcave)\n cmds.button(label=\"Lamina\", h=25, c = self.bGLamina)\n cmds.button(label=\"Holes\", h=25, c = self.bGHole)\n cmds.button(label=\"Non-Manifold\", h=25, c = self.bGNonM)\n cmds.button(label=\"Pole-6\", h=25, c = self.poles)\n \n \n cmds.setParent(\"..\")\n cmds.setParent(\"..\")\n \n \n # O U T P U T\n \n cmds.frameLayout(label='Output', bgc=(0.3, 0.3, 0.3), collapsable=False, collapse=True)\n \n self.bG_output = cmds.textField(h = 25, bgc=(0.16, 0.16, 0.16), en = True, ed=False)\n \n cmds.setParent(\"..\")\n cmds.setParent(\"..\")\n\n \n # S H O W W I N D O W\n \n cmds.showWindow(\"bGWin\")\n \n\t\n\t# M E T H O D S\n\n def poles( self , _ = False ):\t\n\n poles = []\n sel = cmds.ls( sl = 1 , type = 'transform' )\n\n for obj in sel:\n\n numVtx = cmds.polyEvaluate( obj , v = 1 )\n\n for i in xrange( 0 , numVtx ):\n\n listaEdge = cmds.polyListComponentConversion ( obj + '.vtx[' + str(i) + ']' , fv = 1 , te = 1)\n cmds.select( listaEdge )\n listaVtx = cmds.polyListComponentConversion (listaEdge , fe = 1 , tv = 1)\n cmds.select( listaVtx )\n\n nearVtx = cmds.ls( sl = 1 , fl = 1 )\n\n if len( nearVtx ) > 6:\n\n poles.append( obj + '.vtx[' + str(i) + ']' )\n mel.eval('if( `dR_isCtrlHeld` && `dR_isShiftHeld`){ ConvertSelectionToVertexPerimeter; } else if (`dR_isCtrlHeld`) { dR_convertSelectionToVertex; } else { dR_modeVert; };')\n cmds.select( poles )\n\n cmds.textField(self.bG_output, e=True, tx=(\"%s Pole(s)\" % poles))\n\n\t# T R I A N G L E S\n\n def bGTriangles(self, _=False):\n bGsel = cmds.ls(sl = True) \n \n # Change to Component mode to retain object highlighting for better visibility \n cmds.selectMode(q=True, co=True)\n\n # Select Object/s and Run Script to highlight Triangles\n cmds.polySelectConstraint(m=3 ,t = 0x0008, sz=1)\n cmds.polySelectConstraint(dis=True)\n \n # Update Textfield \n bGPolys = cmds.polyEvaluate(fc=True)\n \n try:\n cmds.textField(self.bG_output, e=True, tx=(\"%s Triangle(s)\" % int(bGPolys))) \n except:\n cmds.textField(self.bG_output, e=True, tx=(\"Nothing is selected.\"))\n \n \n # Q U A D S\n \n def bGQuads(self, _=False):\n bGsel = cmds.ls(sl = True)\n \n cmds.selectMode(q=True, co=True)\n \n cmds.polySelectConstraint(m=3 ,t = 0x0008, sz=2)\n cmds.polySelectConstraint(dis=True)\n \n bGPolys = cmds.polyEvaluate(fc=True)\n \n try:\n cmds.textField(self.bG_output, e=True, tx=(\"%s Quad(s)\" % int(bGPolys)))\n except:\n cmds.textField(self.bG_output, e=True, tx=(\"Nothing is selected.\"))\n\n \n # N - G O N S\n \n def bGNGons(self, _=False):\n bGsel = cmds.ls(sl = True) \n \n cmds.selectMode(q=True, co=True)\n \n cmds.polySelectConstraint(m=3 ,t = 0x0008, sz=3)\n cmds.polySelectConstraint(dis=True)\n \n bGPolys = cmds.polyEvaluate(fc=True)\n \n try:\n cmds.textField(self.bG_output, e=True, tx=(\"%s N-Gon(s)\" % int(bGPolys)))\n except:\n cmds.textField(self.bG_output, e=True, tx=(\"Nothing is selected.\"))\n\n # C O N C A V E\n \n def bGConcave(self, _=False):\n \n bGsel = cmds.ls(sl = True) \n \n cmds.selectMode(q=True, co=True)\n \n cmds.polySelectConstraint(m=3 ,t = 0x0008, c=1)\n cmds.polySelectConstraint(dis=True)\n \n bGPolys = cmds.polyEvaluate(fc=True)\n \n try:\n cmds.textField(self.bG_output, e=True, tx=(\"%s Concave(s)\" % int(bGPolys)))\n except:\n cmds.textField(self.bG_output, e=True, tx=(\"Nothing is selected.\"))\n \n # L A M I N A\n \n def bGLamina(self, _=False):\n bGsel = cmds.ls(sl = True) \n \n cmds.selectMode(q=True, co=True)\n\n p = cmds.polyInfo(lf=True)\n\n if p == None:\n bGPolys = 0\n cmds.select(d=True) \n else:\n cmds.select(p)\n bGPolys = cmds.polyEvaluate(fc=True)\n \n try:\n cmds.textField(self.bG_output, e=True, tx=(\"%s Lamina\" % int(bGPolys)))\n except:\n cmds.textField(self.bG_output, e=True, tx=(\"Nothing is selected.\"))\n \n # H O L E S\n \n def bGHole(self, _=False):\n bGsel = cmds.ls(sl = True) \n \n cmds.selectMode(q=True, co=True)\n \n cmds.polySelectConstraint(m=3 ,t = 0x0008, h=1)\n cmds.polySelectConstraint(dis=True)\n \n bGPolys = cmds.polyEvaluate(fc=True)\n \n \n try:\n cmds.textField(self.bG_output, e=True, tx=(\"%s Hole(s)\" % int(bGPolys)))\n except:\n cmds.textField(self.bG_output, e=True, tx=(\"Nothing is selected.\"))\n\n # N O N - M A N I F O L D\n \n def bGNonM(self, _=False):\n bGsel = cmds.ls(sl = True) \n \n cmds.selectMode(q=True, co=True)\n \n bGPolys = mel.eval('polyCleanupArgList 4 { \"0\",\"2\",\"1\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"1e-005\",\"0\",\"1e-005\",\"0\",\"1e-005\",\"0\",\"1\",\"0\",\"0\" };')\n \n bGCount = 0\n \n for i in bGPolys:\n bGCount = bGCount + 1\n \n cmds.select(bGPolys)\n \n try:\n cmds.textField(self.bG_output, e=True, tx=(\"%s Non-Manifold(s)\" % bGCount))\n except:\n cmds.textField(self.bG_output, e=True, tx=(\"Nothing is selected.\"))\n \n \n \nMCBG = MainClassBadGeo3()\nMCBG.badGeoUI()" 
-enableBackground 0
-backgroundColor 0 0 0 
-highlightColor 0.321569 0.521569 0.65098 
-align "center" 
-label "# SelectBadGeo v1.1\n# License: MIT Licence (See LICENSE.txt or h..." 
-labelOffset 0
-rotation 0
-flipX 0
-flipY 0
-useAlpha 1
-font "plainLabelFont" 
-overlayLabelColor 0.8 0.8 0.8 
-overlayLabelBackColor 0 0 0 0.5 
-image "pythonFamily.png" 
-image1 "pythonFamily.png" 
-style "iconOnly" 
-marginWidth 1
-marginHeight 1
-command "# SelectBadGeo v1.1\n# License: MIT Licence (See LICENSE.txt or https://choosealicense.com/licenses/mit/)\n# Copyright (c) 2017 Erik Lehmann\n# Date: 01/16/18\n#\n# Description: \n#\tSelect Triangles, Quads, N-Gons, Concave, Hole, Lamina and Non Manifold geometry.\n# \n# How to use:\n#\t1. Select object(s).\n#\t2. Choose geometry type.\n#\n# Installation: \n# \t1. \tCopy BadGeo.py to '\\Users\\[USER]\\Documents\\maya\\[MAYAVERSION]\\prefs\\scripts'\n# \t2. \tLaunch / Restart Maya\n#\t3.\tType into 'Script Editor' (Python tab) and execute:\n# import SelectBadGeo as BG\n# MCBG = BG.MainClassBadGeo()\n# MCBG.badGeoUI()\n \n\nimport maya.cmds as cmds\nimport maya.mel as mel\n\nclass MainClassBadGeo3:\n \t\n def __init__(self):\n self.bG_output = \"\" \n \n def badGeoUI(self):\n\n # C H E C K W I N D O W\n \n if (cmds.window(\"bGWin\", exists=True)):\n \tcmds.deleteUI(\"bGWin\", wnd=True)\n \tcmds.windowPref(\"bGWin\", r=True) \t \n \n # C R E A T E U I\n \n cmds.window(\"bGWin\", s=False, tlb=True, rtf=True, t=\"Select Bad Geometry\", w = 145)\n cmds.columnLayout(adj=True)\n \n \n # B A D G E O M E T R Y\n \t\t\n cmds.frameLayout(label=(\"Geometry Type\"), bgc=(0.3, 0.3, 0.3), collapsable=False, collapse=False, w=120)\n \n cmds.columnLayout(adj=True)\n \n cmds.button(label=\"Triangles\", h=25, c = self.bGTriangles)\n cmds.button(label=\"Quads\", h=25, c = self.bGQuads)\n cmds.button(label=\"N-Gons\", h=25, c = self.bGNGons)\n cmds.button(label=\"Concave\", h=25, c = self.bGConcave)\n cmds.button(label=\"Lamina\", h=25, c = self.bGLamina)\n cmds.button(label=\"Holes\", h=25, c = self.bGHole)\n cmds.button(label=\"Non-Manifold\", h=25, c = self.bGNonM)\n cmds.button(label=\"Pole-6\", h=25, c = self.poles)\n \n \n cmds.setParent(\"..\")\n cmds.setParent(\"..\")\n \n \n # O U T P U T\n \n cmds.frameLayout(label='Output', bgc=(0.3, 0.3, 0.3), collapsable=False, collapse=True)\n \n self.bG_output = cmds.textField(h = 25, bgc=(0.16, 0.16, 0.16), en = True, ed=False)\n \n cmds.setParent(\"..\")\n cmds.setParent(\"..\")\n\n \n # S H O W W I N D O W\n \n cmds.showWindow(\"bGWin\")\n \n\t\n\t# M E T H O D S\n\n def poles( self , _ = False ):\t\n\n poles = []\n sel = cmds.ls( sl = 1 , type = 'transform' )\n\n for obj in sel:\n\n numVtx = cmds.polyEvaluate( obj , v = 1 )\n\n for i in range( 0 , numVtx ):\n\n listaEdge = cmds.polyListComponentConversion ( obj + '.vtx[' + str(i) + ']' , fv = 1 , te = 1)\n cmds.select( listaEdge )\n listaVtx = cmds.polyListComponentConversion (listaEdge , fe = 1 , tv = 1)\n cmds.select( listaVtx )\n\n nearVtx = cmds.ls( sl = 1 , fl = 1 )\n\n if len( nearVtx ) > 6:\n\n poles.append( obj + '.vtx[' + str(i) + ']' )\n mel.eval('if( `dR_isCtrlHeld` && `dR_isShiftHeld`){ ConvertSelectionToVertexPerimeter; } else if (`dR_isCtrlHeld`) { dR_convertSelectionToVertex; } else { dR_modeVert; };')\n cmds.select( poles )\n\n cmds.textField(self.bG_output, e=True, tx=(\"%s Pole(s)\" % poles))\n\n\t# T R I A N G L E S\n\n def bGTriangles(self, _=False):\n bGsel = cmds.ls(sl = True) \n \n # Change to Component mode to retain object highlighting for better visibility \n cmds.selectMode(q=True, co=True)\n\n # Select Object/s and Run Script to highlight Triangles\n cmds.polySelectConstraint(m=3 ,t = 0x0008, sz=1)\n cmds.polySelectConstraint(dis=True)\n \n # Update Textfield \n bGPolys = cmds.polyEvaluate(fc=True)\n \n try:\n cmds.textField(self.bG_output, e=True, tx=(\"%s Triangle(s)\" % int(bGPolys))) \n except:\n cmds.textField(self.bG_output, e=True, tx=(\"Nothing is selected.\"))\n \n \n # Q U A D S\n \n def bGQuads(self, _=False):\n bGsel = cmds.ls(sl = True)\n \n cmds.selectMode(q=True, co=True)\n \n cmds.polySelectConstraint(m=3 ,t = 0x0008, sz=2)\n cmds.polySelectConstraint(dis=True)\n \n bGPolys = cmds.polyEvaluate(fc=True)\n \n try:\n cmds.textField(self.bG_output, e=True, tx=(\"%s Quad(s)\" % int(bGPolys)))\n except:\n cmds.textField(self.bG_output, e=True, tx=(\"Nothing is selected.\"))\n\n \n # N - G O N S\n \n def bGNGons(self, _=False):\n bGsel = cmds.ls(sl = True) \n \n cmds.selectMode(q=True, co=True)\n \n cmds.polySelectConstraint(m=3 ,t = 0x0008, sz=3)\n cmds.polySelectConstraint(dis=True)\n \n bGPolys = cmds.polyEvaluate(fc=True)\n \n try:\n cmds.textField(self.bG_output, e=True, tx=(\"%s N-Gon(s)\" % int(bGPolys)))\n except:\n cmds.textField(self.bG_output, e=True, tx=(\"Nothing is selected.\"))\n\n # C O N C A V E\n \n def bGConcave(self, _=False):\n \n bGsel = cmds.ls(sl = True) \n \n cmds.selectMode(q=True, co=True)\n \n cmds.polySelectConstraint(m=3 ,t = 0x0008, c=1)\n cmds.polySelectConstraint(dis=True)\n \n bGPolys = cmds.polyEvaluate(fc=True)\n \n try:\n cmds.textField(self.bG_output, e=True, tx=(\"%s Concave(s)\" % int(bGPolys)))\n except:\n cmds.textField(self.bG_output, e=True, tx=(\"Nothing is selected.\"))\n \n # L A M I N A\n \n def bGLamina(self, _=False):\n bGsel = cmds.ls(sl = True) \n \n cmds.selectMode(q=True, co=True)\n\n p = cmds.polyInfo(lf=True)\n\n if p == None:\n bGPolys = 0\n cmds.select(d=True) \n else:\n cmds.select(p)\n bGPolys = cmds.polyEvaluate(fc=True)\n \n try:\n cmds.textField(self.bG_output, e=True, tx=(\"%s Lamina\" % int(bGPolys)))\n except:\n cmds.textField(self.bG_output, e=True, tx=(\"Nothing is selected.\"))\n \n # H O L E S\n \n def bGHole(self, _=False):\n bGsel = cmds.ls(sl = True) \n \n cmds.selectMode(q=True, co=True)\n \n cmds.polySelectConstraint(m=3 ,t = 0x0008, h=1)\n cmds.polySelectConstraint(dis=True)\n \n bGPolys = cmds.polyEvaluate(fc=True)\n \n \n try:\n cmds.textField(self.bG_output, e=True, tx=(\"%s Hole(s)\" % int(bGPolys)))\n except:\n cmds.textField(self.bG_output, e=True, tx=(\"Nothing is selected.\"))\n\n # N O N - M A N I F O L D\n \n def bGNonM(self, _=False):\n bGsel = cmds.ls(sl = True) \n \n cmds.selectMode(q=True, co=True)\n \n bGPolys = mel.eval('polyCleanupArgList 4 { \"0\",\"2\",\"1\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"1e-005\",\"0\",\"1e-005\",\"0\",\"1e-005\",\"0\",\"1\",\"0\",\"0\" };')\n \n bGCount = 0\n \n for i in bGPolys:\n bGCount = bGCount + 1\n \n cmds.select(bGPolys)\n \n try:\n cmds.textField(self.bG_output, e=True, tx=(\"%s Non-Manifold(s)\" % bGCount))\n except:\n cmds.textField(self.bG_output, e=True, tx=(\"Nothing is selected.\"))\n \n \n \nMCBG = MainClassBadGeo3()\nMCBG.badGeoUI()" 
-sourceType "python" 
-commandRepeatable 1
-flat 1
;

}