diff options
Diffstat (limited to 'source/blender/editors/object/object_select.c')
-rw-r--r-- | source/blender/editors/object/object_select.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 10e9b58b38b..c4538a8951f 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -138,11 +138,14 @@ void ED_object_base_activate(bContext *C, Base *base) DEG_id_tag_update(&CTX_data_scene(C)->id, DEG_TAG_SELECT_UPDATE); } -bool ED_object_base_deselect_all_ex(ViewLayer *view_layer, int action, bool *r_any_visible) +bool ED_object_base_deselect_all_ex(ViewLayer *view_layer, View3D *v3d, int action, bool *r_any_visible) { if (action == SEL_TOGGLE) { action = SEL_SELECT; - FOREACH_VISIBLE_BASE_BEGIN(view_layer, base) { + FOREACH_VISIBLE_BASE_BEGIN(view_layer, v3d, base) { + if (v3d && ((v3d->object_type_exclude_select & (1 << base->object->type)) != 0)) { + continue; + } if ((base->flag & BASE_SELECTED) != 0) { action = SEL_DESELECT; break; @@ -153,7 +156,10 @@ bool ED_object_base_deselect_all_ex(ViewLayer *view_layer, int action, bool *r_a bool any_visible = false; bool changed = false; - FOREACH_VISIBLE_BASE_BEGIN(view_layer, base) { + FOREACH_VISIBLE_BASE_BEGIN(view_layer, v3d, base) { + if (v3d && ((v3d->object_type_exclude_select & (1 << base->object->type)) != 0)) { + continue; + } switch (action) { case SEL_SELECT: if ((base->flag & BASE_SELECTED) == 0) { @@ -188,9 +194,9 @@ bool ED_object_base_deselect_all_ex(ViewLayer *view_layer, int action, bool *r_a } -bool ED_object_base_deselect_all(ViewLayer *view_layer, int action) +bool ED_object_base_deselect_all(ViewLayer *view_layer, View3D *v3d, int action) { - return ED_object_base_deselect_all_ex(view_layer, action, NULL); + return ED_object_base_deselect_all_ex(view_layer, v3d, action, NULL); } /********************** Jump To Object Utilities **********************/ @@ -258,6 +264,7 @@ bool ED_object_jump_to_object( bContext *C, Object *ob, const bool UNUSED(reveal_hidden)) { ViewLayer *view_layer = CTX_data_view_layer(C); + View3D *v3d = CTX_wm_view3d(C); Base *base = BKE_view_layer_base_find(view_layer, ob); if (base == NULL) { @@ -269,7 +276,7 @@ bool ED_object_jump_to_object( if (view_layer->basact != base || !(base->flag & BASE_SELECTED)) { /* Select if not selected. */ if (!(base->flag & BASE_SELECTED)) { - ED_object_base_deselect_all(view_layer, SEL_DESELECT); + ED_object_base_deselect_all(view_layer, v3d, SEL_DESELECT); if (base->flag & BASE_VISIBLE) { ED_object_base_select(base, BA_SELECT); @@ -388,13 +395,14 @@ static bool objects_selectable_poll(bContext *C) static int object_select_by_type_exec(bContext *C, wmOperator *op) { ViewLayer *view_layer = CTX_data_view_layer(C); + View3D *v3d = CTX_wm_view3d(C); short obtype, extend; obtype = RNA_enum_get(op->ptr, "type"); extend = RNA_boolean_get(op->ptr, "extend"); if (extend == 0) { - ED_object_base_deselect_all(view_layer, SEL_DESELECT); + ED_object_base_deselect_all(view_layer, v3d, SEL_DESELECT); } CTX_DATA_BEGIN (C, Base *, base, visible_bases) @@ -610,6 +618,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); + View3D *v3d = CTX_wm_view3d(C); Object *ob; int nr = RNA_enum_get(op->ptr, "type"); bool changed = false, extend; @@ -617,7 +626,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op) extend = RNA_boolean_get(op->ptr, "extend"); if (extend == 0) { - ED_object_base_deselect_all(view_layer, SEL_DESELECT); + ED_object_base_deselect_all(view_layer, v3d, SEL_DESELECT); } ob = OBACT(view_layer); @@ -981,6 +990,7 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); + View3D *v3d = CTX_wm_view3d(C); Object *ob; const int type = RNA_enum_get(op->ptr, "type"); bool changed = false, extend; @@ -988,7 +998,7 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op) extend = RNA_boolean_get(op->ptr, "extend"); if (extend == 0) { - changed = ED_object_base_deselect_all(view_layer, SEL_DESELECT); + changed = ED_object_base_deselect_all(view_layer, v3d, SEL_DESELECT); } ob = OBACT(view_layer); @@ -1073,10 +1083,11 @@ void OBJECT_OT_select_grouped(wmOperatorType *ot) static int object_select_all_exec(bContext *C, wmOperator *op) { ViewLayer *view_layer = CTX_data_view_layer(C); + View3D *v3d = CTX_wm_view3d(C); int action = RNA_enum_get(op->ptr, "action"); bool any_visible = false; - bool changed = ED_object_base_deselect_all_ex(view_layer, action, &any_visible); + bool changed = ED_object_base_deselect_all_ex(view_layer, v3d, action, &any_visible); if (changed) { Scene *scene = CTX_data_scene(C); |