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 Tools Search this Thread Display Modes
  09 September 2008
TextScrollList filter by type?


How to filter objects in TextScrollList by type?

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

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

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

  09 September 2008
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.
  09 September 2008
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:

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;

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.

  09 September 2008
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.
  09 September 2008
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 ;
		$list = `textScrollList`; 
		for($node in $objs)
			textScrollList -e -append $node $list; 
showWindow ;
Digital Characters R&D - Suntoucher Labs
  09 September 2008
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"))`;
  09 September 2008
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
  09 September 2008
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
Society of Digital Artists

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

All times are GMT. The time now is 04:19 PM.

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