From ae1dc8f5f98d045b11312401d6f93d0eae15ddc5 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 9 Jul 2021 21:46:55 +0200 Subject: UI: Internal support for custom UI list item drag & activate operators For pose libraries, we need to be able to apply a pose whenever activating (clicking) an item in the Pose Library asset view and blend it by dragging (press & move). And since we want to allow Python scripts to define what happens at least when activating an asset (so they can define for example a custom "Apply" operator for preset assets), it makes sense to just let them pass an operator name to the asset view template. The template will be introduced in a following commit. --- source/blender/editors/include/UI_interface.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/blender/editors/include') diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 55d0c5c4342..58eaba480e1 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -588,6 +588,8 @@ bool UI_block_is_empty_ex(const uiBlock *block, const bool skip_title); bool UI_block_is_empty(const uiBlock *block); bool UI_block_can_add_separator(const uiBlock *block); +struct uiList *UI_list_find_mouse_over(const struct ARegion *region, const struct wmEvent *event); + /* interface_region_menu_popup.c */ /** * Popup Menus @@ -2282,6 +2284,13 @@ void uiTemplateFileSelectPath(uiLayout *layout, struct bContext *C, struct FileSelectParams *params); +struct PointerRNA *UI_list_custom_activate_operator_set(struct uiList *ui_list, + const char *opname, + bool create_properties); +struct PointerRNA *UI_list_custom_drag_operator_set(struct uiList *ui_list, + const char *opname, + bool create_properties); + /* items */ void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname); void uiItemEnumO_ptr(uiLayout *layout, -- cgit v1.2.3