Merge remote-tracking branch 'origin/master' into blender2.8
[blender.git] / source / blender / makesrna / intern / rna_space.c
index 9eaff19770ae307e1b315dc60dd7d31d27a7b6ad..04b8942ecb9e6e202eb11d12b462614c46dd42b0 100644 (file)
@@ -520,6 +520,13 @@ static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const int *values)
        v3d->lay = ED_view3d_scene_layer_set(v3d->lay, values, &v3d->layact);
 }
 
+static int rna_SpaceView3D_active_layer_get(PointerRNA *ptr)
+{
+       View3D *v3d = (View3D *)(ptr->data);
+
+       return (int)(log(v3d->layact) / M_LN2);
+}
+
 static void rna_SpaceView3D_layer_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
 {
        DAG_on_visible_update(bmain, false);
@@ -2637,6 +2644,11 @@ static void rna_def_space_view3d(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible in this 3D View");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_layer_update");
 
+       prop = RNA_def_property(srna, "active_layer", PROP_INT, PROP_NONE);
+       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+       RNA_def_property_int_funcs(prop, "rna_SpaceView3D_active_layer_get", NULL, NULL);
+       RNA_def_property_ui_text(prop, "Active Layer", "Active 3D view layer index");
+
        prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER);
        RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000);
        RNA_def_property_array(prop, 8);