Introduction to Maya - Rendering in Arnold
This course will look at the fundamentals of rendering in Arnold. We'll go through the different light types available, cameras, shaders, Arnold's render settings and finally how to split an image into render passes (AOV's), before we then reassemble it i
# 1 11-11-2013 , 04:39 AM
ctbram's Avatar
Moderator
Join Date: Jan 2004
Location: Michigan, USA
Posts: 2,998

selecting objects based on their display mode...

Okay folks, I feel like a real retard because I asked this question a long time ago and actually figured out the mel to resolve it but I have not used maya in so long I have forgotten how to do it.

I have a HUGE model that has some parts smoothed (smooth preview 3 not physically smoothed) and others are not (ie smooth preview level 1). I normally make a set containing one or the other (usually all the smooth preview level 1 parts) then I can simply select everything and press the 3-key and then pick the unsmoothed set and press the 1-key to unsmooth all the bits that need to remain unsmoothed.

Unfortunately I did not follow my own rule and accidentally selected the entire model and pressed the 3-key so now I have hundreds of parts that I have to find and switch back to smooth preview mode 1.

I have a backed up version and all the parts are named the same so if I can just select all the objects in that model that are at smooth preview level 1 I can fix my current model but I campletely forgot the mel code to do so and really do not want to have to spend days figuring it all out again.

As I recall the code was very simple like ... (which is why I probably never wrote it down)

Code:
string $selected[] = `ls -sl`;
for ( $node in $selected )
{
	// if $node is NOT at smooth previews level 1 unselect it
}

// everything left selected at this point will be at smooth preview level 1
I cannot remember the mel to query the smooth preview state of an object.


"If I have seen further it is by standing on the shoulders of giants." Sir Isaac Newton, 1675

Last edited by ctbram; 11-11-2013 at 02:57 PM.
# 2 11-11-2013 , 08:00 PM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
If the objects are poly then this would work, if it's a mix then the code would have to be smarter.

Code:
string $selection[] = `ls -sl`;
int $smoothStateList[];
int $smoothState;

for($obj in $selection){

	// query smooth state
	$smoothStateList = `displaySmoothness -q -po $obj`;
	$smoothState = $smoothStateList[0];

	// if smoothed, deselect
	if($smoothState  == 3)
		select -d $obj ;
	
	
	
}


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
# 3 12-11-2013 , 03:16 AM
ctbram's Avatar
Moderator
Join Date: Jan 2004
Location: Michigan, USA
Posts: 2,998
Thanks Gen,

displaySmoothness -q -po <obj> is exactly what I was trying to remember. Now I can pull out all the unsmoothed bits and put them into a set.

There is a mix of nurbs but your code gets me most of the way there. I will be sure to save it this time.

-Cheers,
Rick


"If I have seen further it is by standing on the shoulders of giants." Sir Isaac Newton, 1675

Last edited by ctbram; 12-11-2013 at 03:20 AM.
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads