SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Lounges / Maya Basics & Newbie Lounge / Accessing a nodes shapeNode via MEL
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 13-02-2009, 11:12 AM   #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, 01: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, 02: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

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

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

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

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.