UI: Attempt to restore region for redo from Adjust Last Operation panel #108892

Merged
Julian Eisel merged 4 commits from JulianEisel/blender:temp-hud-restore-region into main 2023-07-25 12:42:48 +02:00
2 changed files with 18 additions and 16 deletions
Showing only changes of commit affe34732e - Show all commits

View File

@ -489,37 +489,39 @@ struct ARegion *BKE_region_find_in_listbase_by_type(const struct ListBase *regio
* Use #BKE_spacedata_find_region_type if that may be the case. * Use #BKE_spacedata_find_region_type if that may be the case.
*/ */
struct ARegion *BKE_area_find_region_type(const struct ScrArea *area, int type); struct ARegion *BKE_area_find_region_type(const struct ScrArea *area, int type);
struct ARegion *BKE_area_find_region_active_win(struct ScrArea *area); struct ARegion *BKE_area_find_region_active_win(const struct ScrArea *area);
struct ARegion *BKE_area_find_region_xy(struct ScrArea *area, int regiontype, const int xy[2]) struct ARegion *BKE_area_find_region_xy(const struct ScrArea *area,
ATTR_NONNULL(3); int regiontype,
const int xy[2]) ATTR_NONNULL(3);
/** /**
* \note This is only for screen level regions (typically menus/popups). * \note This is only for screen level regions (typically menus/popups).
*/ */
struct ARegion *BKE_screen_find_region_xy(struct bScreen *screen, struct ARegion *BKE_screen_find_region_xy(const struct bScreen *screen,
int regiontype, int regiontype,
const int xy[2]) ATTR_WARN_UNUSED_RESULT const int xy[2]) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL(1, 3); ATTR_NONNULL(1, 3);
struct ARegion *BKE_screen_find_main_region_at_xy(struct bScreen *screen, struct ARegion *BKE_screen_find_main_region_at_xy(const struct bScreen *screen,
int space_type, int space_type,
const int xy[2]) ATTR_NONNULL(1, 3); const int xy[2]) ATTR_NONNULL(1, 3);
/** /**
* \note Ideally we can get the area from the context, * \note Ideally we can get the area from the context,
* there are a few places however where this isn't practical. * there are a few places however where this isn't practical.
*/ */
struct ScrArea *BKE_screen_find_area_from_space(struct bScreen *screen, struct ScrArea *BKE_screen_find_area_from_space(const struct bScreen *screen,
struct SpaceLink *sl) ATTR_WARN_UNUSED_RESULT const struct SpaceLink *sl) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL(1, 2); ATTR_NONNULL(1, 2);
/** /**
* \note Using this function is generally a last resort, you really want to be * \note Using this function is generally a last resort, you really want to be
* using the context when you can - campbell * using the context when you can - campbell
*/ */
struct ScrArea *BKE_screen_find_big_area(struct bScreen *screen, int spacetype, short min); struct ScrArea *BKE_screen_find_big_area(const struct bScreen *screen, int spacetype, short min);
struct ScrArea *BKE_screen_area_map_find_area_xy(const struct ScrAreaMap *areamap, struct ScrArea *BKE_screen_area_map_find_area_xy(const struct ScrAreaMap *areamap,
int spacetype, int spacetype,
const int xy[2]) ATTR_NONNULL(1, 3); const int xy[2]) ATTR_NONNULL(1, 3);
struct ScrArea *BKE_screen_find_area_xy(struct bScreen *screen, int spacetype, const int xy[2]) struct ScrArea *BKE_screen_find_area_xy(const struct bScreen *screen,
ATTR_NONNULL(1, 3); int spacetype,
const int xy[2]) ATTR_NONNULL(1, 3);
void BKE_screen_gizmo_tag_refresh(struct bScreen *screen); void BKE_screen_gizmo_tag_refresh(struct bScreen *screen);

View File

@ -986,7 +986,7 @@ ARegion *BKE_area_find_region_type(const ScrArea *area, int region_type)
return nullptr; return nullptr;
} }
ARegion *BKE_area_find_region_active_win(ScrArea *area) ARegion *BKE_area_find_region_active_win(const ScrArea *area)
{ {
if (area == nullptr) { if (area == nullptr) {
return nullptr; return nullptr;
@ -1002,7 +1002,7 @@ ARegion *BKE_area_find_region_active_win(ScrArea *area)
return BKE_area_find_region_type(area, RGN_TYPE_WINDOW); return BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
} }
ARegion *BKE_area_find_region_xy(ScrArea *area, const int regiontype, const int xy[2]) ARegion *BKE_area_find_region_xy(const ScrArea *area, const int regiontype, const int xy[2])
{ {
if (area == nullptr) { if (area == nullptr) {
return nullptr; return nullptr;
@ -1018,7 +1018,7 @@ ARegion *BKE_area_find_region_xy(ScrArea *area, const int regiontype, const int
return nullptr; return nullptr;
} }
ARegion *BKE_screen_find_region_xy(bScreen *screen, const int regiontype, const int xy[2]) ARegion *BKE_screen_find_region_xy(const bScreen *screen, const int regiontype, const int xy[2])
{ {
LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) { LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) {
if (ELEM(regiontype, RGN_TYPE_ANY, region->regiontype)) { if (ELEM(regiontype, RGN_TYPE_ANY, region->regiontype)) {
@ -1030,7 +1030,7 @@ ARegion *BKE_screen_find_region_xy(bScreen *screen, const int regiontype, const
return nullptr; return nullptr;
} }
ScrArea *BKE_screen_find_area_from_space(bScreen *screen, SpaceLink *sl) ScrArea *BKE_screen_find_area_from_space(const bScreen *screen, const SpaceLink *sl)
{ {
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
if (BLI_findindex(&area->spacedata, sl) != -1) { if (BLI_findindex(&area->spacedata, sl) != -1) {
@ -1041,7 +1041,7 @@ ScrArea *BKE_screen_find_area_from_space(bScreen *screen, SpaceLink *sl)
return nullptr; return nullptr;
} }
ScrArea *BKE_screen_find_big_area(bScreen *screen, const int spacetype, const short min) ScrArea *BKE_screen_find_big_area(const bScreen *screen, const int spacetype, const short min)
{ {
ScrArea *big = nullptr; ScrArea *big = nullptr;
int maxsize = 0; int maxsize = 0;
@ -1078,7 +1078,7 @@ ScrArea *BKE_screen_area_map_find_area_xy(const ScrAreaMap *areamap,
} }
return nullptr; return nullptr;
} }
ScrArea *BKE_screen_find_area_xy(bScreen *screen, const int spacetype, const int xy[2]) ScrArea *BKE_screen_find_area_xy(const bScreen *screen, const int spacetype, const int xy[2])
{ {
return BKE_screen_area_map_find_area_xy(AREAMAP_FROM_SCREEN(screen), spacetype, xy); return BKE_screen_area_map_find_area_xy(AREAMAP_FROM_SCREEN(screen), spacetype, xy);
} }