why ls doesnt have any argument to return renderable objects

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Display Modes
  09 September 2012
Question why ls doesnt have any argument to return renderable objects

I was looking through ls documentation to see if their is some way for it so that it just returns a list of renderable objects out of selection or out of whole scene if sl= False....
 
  09 September 2012
When you say renderable, you mean the render stats > primary visibility? If so, you can try this

from maya import cmds
primaryOBJ = [d for d in cmds.ls(sl=False, g=True) if cmds.getAttr("%s.primaryVisibility" % d)]

or if you simply want list of objects, it's the "g=True" (DAG geometry) flag.
 
  09 September 2012
well no that doesnt returns only renderable objects, this will even return object like curveshepe,

by renderable I mean objects that can be rendered out to what I can apply shader...
 
  09 September 2012
Hm. That would depend on your render engine... I don't think Maya itself can check that.
 
  09 September 2012
So you mean some render engine even render out curves, I am only talking about Maya Software (scanline), mental ray or VRay...

but what I need is specially for mental ray.!!!
 
  09 September 2012
Wink assuming subdiv, poly mesh or nurbsSurface to be only renderable

assuming subdiv, poly mesh or nurbsSurface to be only renderable objects I have come up with this solution.

 objDic={}
selObjects = cmds.ls(g=True,st=True)
renderable=('mesh','nurbsSurface','subdiv')
for index,each in enumerate(reversed(selObjects)):
	if index%2==0:
		key=each
	elif index % 2!=0:
		value=each
		objDic.update({key:value})
	else:
		pass
for each in objDic:
	if each in renderable:
		print each," ", objDic[each]
I know its not the best or most efficient way but I am still learning so if anyone now the best or the most efficient way please tell me..
 
  09 September 2012
Yes other renderers can render nurbs curves, paint effects and other geometry types directly.

Anyway if you just want to list all the mesh, nurbs and subdivs in your scene, here is the pymel method.

from pymel.core import *
mynode = ls (fl=True, dag=True, ni=True, type=['mesh', 'nurbsSurface', 'subdiv'])
print mynode


Hope that helps.
 
  10 October 2012
Originally Posted by earlyworm: Yes other renderers can render nurbs curves, paint effects and other geometry types directly.

Anyway if you just want to list all the mesh, nurbs and subdivs in your scene, here is the pymel method.

from pymel.core import *
 mynode = ls (fl=True, dag=True, ni=True, type=['mesh', 'nurbsSurface', 'subdiv'])
 print mynode


Hope that helps.
very nice however the code returns [nt.Mesh(u'pCylinderShape1'), nt.NurbsSurface(u'nurbsCylinderShape1')] if I have a poly cylinder and nurbesCylinder , i get this is a list how do I access the part that says its mesh or NurbsSurface..
 
  10 October 2012
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 06:20 AM.


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