Created
September 18, 2015 13:26
-
-
Save anonymous/097aa380c641988a4054 to your computer and use it in GitHub Desktop.
soupPolyReduce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global proc soupPolyReduce() | |
{ | |
string $meshArray; | |
string $attrTrans; | |
string $BO; | |
string $mesh; | |
string $orgMT[]; | |
string $sels[]=`ls -sl`; | |
string $shape[]; | |
for($n in $sels) | |
{ | |
$meshArray = `createNode mesh2arrays`; | |
$attrTrans = `createNode attributeTransfer`; | |
$BO = `createNode boundingObject`; | |
$mesh = `createNode mesh`; | |
setAttr ($meshArray + ".type") 3; | |
setAttr ($meshArray + ".count") 100; | |
setAttr ($meshArray + ".relaxIterations") 50; | |
setAttr ($meshArray + ".maxRandomFloat") 20; | |
setAttr ($meshArray + ".minRandomFloat") 20; | |
setAttr ($BO + ".type") 3; | |
setAttr ($BO + ".positionFalloff[1].positionFalloff_Position") 1; | |
setAttr ($BO + ".positionFalloff[1].positionFalloff_FloatValue") 1; | |
setAttr ($BO + ".displayPointCloudBoundingVolumes") 0; | |
setAttr ($attrTrans + ".maxInfluences") 1; | |
setAttr ($attrTrans + ".merge") 0; | |
setAttr ($attrTrans + ".blend") 0; | |
setAttr ($attrTrans + ".position") 1; | |
connectAttr -f ($BO + ".outData") ($attrTrans + ".boundingObjects[0]"); | |
connectAttr -f ($BO + ".outParentMatrix") ($attrTrans + ".boundingObjects[0].boundParentMatrix"); | |
connectAttr -f ($n + ".worldMesh[0]") ($meshArray + ".inputMesh"); | |
connectAttr -f ($n + ".worldMesh[0]") ($attrTrans + ".inGeometry"); | |
connectAttr -f ($meshArray + ".positionArray") ($BO + ".inParticlePositionPP"); | |
connectAttr -f ($meshArray + ".randomFloat") ($BO + ".inParticleRadiusPP"); | |
connectAttr -f ($attrTrans + ".outGeometry") ($mesh + ".inMesh"); | |
polyMergeVertex -d 0.001 -am 1 -ch 1 $mesh; | |
$shape = `listRelatives -f -ad -type "mesh" $n`; | |
$orgMT = `listConnections -type "shadingEngine" $shape[0]`; | |
sets -e -forceElement $orgMT[0] $mesh; | |
hide $n; | |
} | |
} | |
soupPolyReduce; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment