forked from bartvdbraak/blender
Fix #30435: 2.62 Torus Batch building "Bug" or A Experimental Feature?
Python-defined primitives used to be added to all visible layers instead of adding to active scene layer as it happens with C-defined primitives.
This commit is contained in:
parent
e4253fa2b8
commit
0f3e1821ea
@ -86,7 +86,7 @@ def add_object_align_init(context, operator):
|
|||||||
return location * rotation
|
return location * rotation
|
||||||
|
|
||||||
|
|
||||||
def object_data_add(context, obdata, operator=None):
|
def object_data_add(context, obdata, operator=None, use_active_layer=True):
|
||||||
"""
|
"""
|
||||||
Add an object using the view context and preference to to initialize the
|
Add an object using the view context and preference to to initialize the
|
||||||
location, rotation and layer.
|
location, rotation and layer.
|
||||||
@ -111,7 +111,17 @@ def object_data_add(context, obdata, operator=None):
|
|||||||
base = scene.objects.link(obj_new)
|
base = scene.objects.link(obj_new)
|
||||||
base.select = True
|
base.select = True
|
||||||
|
|
||||||
|
v3d = None
|
||||||
if context.space_data and context.space_data.type == 'VIEW_3D':
|
if context.space_data and context.space_data.type == 'VIEW_3D':
|
||||||
|
v3d = context.space_data
|
||||||
|
|
||||||
|
if use_active_layer:
|
||||||
|
if v3d.local_view:
|
||||||
|
base.layers_from_view(context.space_data)
|
||||||
|
base.layers[scene.active_layer] = True
|
||||||
|
else:
|
||||||
|
base.layers = [True if i == scene.active_layer else False for i in range(len(scene.layers))]
|
||||||
|
if v3d:
|
||||||
base.layers_from_view(context.space_data)
|
base.layers_from_view(context.space_data)
|
||||||
|
|
||||||
obj_new.matrix_world = add_object_align_init(context, operator)
|
obj_new.matrix_world = add_object_align_init(context, operator)
|
||||||
|
@ -414,6 +414,13 @@ static void rna_Scene_layer_set(PointerRNA *ptr, const int *values)
|
|||||||
scene->lay = ED_view3d_scene_layer_set(scene->lay, values, &scene->layact);
|
scene->lay = ED_view3d_scene_layer_set(scene->lay, values, &scene->layact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int rna_Scene_active_layer_get(PointerRNA *ptr)
|
||||||
|
{
|
||||||
|
Scene *scene = (Scene*)ptr->data;
|
||||||
|
|
||||||
|
return (int)log2f(scene->layact);
|
||||||
|
}
|
||||||
|
|
||||||
static void rna_Scene_view3d_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
|
static void rna_Scene_view3d_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
Scene *scene = (Scene*)ptr->data;
|
Scene *scene = (Scene*)ptr->data;
|
||||||
@ -4097,7 +4104,13 @@ void RNA_def_scene(BlenderRNA *brna)
|
|||||||
RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_layer_set");
|
RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_layer_set");
|
||||||
RNA_def_property_ui_text(prop, "Layers", "Layers visible when rendering the scene");
|
RNA_def_property_ui_text(prop, "Layers", "Layers visible when rendering the scene");
|
||||||
RNA_def_property_update(prop, NC_SCENE|ND_LAYER, "rna_Scene_layer_update");
|
RNA_def_property_update(prop, NC_SCENE|ND_LAYER, "rna_Scene_layer_update");
|
||||||
|
|
||||||
|
/* active layer */
|
||||||
|
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_Scene_active_layer_get", NULL, NULL);
|
||||||
|
RNA_def_property_ui_text(prop, "Active Layer", "Active scene layer index");
|
||||||
|
|
||||||
/* Frame Range Stuff */
|
/* Frame Range Stuff */
|
||||||
prop = RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
|
prop = RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
|
||||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||||
|
Loading…
Reference in New Issue
Block a user