PDA

View Full Version : How to translate this command into MEL?


ftaswin
05-16-2006, 01:34 AM
Hi,

For some MEL guru thi task will take 0.01 second to complete. How do I translate this command into MEL:

Out of all selected object(s), if the visibility is off, then delete it, if not leave it as it is.

I did this task on thousands of boxes in the scene, MEL will save me hours doing it but I do not know how to translate it. Tried and fail. Well, I'll learn.

Thank you very much.

Ft

isoparmB
05-16-2006, 04:25 AM
string $inv[] = `ls -sl`;
int $i;
for ($i = (`size $inv` -1 ); $i >= 0; $i--)
{
if(`getAttr ($inv[$i] + ".visibility")` == 0) && (`objExists $inv[$i]`)
{
delete $inv[$i];
};
};





Although this will delete any visible nodes that are under invisible nodes.

wrend
05-16-2006, 04:27 AM
maybe ..
{

string $seln[] = `ls -sl`;
for ($sel in $seln)
{

if (!`getAttr ($sel+".v")`)
{
delete $sel;
}
}

}

ftaswin
05-16-2006, 04:54 AM
WOW..

Wonderful, gentlemen....

Thank you very much for your kind inputs..... What would I do without you guys...

OK, back to drawing board...

Ft

CGTalk Moderation
05-16-2006, 04:54 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.