Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-01-08 20:19:12 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-01-08 20:50:44 +0300
commitae2af4692009fe2c3fc97783f6d69aaa7cac5123 (patch)
tree897af6264bd392b92712a4c2e5077be9384297af /source/blender/editors
parent54985ab5f569f4623695c693dedda7c000e1e73f (diff)
Fix inconsistent naming and behavior for base visible/selected/editable.
Fixes T60251.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c2
-rw-r--r--source/blender/editors/object/object_edit.c2
-rw-r--r--source/blender/editors/object/object_relations.c2
-rw-r--r--source/blender/editors/screen/screen_context.c58
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c4
-rw-r--r--source/blender/editors/transform/transform_conversions.c14
-rw-r--r--source/blender/editors/transform/transform_gizmo_3d.c2
-rw-r--r--source/blender/editors/transform/transform_orientations.c2
-rw-r--r--source/blender/editors/transform/transform_snap_object.c2
10 files changed, 43 insertions, 51 deletions
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index f7fafb56d3a..607341add86 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -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;
}
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 59ce42c50a5..0da8d6804e5 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -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 */
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 3dec9d945a1..4a306a6c4e3 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -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);
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index d5683ae1267..b4dc2edd7cd 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -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);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 0586f11452a..070e02074ff 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -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;
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 24143c31463..48caace5fd3 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -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);
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 47624293a0b..1dce388a275 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -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;
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c
index ddd0c871015..7a9fceec3a1 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -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) {
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 04999213c63..f08b26455fc 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -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;
}
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index b409e6059b4..94766262711 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -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)))
{