This spawned off of this thread about deteremining if a material is in use or not.
"Delete Unused Nodes" in the hypershade is great, but what if you don't want to get rid of all those textures and only materials?
for ($c in `ls -materials`) {
string $outputs[];
string $SG[] = {};
$outputs = stringArrayRemoveDuplicates(`listConnections -destination 1 $c`);
for ($c2 in $outputs) {
string $type = nodeType($c2);
if ($type == "shadingEngine") $SG[size($SG)] = $c2;
}
if (size(`listConnections -source 1 ($SG[size($SG)-1] + ".dagSetMembers")`) == 0) delete $c;
}
0 comments:
Post a Comment