diff options
Diffstat (limited to 'source/blender/editors/object/object_select.c')
-rw-r--r-- | source/blender/editors/object/object_select.c | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index e295a63848a..83334e4e6a3 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -47,7 +47,7 @@ #include "BLI_rand.h" #include "BLI_utildefines.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "BKE_context.h" #include "BKE_group.h" @@ -618,15 +618,15 @@ static bool select_grouped_group(bContext *C, Object *ob) /* Select objects in } /* build the menu. */ - pup = uiPupMenuBegin(C, IFACE_("Select Group"), ICON_NONE); - layout = uiPupMenuLayout(pup); + pup = UI_popup_menu_begin(C, IFACE_("Select Group"), ICON_NONE); + layout = UI_popup_menu_layout(pup); for (i = 0; i < group_count; i++) { group = ob_groups[i]; uiItemStringO(layout, group->id.name + 2, 0, "OBJECT_OT_select_same_group", "group", group->id.name + 2); } - uiPupMenuEnd(C, pup); + UI_popup_menu_end(C, pup); return changed; /* The operator already handle this! */ } @@ -929,11 +929,16 @@ void OBJECT_OT_select_grouped(wmOperatorType *ot) } /************************* Select by Layer **********************/ +enum { + OB_SEL_LAYERMATCH_EXACT = 1, + OB_SEL_LAYERMATCH_SHARED = 2, +}; static int object_select_by_layer_exec(bContext *C, wmOperator *op) { unsigned int layernum; - bool extend, match; + bool extend; + int match; extend = RNA_boolean_get(op->ptr, "extend"); layernum = RNA_int_get(op->ptr, "layers"); @@ -951,13 +956,21 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op) { bool ok = false; - if (match == true) /* exact */ - ok = (base->lay == (1 << (layernum - 1))); - else /* shared layers */ - ok = (base->lay & (1 << (layernum - 1))) != 0; + switch (match) { + case OB_SEL_LAYERMATCH_EXACT: + /* Mask out bits used for local view, only work on real layer ones, see T45783. */ + ok = ((base->lay & ((1 << 20) - 1)) == (1 << (layernum - 1))); + break; + case OB_SEL_LAYERMATCH_SHARED: + ok = (base->lay & (1 << (layernum - 1))) != 0; + break; + default: + break; + } - if (ok) + if (ok) { ED_base_object_select(base, BA_SELECT); + } } CTX_DATA_END; @@ -970,8 +983,8 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op) void OBJECT_OT_select_by_layer(wmOperatorType *ot) { static EnumPropertyItem match_items[] = { - {1, "EXACT", 0, "Exact Match", ""}, - {2, "SHARED", 0, "Shared Layers", ""}, + {OB_SEL_LAYERMATCH_EXACT, "EXACT", 0, "Exact Match", ""}, + {OB_SEL_LAYERMATCH_SHARED, "SHARED", 0, "Shared Layers", ""}, {0, NULL, 0, NULL, NULL} }; @@ -989,7 +1002,7 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - RNA_def_enum(ot->srna, "match", match_items, 0, "Match", ""); + RNA_def_enum(ot->srna, "match", match_items, OB_SEL_LAYERMATCH_EXACT, "Match", ""); RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection instead of deselecting everything first"); RNA_def_int(ot->srna, "layers", 1, 1, 20, "Layer", "", 1, 20); } |