diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-10-11 16:35:14 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-10-11 16:35:14 +0300 |
commit | 17603b9f01ca1d70b327a6b81d9a751b510a7f04 (patch) | |
tree | 5b9c5a04f81271947fc1b5f1b4f90c209da9cf06 /source/blender/makesrna/intern | |
parent | 5322ff3b482cf85fb7f5f2e3df909d63b6fc292f (diff) |
Fix objects added via py being on the wrong layer when viewport is decoupled from scene
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index b6c393280ba..8fb99703e9b 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -522,6 +522,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); @@ -2647,6 +2654,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); |