TextScrollList filter by type?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 09 September 2008   #1
TextScrollList filter by type?

hi

How to filter objects in TextScrollList by type?

I assume that can be done with nodeType command,but is there some "easier" way.
 
Old 09 September 2008   #2
If you have a text scroll list you can just do this:

window myWin;
	paneLayout;
		textScrollList myList;
		string $filteredNodes[] = `ls -type "mesh"`;
		for($node in $filteredNodes)
			textScrollList -e -append $node myList;

showWindow myWin;
window -e -wh 300 400 myWin;


-RyanT
 
Old 09 September 2008   #3
This command will get all meshes from scene,or i'm wrong?

I need nodeType from text scroll list.

I find solution for that with nodeType.

But i'm trying something that i'm not sure can work.

Simple,i have Tsl and have buttom for getting selected object in Tsl.

I have checkboxes(example polygon checkbox) ,and when i press checkBox i want to filter polygonal objects from Tls,and when unchecked i want to "revert" this action.
That is filtering objects types inside Tsl.

I hope this make sense

Last edited by ginodauri : 09 September 2008 at 08:11 PM.
 
Old 09 September 2008   #4
The command ls -type "type" will give you whatever type you ask for in the selected nodes. The command ls gives you the selection and type filters your selection. To get a specific node type type:

nodeType "nodeName";

So to do what your asking for you can do at least one of these ways:

#1
string $currentSel[] = `ls -sl`;      //Store the current user selection
 string $getList[] = `textScrollList -q -allItems myList`;
 select $getList;
 string $filterSel[] = `ls -type "mesh"`;
 select $currentSel;
 print $filterSel;


#2
string $getList[] = `textScrollList -q -allItems myList`;
 string $filterSel[];
 for( $item in $getList)
 {
     //Change the word transform with whatever type you are looking for
     if(`nodeType $item` == "transform")
         $filterSel[`size($filterSel)`] = $item;
 }
 print $filterSel;
 


I suppose there might be more ways to do it, but both ways work.

-RyanT
 
Old 09 September 2008   #5
I don't know if i don't understand something,but if i write something like this;


string $test1 [] = `ls -sl`; ///get current selection

select -cl; /////clear selection

select $test1; ///select stored selection

string $filter [] = ` ls -type "mesh" ` ; /////Than this command should filter meshes in that "test1" but i get all meshes from scene.
 
Old 09 September 2008   #6
Actually you could combine the -sl and the type flag, but since you probably have the transform nodes selected, maya will return an empty list. So one would need to check which node of the current selection has a child of type mesh. Here is a very ugly hack, but it works just to illustrate how you could get the shapes. Writing a proc that wil check all this is prorbably more elegant than just to use brute force with the pickwalk command, anyway maybe this is more like what you are after:
select some meshes in the viewport and run

pickWalk -d down;
$objs = `ls -sl -type mesh`;
window ;
	paneLayout;
		$list = `textScrollList`; 
		for($node in $objs)
			textScrollList -e -append $node $list; 
showWindow ;
__________________
Digital Characters R&D - Suntoucher Labs
 
Old 09 September 2008   #7
but to not destroy the current selection you could also:

// list the mesh children of current selection and return the transforms:
 string $meshTransforms[] = `listRelatives -p (listRelatives("-c","-type","mesh"))`;
__________________
goodsoul.de
 
Old 09 September 2008   #8
Originally Posted by ewerybody:
// list the mesh children of current selection and return the transforms:
string $meshTransforms[] = `listRelatives -p (listRelatives("-c","-type","mesh"))`;


nice power move, ewerybody
__________________
Digital Characters R&D - Suntoucher Labs
 
Old 09 September 2008   #9
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



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 08:49 PM.


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