diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-01-08 20:19:12 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-01-08 20:50:44 +0300 |
commit | ae2af4692009fe2c3fc97783f6d69aaa7cac5123 (patch) | |
tree | 897af6264bd392b92712a4c2e5077be9384297af /source/blender/editors/screen | |
parent | 54985ab5f569f4623695c693dedda7c000e1e73f (diff) |
Fix inconsistent naming and behavior for base visible/selected/editable.
Fixes T60251.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/screen_context.c | 58 |
1 files changed, 25 insertions, 33 deletions
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); |