Assets: allow Mark/Clear Asset operators from 3D Viewport

Make it possible to run `ASSET_OT_mark` and `ASSET_OT_clear` operators from
the 3D Viewport. There is no menu entry, just compatibility with pressing
F3 and executing the operators from the operator search.
This commit is contained in:
Sybren A. Stüvel 2021-10-26 18:15:55 +02:00
parent 2d5c9e0baf
commit 03c0581c6e
Notes: blender-bot 2023-02-13 11:52:49 +01:00
Referenced by commit 289843119d, Python doc generator: add missing `selected_ids` context key
Referenced by commit 4adde62f60, Python doc generator: add missing `selected_ids` context key
1 changed files with 12 additions and 0 deletions

View File

@ -1690,6 +1690,7 @@ static void space_view3d_refresh(const bContext *C, ScrArea *area)
const char *view3d_context_dir[] = {
"active_object",
"selected_ids",
NULL,
};
@ -1728,6 +1729,17 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
return CTX_RESULT_OK;
}
if (CTX_data_equals(member, "selected_ids")) {
ListBase selected_objects;
CTX_data_selected_objects(C, &selected_objects);
LISTBASE_FOREACH (PointerRNA *, object_ptr, &selected_objects) {
ID *selected_id = object_ptr->data;
CTX_data_id_list_add(result, selected_id);
}
BLI_freelistN(&selected_objects);
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return CTX_RESULT_OK;
}
return CTX_RESULT_MEMBER_NOT_FOUND;
}