Fix #21917: add object operator has 30 layers, now the layer property
has just 20 and the local view layers are added afterwards.
This commit is contained in:
@@ -183,7 +183,7 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
|
||||
RNA_def_float_vector(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object.", -FLT_MAX, FLT_MAX);
|
||||
RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", -FLT_MAX, FLT_MAX);
|
||||
|
||||
prop = RNA_def_boolean_layer_member(ot->srna, "layer", 32, NULL, "Layer", "");
|
||||
prop = RNA_def_boolean_layer_member(ot->srna, "layer", 20, NULL, "Layer", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN);
|
||||
}
|
||||
|
||||
@@ -193,32 +193,28 @@ static void object_add_generic_invoke_options(bContext *C, wmOperator *op)
|
||||
if (!RNA_property_is_set(op->ptr, "enter_editmode"))
|
||||
RNA_boolean_set(op->ptr, "enter_editmode", U.flag & USER_ADD_EDITMODE);
|
||||
|
||||
if (!RNA_property_is_set(op->ptr, "location")) {
|
||||
if(!RNA_property_is_set(op->ptr, "location")) {
|
||||
float loc[3];
|
||||
|
||||
ED_object_location_from_view(C, loc);
|
||||
RNA_float_set_array(op->ptr, "location", loc);
|
||||
}
|
||||
|
||||
if (!RNA_property_is_set(op->ptr, "layer")) {
|
||||
if(!RNA_property_is_set(op->ptr, "layer")) {
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
int a, values[32], layer;
|
||||
int a, values[20], layer;
|
||||
|
||||
if (v3d) {
|
||||
if (v3d->localvd) {
|
||||
layer = v3d->layact + v3d->lay;
|
||||
for(a=0; a<32; a++)
|
||||
values[a]= (layer & (1<<a));
|
||||
} else {
|
||||
layer = (v3d->scenelock)?scene->layact:v3d->layact;
|
||||
if(v3d) {
|
||||
layer = (v3d->scenelock && !v3d->localvd)? scene->layact: v3d->layact;
|
||||
|
||||
for(a=0; a<32; a++)
|
||||
values[a]= (layer & (1<<a));
|
||||
}
|
||||
} else {
|
||||
for(a=0; a<20; a++)
|
||||
values[a]= (layer & (1<<a));
|
||||
}
|
||||
else {
|
||||
layer = scene->layact;
|
||||
for(a=0; a<32; a++)
|
||||
|
||||
for(a=0; a<20; a++)
|
||||
values[a]= (layer & (1<<a));
|
||||
}
|
||||
|
||||
@@ -234,7 +230,8 @@ int ED_object_add_generic_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
|
||||
int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, float *rot, int *enter_editmode, unsigned int *layer)
|
||||
{
|
||||
int a, layer_values[32];
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
int a, layer_values[20];
|
||||
int view_align;
|
||||
|
||||
*enter_editmode = FALSE;
|
||||
@@ -245,7 +242,7 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa
|
||||
if(RNA_property_is_set(op->ptr, "layer")) {
|
||||
RNA_boolean_get_array(op->ptr, "layer", layer_values);
|
||||
|
||||
for(a=0; a<32; a++) {
|
||||
for(a=0; a<20; a++) {
|
||||
if(layer_values[a])
|
||||
*layer |= (1 << a);
|
||||
else
|
||||
@@ -258,6 +255,11 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa
|
||||
*layer = scene->layact;
|
||||
}
|
||||
|
||||
/* in local view we additionally add local view layers,
|
||||
not part of operator properties */
|
||||
if(v3d && v3d->localvd)
|
||||
*layer |= v3d->lay;
|
||||
|
||||
if (RNA_property_is_set(op->ptr, "view_align"))
|
||||
view_align = RNA_boolean_get(op->ptr, "view_align");
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user