CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 03-10-2009, 08:25 PM   #1
ronviers
Frequenter
portfolio
Ron Viers
ronviers
Sayre, USA
 
Join Date: Aug 2007
Posts: 210
selecting shape nodes

How can I select the shape nodes from the list of selected objects? The selected objects are curves.


I am getting the transform nodes by:



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

I have my script working by using the pickWalk down but is there a way to read the shape nodes of the selected curves into an array?

Thanks,
Ron

Edit: Never mind, figured it out.

string $selected[]=`ls -dag -g -sl`;

Last edited by ronviers : 03-10-2009 at 09:39 PM.
 
Old 03-10-2009, 10:38 PM   #2
scroll-lock
Visual Defects Supervisor
 
scroll-lock's Avatar
portfolio
Marin Petrov
Senior Character TD
Blue Sky Studios
NY, USA
 
Join Date: Feb 2003
Posts: 434
Send a message via ICQ to scroll-lock
I`m also doing it with :

string $shape = `pickwalk -d down`;
__________________
reeview.it
Portfolio and Demoreel Review Service
 
Old 03-11-2009, 12:21 AM   #3
ronviers
Frequenter
portfolio
Ron Viers
ronviers
Sayre, USA
 
Join Date: Aug 2007
Posts: 210
That seems to work just as well. Thanks.
 
Old 03-11-2009, 02:45 PM   #4
thematt
brain filler
 
thematt's Avatar
matt
EMCA
France
 
Join Date: Mar 2003
Posts: 1,515
listRelatives -s will get you there too.

cheers
 
Old 03-11-2009, 02:49 PM   #5
DOor
RiskySnail
portfolio
Eric Lenerville
Midway Games
Aurora, USA
 
Join Date: Jul 2007
Posts: 114
pickwalk will physically change your selection and will slow your script down. I suggest using something like this: it will give you the most control over your selections (IE: only transform objects and only transforms that have a specific shape type (meshes, nurbscurves, whatever you want)

Code:
string $list[] = `ls -long -type "transform" -sl`; //get the selected transforms. string $sel[] = `listRelatives -typ "mesh" -f $list`; //of the transforms selected, get the shapes that are polymeshes.



you will need to change the -type flag to "nurbsCurve" and maybe add another -type flag for "nurbsSurface" if you need those too.

Also, I use the -long flag to get full paths of nodes to avoid name clashes. you may or may not need it for your purposes.
__________________
- elenerville
 
Old 03-11-2009, 04:48 PM   #6
ronviers
Frequenter
portfolio
Ron Viers
ronviers
Sayre, USA
 
Join Date: Aug 2007
Posts: 210
Thanks thematt and DOor. I did not know about listRelatives, so that is very good to know. It is great to have this kind of flexibility from a simple user selection.
 
Old 03-11-2009, 04:48 PM   #7
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:12 PM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.