Cleanup: add utility function to access the screen region by type
This commit is contained in:
@@ -767,6 +767,11 @@ ARegion *BKE_area_find_region_type(const ScrArea *area, int region_type);
|
||||
ARegion *BKE_area_find_region_active_win(const ScrArea *area);
|
||||
ARegion *BKE_area_find_region_xy(const ScrArea *area, int regiontype, const int xy[2])
|
||||
ATTR_NONNULL(3);
|
||||
|
||||
/**
|
||||
* \note This is only for screen level regions (typically menus/popups).
|
||||
*/
|
||||
ARegion *BKE_screen_find_region_type(const bScreen *screen, int region_type) ATTR_NONNULL(1);
|
||||
/**
|
||||
* \note This is only for screen level regions (typically menus/popups).
|
||||
*/
|
||||
|
||||
@@ -882,6 +882,16 @@ ARegion *BKE_area_find_region_xy(const ScrArea *area, const int regiontype, cons
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ARegion *BKE_screen_find_region_type(const bScreen *screen, const int region_type)
|
||||
{
|
||||
LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) {
|
||||
if (region_type == region->regiontype) {
|
||||
return region;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ARegion *BKE_screen_find_region_xy(const bScreen *screen, const int regiontype, const int xy[2])
|
||||
{
|
||||
LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) {
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_screen.hh"
|
||||
|
||||
#include "NOD_texture.h"
|
||||
|
||||
@@ -1461,12 +1462,10 @@ static void paint_update_mouse_cursor(PaintCursorContext &pcontext)
|
||||
|
||||
/* Don't set the cursor when a temporary popup is opened (e.g. a context menu, pie menu or
|
||||
* dialog), see: #137386. */
|
||||
if (!BLI_listbase_is_empty(&pcontext.screen->regionbase)) {
|
||||
LISTBASE_FOREACH (ARegion *, region, &pcontext.screen->regionbase) {
|
||||
if (region->regiontype == RGN_TYPE_TEMPORARY) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!BLI_listbase_is_empty(&pcontext.screen->regionbase) &&
|
||||
(BKE_screen_find_region_type(pcontext.screen, RGN_TYPE_TEMPORARY) != nullptr))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ELEM(pcontext.mode, PaintMode::GPencil, PaintMode::VertexGPencil)) {
|
||||
|
||||
Reference in New Issue
Block a user