/* NAME: dbNinjaTool.mel VERSION: 1.0 CATEGORY: Modeling FUNCTION: This script will slice and object along a plane, separate the pieces and fill the hole. Useful if you need to break something up. USAGE: 1. Copy the dbNinjaTool.mel into your Maya Scripts directory (Usually found in "My Documents\maya\\scripts\"). 2. In the Maya Script Editor, type in "source dbNinjaTool.mel; dbNinjaTool;" AUTHOR: David Bokser E-MAIL: me@davidbokser.com WEBSITE: www.davidbokser.com */ global proc string[] dbFillFaces() { string $selected[] = `ls -sl -type transform`; select -r $selected; string $shapes[] = `listRelatives -shapes`; for($shape in $shapes) { string $polyCuts[] = `listConnections -type polyCut $shape`; for($cut in $polyCuts) { setAttr ($cut + ".extractFaces") 1; setAttr ($cut + ".deleteFaces") 0; } } string $allSeperated[] = {}; for($obj in $selected) { string $seperated[] = `polySeparate -ch 0 $selected[0]`; string $leftOverTransforms[] = `ls -sl -type transform`; for($piece in $leftOverTransforms) { $allSeperated[`size($allSeperated)`] = $piece; } } select -r $allSeperated; select -r (`ls -sl -type transform`); $allSeperated = `ls -sl`; for($obj in $allSeperated) { polyCloseBorder -ch 1 $obj; } return $allSeperated; } global proc dbNinjaTool() { CutPolygon; scriptJob -runOnce true -e ToolChanged dbFillFaces; }