Fix #105726: Driver Editing Popover Menu Closing #105746

Merged
Harley Acheson merged 2 commits from Harley/blender:DriversPopup into main 2023-03-14 16:27:35 +01:00
3 changed files with 24 additions and 3 deletions
Showing only changes of commit 1e6eefe57b - Show all commits

View File

@ -2990,6 +2990,17 @@ uiBut *UI_context_active_but_prop_get(const struct bContext *C,
struct PointerRNA *r_ptr,
struct PropertyRNA **r_prop,
int *r_index);
/**
* As above, but for a specified region.
*
* \return active button, NULL if none found or if it doesn't contain valid RNA data.
*/
uiBut *UI_region_active_but_prop_get(const struct ARegion *region,
struct PointerRNA *r_ptr,
struct PropertyRNA **r_prop,
int *r_index);
void UI_context_active_but_prop_handle(struct bContext *C, bool handle_undo);
void UI_context_active_but_clear(struct bContext *C, struct wmWindow *win, struct ARegion *region);

View File

@ -8767,12 +8767,12 @@ uiBlock *UI_region_block_find_mouse_over(const ARegion *region, const int xy[2],
return ui_block_find_mouse_over_ex(region, xy, only_clip);
}
uiBut *UI_context_active_but_prop_get(const bContext *C,
uiBut *UI_region_active_but_prop_get(const ARegion *region,
PointerRNA *r_ptr,
PropertyRNA **r_prop,
int *r_index)
{
uiBut *activebut = UI_context_active_but_get_respect_menu(C);
uiBut *activebut = UI_region_active_but_get(region);
if (activebut && activebut->rnapoin.data) {
*r_ptr = activebut->rnapoin;
@ -8788,6 +8788,16 @@ uiBut *UI_context_active_but_prop_get(const bContext *C,
return activebut;
}
uiBut *UI_context_active_but_prop_get(const bContext *C,
PointerRNA *r_ptr,
PropertyRNA **r_prop,
int *r_index)
{
ARegion *region_menu = CTX_wm_menu(C);
return UI_region_active_but_prop_get(
region_menu ? region_menu : CTX_wm_region(C), r_ptr, r_prop, r_index);
}
void UI_context_active_but_prop_handle(bContext *C, const bool handle_undo)
{
uiBut *activebut = UI_context_active_but_get_respect_menu(C);

View File

@ -1350,7 +1350,7 @@ static void graph_panel_drivers_popover(const bContext *C, Panel *panel)
uiBut *but = NULL;
/* Get active property to show driver properties for */
but = UI_context_active_but_prop_get((bContext *)C, &ptr, &prop, &index);
but = UI_region_active_but_prop_get(CTX_wm_region(C), &ptr, &prop, &index);
if (but) {
FCurve *fcu;
bool driven, special;