Hey there,

Sorry that you haven't seen a reply yet to your question. One of the
helpful ways of figuring out how to replicate a user action in code is to
open the Script Editor and enable the "Echo All Commands" option under the
History menu. Then when you perform an action in the Maya UI, you can see
what code is being triggered. Doing so may either tell you directly what
command you can run, or it may help point you at a mel script to look into.

For instance, if I duplicate a render layer (in Maya 2016), I find out that
the following mel command is used:

renderLayerEditorCopyLayer RenderLayerTab <layer name>

​

I can run this directly, and it will duplicate the named render layer:

import maya.mel as mm
layerName = "layer1"
mm.eval("renderLayerEditorCopyLayer RenderLayerTab {}".format(layerName))

​

If I wanted to know more details about this mel command, I could do this
(in mel):

whatIs renderLayerEditorCopyLayer

​

And it would either tell me it is a builtin command and has no source file,
or tell me the mel script that defined the proc. In this case, it tells me
that it is defined by Maya, in its startup/scripts/layerEditor.mel

Hope this helps.

Justin

On Wed, Oct 12, 2016 at 2:27 AM Andreas Böinghoff <
boeingh...@themarmalade.com> wrote:

> Hey Guys,
> we are new to Maya and asked us,if there is a scripted way to duplicate
> the current renderlayer (in Maya 2017) via script. I already found a way to
> create a new layer+collection+override, but I was not able to duplicate the
> current renderlayer with all collections and overrides. Has someone a code
> snippet for me that explains how I do that.
> Thanks,
> Andy
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/acf61b7d-f838-42f4-a7e4-2438f3f4b48b%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/acf61b7d-f838-42f4-a7e4-2438f3f4b48b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1kD%3Dbi6BMXxegccyS%2BTZAyFOmWM9Uq2GYcHyP%3D9_RhqQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to