Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/asset/intern/asset_ops.cc
| Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
| /** | /** | ||||
| * Return the IDs to operate on as PointerRNA vector. Either a single one ("id" context member) or | * Return the IDs to operate on as PointerRNA vector. Either a single one ("id" context member) or | ||||
| * multiple ones ("selected_ids" context member). | * multiple ones ("selected_ids" context member). | ||||
| */ | */ | ||||
| static PointerRNAVec asset_operation_get_ids_from_context(const bContext *C) | static PointerRNAVec asset_operation_get_ids_from_context(const bContext *C) | ||||
| { | { | ||||
| PointerRNAVec ids; | PointerRNAVec ids; | ||||
| ListBase ids_list; | |||||
| /* First check if there is a selected_ids list to use. */ | |||||
| if (CTX_data_selected_ids(C, &ids_list)) { | |||||
| LISTBASE_FOREACH (CollectionPointerLink *, link, &ids_list) { | |||||
| ids.append(link->ptr); | |||||
| } | |||||
| BLI_freelistN(&ids_list); | |||||
| return ids; | |||||
| } | |||||
| PointerRNA idptr = CTX_data_pointer_get_type(C, "id", &RNA_ID); | PointerRNA idptr = CTX_data_pointer_get_type(C, "id", &RNA_ID); | ||||
| if (idptr.data) { | if (idptr.data) { | ||||
| /* Single ID. */ | /* Single ID. */ | ||||
| ids.append(idptr); | ids.append(idptr); | ||||
| } | } | ||||
| else { | |||||
| ListBase list; | |||||
| CTX_data_selected_ids(C, &list); | |||||
| LISTBASE_FOREACH (CollectionPointerLink *, link, &list) { | |||||
| ids.append(link->ptr); | |||||
| } | |||||
| BLI_freelistN(&list); | |||||
| } | |||||
| return ids; | return ids; | ||||
| } | } | ||||
| /** | /** | ||||
| * Information about what's contained in a #PointerRNAVec, returned by | * Information about what's contained in a #PointerRNAVec, returned by | ||||
| * #asset_operation_get_id_vec_stats_from_context(). | * #asset_operation_get_id_vec_stats_from_context(). | ||||
| */ | */ | ||||
| ▲ Show 20 Lines • Show All 878 Lines • Show Last 20 Lines | |||||