thanks for pymel info, I'll look that after this job. For the moment I'm wondering if it is possible to select a render layer (make it the default one) using the api. With your help I can now have the list of them, but if I want to give a shader to an object on a particular render layer I think I have to select it before... but I don't find anything helpfull in the api doc, or more exactly I surely don't know where to look. If somebody knows if it's possible it would be very nice. Philippe.
On 26 mar, 16:42, Chad Dombrova <[email protected]> wrote: > > I'm wondering about pymel, as it seem to be powerful and much more > > "pythonic", but I've a few questions: > > -is pymel easy to install and use? > > installing it for use from within the maya GUI is very easy -- no > harder than any other python module. it takes a little more know-how > to get it working through an external interpreter. > > > -is there a documentation to find all the functionalities as with the > > api? > > docs are here, which also includes installation > instructions:http://pymel.googlecode.com/svn/docs/index.html > you'll find all the api-equivalent classes in nodetypes and datatypes. > > > -can I do everything with pymel as I could (if I knew ;) ) with the > > API? > > you can't do *everything* the API can, but you can do most everything, > plus a lot more. you cannot use pymel to make new plugins. there are > some api types and methods which are not wrapped. pymel is not trying > to be a replacement for the API, but rather something that exists on > the spectrum between the API and MEL. > > -chad > > > > > Thank you for your help. > > Philippe. > > > On 25 mar, 20:32, Paul Molodowitch <[email protected]> wrote: > >> Your proplem is that lsFn.listAllRenderLayers doesn't actually return > >> a value - instead, it stores it's result in objArr. > > >> You have to do this. > > >> import maya.OpenMaya as om > >> import maya.OpenMayaRender as omRender > > >> objArr = om.MObjectArray() > >> lsFn = omRender.MFnRenderLayer() > >> lsFn.listAllRenderLayers (objArr ) > >> for i in xrange(objArr.length()): > >> print omRender.MFnRenderLayer(objArr[i]).name() > > >> Unfortunately, the API was designed with C++ in mind, so it doesn't > >> behave very 'pythonically'. If you want a way to interact with the > >> api that behaves more like you expect, try pymel. > > >> The same task in pymel: > > >> from pymel import * > >> print RenderLayer.listAllRenderLayers() > > >> Done. =) > > >> -Paul > > >> On Wed, Mar 25, 2009 at 10:06 AM, kzax <[email protected]> > >> wrote: > > >>> Hello, I'm trying to learn how to use the API to solve a problem > >>> with > >>> render layers with pre render script. > >>> To begin to learn I'm trying to make a list of render layers wich > >>> are > >>> in my scene : > > >>> import maya.OpenMaya as om > >>> import maya.OpenMayaRender as omRender > > >>> objArr = om.MObjectArray() > >>> lsFn = omRender.MFnRenderLayer() > >>> l = lsFn.listAllRenderLayers (objArr ) > >>> print l > > >>> and the answer is always 'None', but there are render layers in the > >>> scene! > >>> What's wrong? > >>> Thanks, > >>> Philippe. > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
