FORUMS: list search recent posts

accessing a nodes primaryVisibility attribute

COW Forums : Autodesk Maya

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
abie silva
accessing a nodes primaryVisibility attribute
on Feb 13, 2009 at 11:54:24 am

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.

string $spheres[] = `ls -sl`;
string $currentSphere;

for ($currentSphere in $spheres)
{


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



Return to posts index

Alvaro Castaneda
Re: accessing a nodes primaryVisibility attribute
on Feb 13, 2009 at 4:05:16 pm

Hi

this is for toggling the values


string $spheres[] = `ls -sl`;
string $currentSphere;

for ($currentSphere in $spheres)
{
// First get the current value for the attribute 0 or 1
// and store it in a variable
string $curValue = `getAttr ($currentSphere+ ".primaryVisibility")`;

// Then test it, if is Off turn it on else turn it off
if ($curValue == 0)
setAttr ($currentSphere+ ".primaryVisibility") 1;
else
setAttr ($currentSphere+ ".primaryVisibility") 0;
}
// Print results and be happy
print "The primary visibility has been toogled for all of the selected geometry.";




if you just wanna turn off and on skip the if checking and make two shortcuts in your shelf something like this


string $spheres[] = `ls -sl`;
string $currentSphere;

for ($currentSphere in $spheres)
{
setAttr ($currentSphere+ ".primaryVisibility") 0;
}
// Print results and be happy
print "The primary visibility has been turned off for all of the selected geometry.";





that's for turning it off.

good luck



----------------------
varomix - pixelEater
http://www.intelianimate.com


Return to posts index

abie silva
Re: accessing a nodes primaryVisibility attribute
on Feb 13, 2009 at 4:45:29 pm

Dude! Ur like the man and stuff! You see! This is what I was looking for - an explanation of how this was done, not just the code that might do it. I can't test this right now b/c I'm at my "real job" LOL but I will when I get home. I really appreciate your help with this elusive little attribute. Thanks again main!



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]