Fix inconsistent naming and behavior for base visible/selected/editable.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Tue, 8 Jan 2019 17:19:12 +0000 (18:19 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Tue, 8 Jan 2019 17:50:44 +0000 (18:50 +0100)
Fixes T60251.

15 files changed:
source/blender/blenkernel/BKE_layer.h
source/blender/blenkernel/intern/layer.c
source/blender/blenkernel/intern/object.c
source/blender/editors/gpencil/gpencil_utils.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_relations.c
source/blender/editors/screen/screen_context.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_gizmo_3d.c
source/blender/editors/transform/transform_orientations.c
source/blender/editors/transform/transform_snap_object.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_object_api.c

index 9ac0c56d93f126dbcde06db5c0125e9151c8b6ba..746733e4e0e13acc45f73c3feb5f1a422805dc31 100644 (file)
@@ -156,10 +156,6 @@ struct ObjectsInModeIteratorData {
        struct Base *base_active;
 };
 
-void BKE_view_layer_renderable_objects_iterator_begin(BLI_Iterator *iter, void *data_in);
-void BKE_view_layer_renderable_objects_iterator_next(BLI_Iterator *iter);
-void BKE_view_layer_renderable_objects_iterator_end(BLI_Iterator *iter);
-
 void BKE_view_layer_bases_in_mode_iterator_begin(BLI_Iterator *iter, void *data_in);
 void BKE_view_layer_bases_in_mode_iterator_next(BLI_Iterator *iter);
 void BKE_view_layer_bases_in_mode_iterator_end(BLI_Iterator *iter);
@@ -320,34 +316,6 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter);
        ITER_END;                                                                 \
 } ((void)0)
 
-struct ObjectsRenderableIteratorData {
-       struct Scene *scene;
-       struct Base base_temp;
-       struct Scene scene_temp;
-
-       struct {
-               struct ViewLayer *view_layer;
-               struct Base *base;
-               struct Scene *set;
-       } iter;
-};
-
-#define FOREACH_OBJECT_RENDERABLE_BEGIN(scene_, _instance)                    \
-{                                                                             \
-       struct ObjectsRenderableIteratorData data_ = {                            \
-           .scene = (scene_),                                                    \
-       };                                                                        \
-       ITER_BEGIN(BKE_view_layer_renderable_objects_iterator_begin,              \
-                  BKE_view_layer_renderable_objects_iterator_next,               \
-                  BKE_view_layer_renderable_objects_iterator_end,                \
-                  &data_, Object *, _instance)
-
-
-#define FOREACH_OBJECT_RENDERABLE_END                                         \
-       ITER_END;                                                                 \
-} ((void)0)
-
-
 /* layer_utils.c */
 
 struct ObjectsInModeParams {
index 288333830292014cb0842dad43e90fd613e609e8..304702ce475d148bfea9ed5131136f144e43ce1e 100644 (file)
@@ -1071,29 +1071,9 @@ typedef struct LayerObjectBaseIteratorData {
        Base *base;
 } LayerObjectBaseIteratorData;
 
-static bool object_bases_iterator_is_valid_ex(View3D *v3d, Base *base, const int flag)
+static bool object_bases_iterator_is_valid(View3D *v3d, Base *base, const int flag)
 {
-       if (v3d != NULL) {
-               BLI_assert(v3d->spacetype == SPACE_VIEW3D);
-               if ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0) {
-                       return false;
-               }
-
-               if (v3d->localvd && ((base->local_view_bits & v3d->local_view_uuid) == 0)) {
-                       return false;
-               }
-       }
-
-       if ((base->flag & flag) == 0) {
-               return false;
-       }
-
-       return true;
-}
-
-static bool object_bases_iterator_is_valid(View3D *v3d, Base *base)
-{
-       return object_bases_iterator_is_valid_ex(v3d, base, ~(0));
+       return BASE_VISIBLE(v3d, base) && ((base->flag & flag) == flag);
 }
 
 static void object_bases_iterator_begin(BLI_Iterator *iter, void *data_in_v, const int flag)
