Maya Training

Introduction to Hard Surface Modeling

Maya Training

Interiors and Furniture Vol 1 & 2 - Modeling & Cloth

Maya Training

Shading, Lighting and Rendering the Bedroom in MR

Maya Training

Robot volume one - Modeling with animation in mind

Maya Training

Spach-Alspaugh House the complete courseware

Maya Training

Burt The Cartoon Dinosaur Vol 01 - Modeling

New Maya Training

Robot Volume 02 - Hybrid Rigging
You are here > Home > SimplyMaya Community Forums
Loading

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 13-02-2009, 12:12 PM   #1
abie1
Subscriber
 
abie1's Avatar
 
Join Date: Mar 2003
Location: Miami, fl
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.";
abie1 is offline   Reply With Quote
Old 13-02-2009, 02:21 PM   #2
bendingiscool
Subscriber
 
bendingiscool's Avatar
 
Join Date: Jul 2006
Location: London
Posts: 567
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
bendingiscool is offline   Reply With Quote
Old 13-02-2009, 03:39 PM   #3
abie1
Subscriber
 
abie1's Avatar
 
Join Date: Mar 2003
Location: Miami, fl
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
abie1 is offline   Reply With Quote
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
MEL headache! happymat27 Members Lounge 5 05-12-2010 09:43 AM
MEL headache!! happymat27 Mel Scripts & Programming 1 03-12-2010 04:41 PM

Thread Tools





A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2015 SimplyMaya - vBulletin® Copyright © 2000-2015, Jelsoft Enterprises Ltd.