Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Maya Basics & Newbie Lounge (https://simplymaya.com/forum/forumdisplay.php?f=31)
-   -   Accessing a nodes shapeNode via MEL (https://simplymaya.com/forum/showthread.php?t=31915)

abie1 13-02-2009 12:12 PM

Accessing a nodes shapeNode via MEL
 
Let's say that I have a ton of geometry in a scene, hypothetically speaking, and I want to turn off the primaryVisibility of all of the said geometry, but I don't want to have to select each object one by one and then tick the primaryVisibility option in the objects' renderStats. I thought that I could write a "for-in" loop that would work but I don't know how to access a given object's primaryVisiblity attribute. Is there a way to do this? Or am I going about this the wrong way altogether? Any help would be greatly appreciated.

Here's the code:


Code:

string $spheres[] = `ls -sl`;
string $currentSphere;
for ($currentSphere in $spheres)
{

 }
print "The primary visibility has been turned off for all of the selected geometry.";


bendingiscool 13-02-2009 02:21 PM

This should work for you...

string $sel[] = `ls -sl`;

for($i=0;$i<size($sel);$i++){
setAttr ($sel[$i] + ".primaryVisibility") 0;
}

Just select all your objects and run the code.

Chris

abie1 13-02-2009 03:39 PM

Quote:

Originally posted by bendingiscool
This should work for you...

string $sel[] = `ls -sl`;

for($i=0;$i<size($sel);$i++){
setAttr ($sel[$i] + ".primaryVisibility") 0;
}

Just select all your objects and run the code.

Chris

Oh! Okay so that's how you access that attribute. Needless to say, I'm teaching myself MEL and am still getting the hang of it so...I appreciate ur help. I'll test it when I get home. Thanks again.


All times are GMT. The time now is 01:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018