Community
Maya Forum
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sort by Polygon or Triangle Count

1 REPLY 1
Reply
Message 1 of 2
dulaney
856 Views, 1 Reply

Sort by Polygon or Triangle Count

I'm wondering if anybody knows how, or is familiar with a script that will sort objects by polygon count in the outliner. I'm extremely rusty with maya scripting, but I'd appreciate any commands that would be useful as well in case I'd have to write my own. 

1 REPLY 1
Message 2 of 2
Anonymous
in reply to: dulaney

Hi,

 

Here's a code snippet I wrote to sort a list containing objects depending on polycount. It returns a sorted list.

Hope it can be of any use to you:

 

#Function to return Sorted Dictionary
def MakeSortedPolyCountDictionary( a_List ):
	t_dict = {}
	cmds.select( clear=True )

	for child in a_List:
		cmds.select( child[0] )
		t_triCount = cmds.polyEvaluate( t=True )
		t_dict.update( {child[0]:t_triCount} )

	return OrderedDict( sorted( t_dict.items(), key=itemgetter(1),reverse=True ) )

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report