3
$\begingroup$

I have used Blender regularly for years and don't consider myself a newbie by any means. But I have no idea if there is any way to tell what the active layer is. When creating a new object, linking in an instance from another .blend, etc. the new item will be placed on the active layer. But, as far as I know, there is no way to know which layer that is by looking at the UI.

We've got the little circles in the Layers panel indicating levels containing objects. And we've got the highlighted circle that shows which layer the selected object resides on. But nothing that shows what the active layer is.

Have I been missing something obvious all these years?

$\endgroup$
  • 1
    $\begingroup$ The active layer is one selected last. Still I'm not sure there is some way (without coding) to learn from UI only which one is active without adding objects and looking where they were added to $\endgroup$ – Mr Zak Sep 3 '15 at 12:45
  • 1
    $\begingroup$ A theme option to draw the active_layer in a slightly different color, would be welcome indeed. $\endgroup$ – zeffii Sep 3 '15 at 13:00
5
$\begingroup$

the outliner does show it, and it corresponds with bpy.context.scene.active_layer

enter image description here

$\endgroup$
1
$\begingroup$

Since the active_layer property start from 0, you have to add 1.

Starting from the UI PANEL SIMPLE template and the answer of @zeffii, you can run this script to add a panel in the Tool Shelf:

import bpy

class ActiveLayerPanel(bpy.types.Panel):
    """Creates a Panel in the Tool Shelf"""
    bl_label = "Active Layer Panel"
    bl_idname = "OBJECT_PT_activelayer"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'

    def draw(self, context):
        layout = self.layout

        obj = context.object
        layer = getActiveLayer(context.scene)

        row = layout.row()
        row.label(text="ACTIVE LAYER", icon='RENDERLAYERS')

        row = layout.row()
        row.label(text="Active layer is: " + str(layer))

def getActiveLayer(scene):
    return scene.active_layer + 1

def register():
    bpy.utils.register_class(ActiveLayerPanel)

def unregister():
    bpy.utils.unregister_class(ActiveLayerPanel)

if __name__ == "__main__":
    register()

The panel shows the active layer

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.