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/makesdna/DNA_screen_types.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/blender/makesdna/DNA_screen_types.h') diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 79eca09b80a..7032bc23b2c 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -287,6 +287,11 @@ typedef struct uiListDyn { int *items_filter_flags; /** Org_idx -> new_idx, items_len length. */ int *items_filter_neworder; + + struct wmOperatorType *custom_drag_optype; + struct PointerRNA *custom_drag_opptr; + struct wmOperatorType *custom_activate_optype; + struct PointerRNA *custom_activate_opptr; } uiListDyn; typedef struct uiList { /* some list UI data need to be saved in file */ @@ -313,6 +318,12 @@ typedef struct uiList { /* some list UI data need to be saved in file */ int filter_flag; int filter_sort_flag; + /** Operator executed when activating an item. */ + const char *custom_activate_opname; + /** Operator executed when dragging an item (item gets activated too, without running + * custom_activate_opname above). */ + const char *custom_drag_opname; + /* Custom sub-classes properties. */ IDProperty *properties; -- cgit v1.2.3