[ADDON] Copy Render Layer

As probably many of you noticed it’s impossible to copy render layer.
Sometimes we would like to make a copy of existing render layer and change only one or two settings.
In this case we have to add new render layer and set all of the parameters from scratch, which can be annoying, as almost all has been previously set in one of the existing render layers.

Here’s a little Add-On that makes it possible to Duplicate, Copy and Paste active render layer or all render layers:

Link to wiki:
http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Render/Copy_Render_Layer

Tracker:
http://projects.blender.org/tracker/index.php?func=detail&aid=34109&group_id=153&atid=467

How to use:
Currently we have 4 buttons available:

“Duplicate”: Duplicates selected render layer
“Copy”: Copies selected render layer to clipboard
“Copy All”: Copies all render layers of active scene to clipboard
“Paste”: Pastes render layers from clipboard to active scene.

It works across scenes in the same file as well as between files.
If you want to Copy/Paste render layers between files do this:
“Copy” or :Copy All", then open the destination file and hit “Paste”

All of the render layers will be pasted to current scene of opened file.

If any of copied render layers had “material override” or “light override” and such material or light group doesn’t exist in destination file - it simply won’t be pasted and warning in info panel will appear.


I have not yet needed your script, but what I learned is well very much interesting:
Miss using the toolshelf :wink: and how to do that so very easy, defining the button!


def register():
    bpy.utils.register_class(CopyRenderLayer)
    bpy.types.VIEW3D_PT_tools_objectmode.prepend(button)
#    bpy.types.RENDER_PT_layers.prepend(button)

Thank you!

Hi Bartek,

here is an alternative doit


def doit():
    #Active Render Layer
    a = bpy.context.scene.render.layers.active
    a_name = a.name
    
    #add new Render Layer
    bpy.ops.scene.render_layer_add()
    b = bpy.context.scene.render.layers.active
    
    #Copy attributes from original
    for key in a.bl_rna.properties.keys():
        cmd = "b.%s = a.%s" % (key, key)
        try:
            exec(cmd)
        except:
            print("ERROR", key)
        
    b.name = a_name + "_COPY"
    
    return {'FINISHED'}

Uploaded add on to blender’s uploads. Check first post of this thread for current version.

wiki:
http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Render/Copy_Render_Layer

tracker:
http://projects.blender.org/tracker/index.php?func=detail&aid=34109&group_id=153&atid=467