@@ -1116,7 +1096,7 @@ static void object_bases_iterator_begin(BLI_Iterator *iter, void *data_in_v, con
        data->v3d = v3d;
        data->base = base;
 
-       if (object_bases_iterator_is_valid_ex(v3d, base, flag) == false) {
+       if (object_bases_iterator_is_valid(v3d, base, flag) == false) {
                object_bases_iterator_next(iter, flag);
        }
        else {
@@ -1130,7 +1110,7 @@ static void object_bases_iterator_next(BLI_Iterator *iter, const int flag)
        Base *base = data->base->next;
 
        while (base) {
-               if (object_bases_iterator_is_valid_ex(data->v3d, base, flag)) {
+               if (object_bases_iterator_is_valid(data->v3d, base, flag)) {
                        iter->current = base;
                        data->base = base;
                        return;
@@ -1197,12 +1177,12 @@ void BKE_view_layer_selected_objects_iterator_end(BLI_Iterator *iter)
 
 void BKE_view_layer_visible_objects_iterator_begin(BLI_Iterator *iter, void *data_in)
 {
-       objects_iterator_begin(iter, data_in, BASE_VISIBLE);
+       objects_iterator_begin(iter, data_in, 0);
 }
 
 void BKE_view_layer_visible_objects_iterator_next(BLI_Iterator *iter)
 {
-       objects_iterator_next(iter, BASE_VISIBLE);
+       objects_iterator_next(iter, 0);
 }
 
 void BKE_view_layer_visible_objects_iterator_end(BLI_Iterator *iter)
@@ -1273,12 +1253,12 @@ void BKE_view_layer_selected_bases_iterator_end(BLI_Iterator *iter)
 
 void BKE_view_layer_visible_bases_iterator_begin(BLI_Iterator *iter, void *data_in)
 {
-       object_bases_iterator_begin(iter, data_in, BASE_VISIBLE);
+       object_bases_iterator_begin(iter, data_in, 0);
 }
 
 void BKE_view_layer_visible_bases_iterator_next(BLI_Iterator *iter)
 {
-       object_bases_iterator_next(iter, BASE_VISIBLE);
+       object_bases_iterator_next(iter, 0);
 }
 
 void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter)
@@ -1288,104 +1268,15 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter)
 
 /** \} */
 
-/* -------------------------------------------------------------------- */
-/** \name BKE_view_layer_renderable_objects_iterator
- * \{ */
-
-void BKE_view_layer_renderable_objects_iterator_begin(BLI_Iterator *iter, void *data_in)
-{
-       struct ObjectsRenderableIteratorData *data = data_in;
-
-       /* Tag objects to prevent going over the same object twice. */
-       for (Scene *scene = data->scene; scene; scene = scene->set) {
-               for (ViewLayer *view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
-                       for (Base *base = view_layer->object_bases.first; base; base = base->next) {
-                                base->object->id.flag |= LIB_TAG_DOIT;
-                       }
-               }
-       }
-
-       ViewLayer *view_layer = data->scene->view_layers.first;
-       data->iter.view_layer = view_layer;
-
-       data->base_temp.next = view_layer->object_bases.first;
-       data->iter.base = &data->base_temp;
-
-       data->iter.set = NULL;
-
-       iter->data = data_in;
-       BKE_view_layer_renderable_objects_iterator_next(iter);
-}
-
-void BKE_view_layer_renderable_objects_iterator_next(BLI_Iterator *iter)
-{
-       /* Set it early in case we need to exit and we are running from within a loop. */
-       iter->skip = true;
-
-       struct ObjectsRenderableIteratorData *data = iter->data;
-       Base *base = data->iter.base->next;
-
-       /* There is still a base in the current scene layer. */
-       if (base != NULL) {
-               Object *ob = base->object;
-
-               /* We need to set the iter.base even if the rest fail otherwise
-                * we keep checking the exactly same base over and over again. */
-               data->iter.base = base;
-
-               if (ob->id.flag & LIB_TAG_DOIT) {
-                       ob->id.flag &= ~LIB_TAG_DOIT;
-
-                       if ((base->flag & BASE_VISIBLE) != 0) {
-                               iter->skip = false;
-                               iter->current = ob;
-                       }
-               }
-               return;
-       }
-
-       /* Time to go to the next scene layer. */
-       if (data->iter.set == NULL) {
-               while ((data->iter.view_layer = data->iter.view_layer->next)) {
-                       ViewLayer *view_layer = data->iter.view_layer;
-                       if (view_layer->flag & VIEW_LAYER_RENDER) {
-                               data->base_temp.next = view_layer->object_bases.first;
-                               data->iter.base = &data->base_temp;
-                               return;
-                       }
-               }
-
-               /* Setup the "set" for the next iteration. */
-               data->scene_temp.set = data->scene;
-               data->iter.set = &data->scene_temp;
-               return;
-       }
-
-       /* Look for an object in the next set. */
-       while ((data->iter.set = data->iter.set->set)) {
-               ViewLayer *view_layer = BKE_view_layer_default_render(data->iter.set);
-               data->base_temp.next = view_layer->object_bases.first;
-               data->iter.base = &data->base_temp;
-               return;
-       }
-
-       iter->valid = false;
-}
-
-void BKE_view_layer_renderable_objects_iterator_end(BLI_Iterator *UNUSED(iter))
-{
-       /* Do nothing - iter->data was static allocated, we can't free it. */
-}
-
-/** \} */
-
 /* -------------------------------------------------------------------- */
 /** \name BKE_view_layer_bases_in_mode_iterator
  * \{ */
 
 static bool base_is_in_mode(struct ObjectsInModeIteratorData *data, Base *base)
 {
-       return (base->object->type == data->object_type) && (base->object->mode & data->object_mode) != 0;
+       return BASE_VISIBLE(data->v3d, base) &&
+              (base->object->type == data->object_type) &&
+              (base->object->mode & data->object_mode) != 0;
 }
 
 void BKE_view_layer_bases_in_mode_iterator_begin(BLI_Iterator *iter, void *data_in)
@@ -1406,7 +1297,7 @@ void BKE_view_layer_bases_in_mode_iterator_begin(BLI_Iterator *iter, void *data_
                data->object_type = base->object->type;
        }
 
-       if (object_bases_iterator_is_valid(data->v3d, base) == false || !base_is_in_mode(data, base)) {
+       if (!base_is_in_mode(data, base)) {
                BKE_view_layer_bases_in_mode_iterator_next(iter);
        }
 }
@@ -1428,10 +1319,7 @@ void BKE_view_layer_bases_in_mode_iterator_next(BLI_Iterator *iter)
        }
 
        while (base) {
-               if ((base != data->base_active) &&
-                   base_is_in_mode(data, base) &&
-                   object_bases_iterator_is_valid(data->v3d, base))
-               {
+               if ((base != data->base_active) && base_is_in_mode(data, base)) {
                        iter->current = base;
                        return;
                }
index 8ce43049265d990f6bf0e9844d45e7b204da9c03..78e22c203ab4661d59ad452a85864892797fe0b5 100644 (file)
@@ -3670,8 +3670,8 @@ LinkNode *BKE_object_relational_superset(struct ViewLayer *view_layer, eObjectSe
                        obrel_list_add(&links, ob);
                }
                else {
-                       if ((objectSet == OB_SET_SELECTED && TESTBASELIB_BGMODE(((View3D *)NULL), base)) ||
-                           (objectSet == OB_SET_VISIBLE  && BASE_EDITABLE_BGMODE(((View3D *)NULL), base)))
+                       if ((objectSet == OB_SET_SELECTED && BASE_SELECTED_EDITABLE(((View3D *)NULL), base)) ||
+                           (objectSet == OB_SET_VISIBLE  && BASE_EDITABLE(((View3D *)NULL), base)))
                        {
                                Object *ob = base->object;
 
@@ -3701,7 +3701,7 @@ LinkNode *BKE_object_relational_superset(struct ViewLayer *view_layer, eObjectSe
                                if (includeFilter & (OB_REL_CHILDREN | OB_REL_CHILDREN_RECURSIVE)) {
                                        Base *local_base;
                                        for (local_base = view_layer->object_bases.first; local_base; local_base = local_base->next) {
-                                               if (BASE_EDITABLE_BGMODE(((View3D *)NULL), local_base)) {
+                                               if (BASE_EDITABLE(((View3D *)NULL), local_base)) {
 
                                                        Object *child = local_base->object;
                                                        if (obrel_list_test(child)) {
index f7fafb56d3a004c4056305fad6cdd5a82b1b0044..607341add865749a1b3e2847d5d28132281373fc 100644 (file)
@@ -273,7 +273,7 @@ bGPdata *ED_gpencil_data_get_active_v3d(ViewLayer *view_layer, View3D *v3d)
        /* We have to make sure active object is actually visible and selected, else we must use default scene gpd,
         * to be consistent with ED_gpencil_data_get_active's behavior.
         */
-       if (base && TESTBASE(v3d, base)) {
+       if (base && BASE_SELECTED(v3d, base)) {
                if (base->object->type == OB_GPENCIL)
                        gpd = base->object->data;
        }
index 59ce42c50a5511053589eb5c58285595dbe302c1..0da8d6804e5e27e211748a99edebf41867565d00 100644 (file)
@@ -920,7 +920,7 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *
 
        for (base = FIRSTBASE(view_layer); base; base = base->next) {
                if (base != BASACT(view_layer)) {
-                       if (TESTBASELIB(v3d, base)) {
+                       if (BASE_SELECTED_EDITABLE(v3d, base)) {
                                DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
 
                                if (event == 1) {  /* loc */
index 3dec9d945a1cbc159b90ce0b1153a07562e423f1..4a306a6c4e352d3ec136d7ca156fcac3c9ae52e1 100644 (file)
@@ -1337,7 +1337,7 @@ static void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr))
        if (sce->id.lib) return;
 
        for (base = FIRSTBASE; base; base = base->next) {
-               if (TESTBASE(v3d, base)) {
+               if (BASE_SELECTED(v3d, base)) {
                        nbase = MEM_mallocN(sizeof(Base), "newbase");
                        *nbase = *base;
                        BLI_addhead(&(sce->base), nbase);
index d5683ae12678d65f8736042bc323a5765e9a6a41..b4dc2edd7cd90282f70453ef5008a97272da6a21 100644 (file)
@@ -111,17 +111,17 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
                return 1;
        }
        else if (CTX_data_equals(member, "visible_objects")) {
-               FOREACH_VISIBLE_OBJECT_BEGIN(view_layer, v3d, ob)
-               {
-                       CTX_data_id_list_add(result, &ob->id);
+               for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+                       if (BASE_VISIBLE(v3d, base)) {
+                               CTX_data_id_list_add(result, &base->object->id);
+                       }
                }
-               FOREACH_VISIBLE_BASE_END;
                CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
                return 1;
        }
        else if (CTX_data_equals(member, "selectable_objects")) {
                for (Base *base = view_layer->object_bases.first; base; base = base->next) {
-                       if (BASE_SELECTABLE_BGMODE(v3d, base)) {
+                       if (BASE_SELECTABLE(v3d, base)) {
                                CTX_data_id_list_add(result, &base->object->id);
                        }
                }
@@ -129,49 +129,45 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
                return 1;
        }
        else if (CTX_data_equals(member, "selected_objects")) {
-               FOREACH_SELECTED_OBJECT_BEGIN(view_layer, v3d, ob)
-               {
-                       CTX_data_id_list_add(result, &ob->id);
+               for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+                       if (BASE_SELECTED(v3d, base)) {
+                               CTX_data_id_list_add(result, &base->object->id);
+                       }
                }
-               FOREACH_SELECTED_OBJECT_END;
                CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
                return 1;
        }
        else if (CTX_data_equals(member, "selected_editable_objects")) {
-               FOREACH_SELECTED_OBJECT_BEGIN(view_layer, v3d, ob)
-               {
-                       if (0 == BKE_object_is_libdata(ob)) {
-                               CTX_data_id_list_add(result, &ob->id);
+               for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+                       if (BASE_SELECTED_EDITABLE(v3d, base)) {
+                               CTX_data_id_list_add(result, &base->object->id);
                        }
                }
-               FOREACH_SELECTED_OBJECT_END;
                CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
                return 1;
        }
        else if (CTX_data_equals(member, "editable_objects")) {
                /* Visible + Editable, but not necessarily selected */
-               FOREACH_VISIBLE_OBJECT_BEGIN(view_layer, v3d, ob)
-               {
-                       if (0 == BKE_object_is_libdata(ob)) {
-                               CTX_data_id_list_add(result, &ob->id);
+               for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+                       if (BASE_EDITABLE(v3d, base)) {
+                               CTX_data_id_list_add(result, &base->object->id);
                        }
                }
-               FOREACH_VISIBLE_OBJECT_END;
                CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
                return 1;
        }
        else if ( CTX_data_equals(member, "visible_bases")) {
-               FOREACH_VISIBLE_BASE_BEGIN(view_layer, v3d, base)
-               {
-                       CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
+               for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+                       if (BASE_VISIBLE(v3d, base)) {
+                               CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
+                       }
                }
-               FOREACH_VISIBLE_BASE_END;
                CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
                return 1;
        }
        else if (CTX_data_equals(member, "selectable_bases")) {
                for (Base *base = view_layer->object_bases.first; base; base = base->next) {
-                       if (BASE_SELECTABLE_BGMODE(v3d, base)) {
+                       if (BASE_SELECTABLE(v3d, base)) {
                                CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
                        }
                }
@@ -180,7 +176,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
        }
        else if (CTX_data_equals(member, "selected_bases")) {
                for (Base *base = view_layer->object_bases.first; base; base = base->next) {
-                       if (BASE_VISIBLE_BGMODE(v3d, base) && (base->flag & BASE_SELECTED) != 0) {
+                       if (BASE_SELECTED(v3d, base)) {
                                CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
                        }
                }
@@ -189,10 +185,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
        }
        else if (CTX_data_equals(member, "selected_editable_bases")) {
                for (Base *base = view_layer->object_bases.first; base; base = base->next) {
-                       if (BASE_VISIBLE_BGMODE(v3d, base) && (base->flag & BASE_SELECTED) != 0) {
-                               if (0 == BKE_object_is_libdata(base->object)) {
-                                       CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
-                               }
+                       if (BASE_SELECTED_EDITABLE(v3d, base)) {
+                               CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
                        }
                }
                CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
@@ -201,10 +195,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
        else if (CTX_data_equals(member, "editable_bases")) {
                /* Visible + Editable, but not necessarily selected */
                for (Base *base = view_layer->object_bases.first; base; base = base->next) {
-                       if (BASE_VISIBLE_BGMODE(v3d, base)) {
-                               if (0 == BKE_object_is_libdata(base->object)) {
-                                       CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
-                               }
+                       if (BASE_EDITABLE(v3d, base)) {
+                               CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
                        }
                }
                CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
index 0586f11452a2b35ee6d11daa09e396a8e937626f..070e02074ffc77aafad0a0b4dc1ed8abf4b6c070 100644 (file)
@@ -299,7 +299,7 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
 
                zero_v3(select_center);
                for (base_eval = FIRSTBASE(view_layer_eval); base_eval; base_eval = base_eval->next) {
-                       if (TESTBASE(v3d, base_eval)) {
+                       if (BASE_SELECTED(v3d, base_eval)) {
                                /* use the boundbox if we can */
                                Object *ob_eval = base_eval->object;
 
@@ -2822,7 +2822,7 @@ static int viewselected_exec(bContext *C, wmOperator *op)
                /* this is weak code this way, we should make a generic active/selection callback interface once... */
                Base *base_eval;
                for (base_eval = view_layer_eval->object_bases.first; base_eval; base_eval = base_eval->next) {
-                       if (TESTBASELIB(v3d, base_eval)) {
+                       if (BASE_SELECTED_EDITABLE(v3d, base_eval)) {
                                if (base_eval->object->type == OB_ARMATURE)
                                        if (base_eval->object->mode & OB_MODE_POSE)
                                                break;
@@ -2889,7 +2889,7 @@ static int viewselected_exec(bContext *C, wmOperator *op)
        else {
                Base *base_eval;
                for (base_eval = FIRSTBASE(view_layer_eval); base_eval; base_eval = base_eval->next) {
-                       if (TESTBASE(v3d, base_eval)) {
+                       if (BASE_SELECTED(v3d, base_eval)) {
 
                                if (skip_camera && base_eval->object == v3d->camera) {
                                        continue;
index 24143c31463fa8234aed59d302533a8404a93c24..48caace5fd3e7b8c9f99f143d04b563331d4eab6 100644 (file)
@@ -1186,7 +1186,7 @@ static bool view3d_localview_init(
                }
                else {
                        for (base = FIRSTBASE(view_layer); base; base = base->next) {
-                               if (TESTBASE(v3d, base)) {
+                               if (BASE_SELECTED(v3d, base)) {
                                        BKE_object_minmax(base->object, min, max, false);
                                        base->local_view_bits |= local_view_bit;
                                        ok = true;
@@ -1421,7 +1421,7 @@ static int localview_remove_from_exec(bContext *C, wmOperator *op)
        bool changed = false;
 
        for (Base *base = FIRSTBASE(view_layer); base; base = base->next) {
-               if (TESTBASE(v3d, base)) {
+               if (BASE_SELECTED(v3d, base)) {
                        base->local_view_bits &= ~v3d->local_view_uuid;
                        ED_object_base_select(base, BA_DESELECT);
 
index 47624293a0b33680b13d8162e508d18ebb5789c7..1dce388a275b0de04a541876e27d84bb4fbef75a 100644 (file)
@@ -5874,7 +5874,7 @@ static void set_trans_object_base_flags(TransInfo *t)
        /* Traverse all bases and set all possible flags. */
        for (Base *base = view_layer->object_bases.first; base; base = base->next) {
                base->flag_legacy &= ~BA_WAS_SEL;
-               if (TESTBASELIB_BGMODE(v3d, base)) {
+               if (BASE_SELECTED_EDITABLE(v3d, base)) {
                        Object *ob = base->object;
                        Object *parsel = ob->parent;
                        /* If parent selected, deselect. */
@@ -5882,7 +5882,7 @@ static void set_trans_object_base_flags(TransInfo *t)
                                if (parsel->base_flag & BASE_SELECTED) {
                                        Base *parbase = BKE_view_layer_base_find(view_layer, parsel);
                                        if (parbase != NULL) { /* in rare cases this can fail */
-                                               if (TESTBASELIB_BGMODE(v3d, parbase)) {
+                                               if (BASE_SELECTED_EDITABLE(v3d, parbase)) {
                                                        break;
                                                }
                                        }
@@ -5940,7 +5940,7 @@ static int count_proportional_objects(TransInfo *t)
        {
                /* Mark all parents. */
                for (Base *base = view_layer->object_bases.first; base; base = base->next) {
-                       if (TESTBASELIB_BGMODE(v3d, base)) {
+                       if (BASE_SELECTED_EDITABLE(v3d, base)) {
                                Object *parent = base->object->parent;
                                /* flag all parents */
                                while (parent != NULL) {
@@ -5954,7 +5954,7 @@ static int count_proportional_objects(TransInfo *t)
                        /* all base not already selected or marked that is editable */
                        if ((base->object->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
                            (base->flag & BASE_SELECTED) == 0 &&
-                           (BASE_EDITABLE_BGMODE(v3d, base)))
+                           (BASE_EDITABLE(v3d, base)))
                        {
                                mark_children(base->object);
                        }
@@ -5968,7 +5968,7 @@ static int count_proportional_objects(TransInfo *t)
                 */
                if ((ob->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
                    (base->flag & BASE_SELECTED) == 0 &&
-                   (BASE_EDITABLE_BGMODE(v3d, base)))
+                   (BASE_EDITABLE(v3d, base)))
                {
                        flush_trans_object_base_deps_flag(depsgraph, ob);
                        total += 1;
@@ -6937,7 +6937,7 @@ static void createTransObject(bContext *C, TransInfo *t)
        TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t);
 
        /* count */
-       tc->data_len = CTX_DATA_COUNT(C, selected_objects);
+       tc->data_len = CTX_DATA_COUNT(C, selected_bases);
 
        if (!tc->data_len) {
                /* clear here, main transform function escapes too */
@@ -6989,7 +6989,7 @@ static void createTransObject(bContext *C, TransInfo *t)
                        /* if base is not selected, not a parent of selection or not a child of selection and it is editable */
                        if ((ob->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
                            (base->flag & BASE_SELECTED) == 0 &&
-                           BASE_EDITABLE_BGMODE(v3d, base))
+                           BASE_EDITABLE(v3d, base))
                        {
                                td->protectflag = ob->protectflag;
                                td->ext = tx;
index ddd0c8710159363ef6b1aef66163df0af7fa5ea7..7a9fceec3a1c706a6d4ee3501b7175f803621461 100644 (file)
@@ -1088,7 +1088,7 @@ int ED_transform_calc_gizmo_stats(
                if (base && ((base->flag & BASE_SELECTED) == 0)) ob = NULL;
 
                for (base = view_layer->object_bases.first; base; base = base->next) {
-                       if (!TESTBASELIB(v3d, base)) {
+                       if (!BASE_SELECTED_EDITABLE(v3d, base)) {
                                continue;
                        }
                        if (ob == NULL) {
index 04999213c6312e338e18451fb8c57fd07de10b7b..f08b26455fcccf95f5854046325e13bb8f8bb8cd 100644 (file)
@@ -1079,7 +1079,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
                        /* first selected */
                        ob = NULL;
                        for (base = view_layer->object_bases.first; base; base = base->next) {
-                               if (TESTBASELIB(v3d, base)) {
+                               if (BASE_SELECTED_EDITABLE(v3d, base)) {
                                        ob = base->object;
                                        break;
                                }
index b409e6059b4019874390d17f2629b9b8a870250e..94766262711010c493815416674730d7a490ec88 100644 (file)
@@ -225,7 +225,7 @@ static void iter_snap_objects(
 
        Base *base_act = view_layer->basact;
        for (Base *base = view_layer->object_bases.first; base != NULL; base = base->next) {
-               if ((BASE_VISIBLE_BGMODE(v3d, base)) && (base->flag_legacy & BA_SNAP_FIX_DEPS_FIASCO) == 0 &&
+               if ((BASE_VISIBLE(v3d, base)) && (base->flag_legacy & BA_SNAP_FIX_DEPS_FIASCO) == 0 &&
                    !((snap_select == SNAP_NOT_SELECTED && ((base->flag & BASE_SELECTED) || (base->flag_legacy & BA_WAS_SEL))) ||
                      (snap_select == SNAP_NOT_ACTIVE && base == base_act)))
                {
index d227beda27543864e5432e3a7b5dad2f24293220..a1e2afaf05572fd790d8e10b6a650042a53f966a 100644 (file)
@@ -1959,34 +1959,22 @@ extern const char *RE_engine_id_CYCLES;
 #define MINAFRAME      -1048574
 #define MINAFRAMEF     -1048574.0f
 
-/* deprecate this! */
 #define BASE_VISIBLE(v3d, base) (                                                                        \
-       (((v3d)->localvd == NULL) || ((v3d)->local_view_uuid & (base)->local_view_bits)) &&                  \
-       (((1 << (base)->object->type) & (v3d)->object_type_exclude_viewport) == 0) &&                        \
-       (((base)->flag & BASE_VISIBLE) != 0))
-#define BASE_VISIBLE_BGMODE(v3d, base) (                                                                 \
        ((v3d == NULL) || ((v3d)->localvd == NULL) || ((v3d)->local_view_uuid & (base)->local_view_bits)) && \
        ((v3d == NULL) || (((1 << (base)->object->type) & (v3d)->object_type_exclude_viewport) == 0)) &&     \
        (((base)->flag & BASE_VISIBLE) != 0))
-
 #define BASE_SELECTABLE(v3d, base) (                                                               \
        BASE_VISIBLE(v3d, base) &&                                                                     \
-       (((1 << (base)->object->type) & (v3d)->object_type_exclude_select) == 0) &&                    \
-       (((base)->flag & BASE_SELECTABLE) != 0))
-#define BASE_SELECTABLE_BGMODE(v3d, base) (                                                        \
-       BASE_VISIBLE_BGMODE(v3d, base) &&                                                              \
        ((v3d == NULL) || (((1 << (base)->object->type) & (v3d)->object_type_exclude_select) == 0)) && \
        (((base)->flag & BASE_SELECTABLE) != 0))
-
-#define TESTBASE(v3d, base) \
+#define BASE_SELECTED(v3d, base) \
        (BASE_VISIBLE(v3d, base) && (((base)->flag & BASE_SELECTED) != 0))
-#define TESTBASELIB(v3d, base) \
-       (TESTBASE(v3d, base) && ((base)->object->id.lib == NULL))
-#define BASE_EDITABLE_BGMODE(v3d, base) \
-       (BASE_VISIBLE_BGMODE(v3d, base) && ((base)->object->id.lib == NULL))
-#define TESTBASELIB_BGMODE(v3d, base) \
-       (BASE_EDITABLE_BGMODE(v3d, base) && (((base)->flag & BASE_SELECTED) != 0))
+#define BASE_EDITABLE(v3d, base) \
+       (BASE_VISIBLE(v3d, base) && ((base)->object->id.lib == NULL))
+#define BASE_SELECTED_EDITABLE(v3d, base) \
+       (BASE_EDITABLE(v3d, base) && (((base)->flag & BASE_SELECTED) != 0))
 
+/* deprecate this! */
 #define FIRSTBASE(_view_layer)  ((_view_layer)->object_bases.first)
 #define LASTBASE(_view_layer)   ((_view_layer)->object_bases.last)
 #define BASACT(_view_layer)     ((_view_layer)->basact)
index 495643b1c7ab2fe77e4803a0fd78f73ffa758b16..59c72c3cbe721e7a01aebd0087f3404918c5fee3 100644 (file)
@@ -142,7 +142,7 @@ static bool rna_Object_visible_get(Object *ob, bContext *C, ReportList *reports)
                return false;
        }
 
-       return BASE_VISIBLE_BGMODE(v3d, base);
+       return BASE_VISIBLE(v3d, base);
 }
 
 static bool rna_Object_holdout_get(Object *ob, ReportList *reports, ViewLayer *view_layer)