Created
March 30, 2016 19:17
-
-
Save Onefabis/876f994754bc3a747b3a1ff4419b763e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 string[] NinjaUV_CollectShells() | |
{ | |
PolySelectConvert 4; | |
$Selection =`ls -sl -fl`; | |
string $UVs[] = `ls -sl -fl`;//base uv's | |
string $Test_UVs[] = `ls -sl -fl` ; | |
string $Shell[]; | |
string $Shell_string; | |
string $Shell_array[]; | |
for ($s = 0; $s < `size $UVs`; $s++) | |
{ | |
$test_UV = stringArrayContains ($UVs[$s], $Test_UVs);// checks to see if the UV is in the array after removing shell | |
if ($test_UV == 1) | |
{ | |
select -r $UVs[$s]; | |
SelectUVShell ; | |
string $Shell[] = `ls -sl -fl`;//flattens uv selection | |
string $Shell_string = stringArrayToString ($Shell,",");//converts array to string | |
$new_UVs = stringArrayRemove ($Shell, $Test_UVs);//removes shells from base uvs | |
$Test_UVs = $new_UVs;//updates UV array to remove shell | |
stringArrayInsertAtIndex(0 , $Shell_array, $Shell_string); | |
}//end if | |
}//end for | |
return $Shell_array;//returns an array of strings that needs to be tokenized thru a for loop | |
} | |
global proc convertSelectionToPerimeterEdges() | |
{ | |
$origFaces = `ls -sl`; | |
ConvertSelectionToEdges; | |
$allEdges = `ls -sl`; | |
select -r $origFaces; | |
ConvertSelectionToContainedEdges; | |
$innerEdges = `ls -sl`; | |
select -r $allEdges; | |
select -d $innerEdges; | |
} | |
string $objList[] = `ls -sl -o`; | |
for ($subObj in $objList) | |
{ | |
select -r $subObj; | |
string $Shells[] = NinjaUV_CollectShells(); | |
for ( $s = 0; $s < `size $Shells`; $s++ ) | |
{ | |
string $Single_Shell[]; | |
tokenize $Shells[$s] "," $Single_Shell; | |
select -r `polyListComponentConversion -fuv -tf $Single_Shell`; | |
convertSelectionToPerimeterEdges; | |
if ( size(`ls -sl`) ) polySoftEdge -a 0 -ch 1 `ls -sl -fl`; | |
} | |
} | |
select -r $objList |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment