diff options
Diffstat (limited to 'source/blender/editors/screen/screen_context.c')
-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); |