Commit: 372754c164793e8e1b0d8a7f1f0dbe9fd432fdf3
Author: Campbell Barton
Date:   Wed Jun 20 15:32:46 2018 +0200
Branches: master
https://developer.blender.org/rB372754c164793e8e1b0d8a7f1f0dbe9fd432fdf3

Screen: split ED_area_actionzone_find_xy

Add ED_area_actionzone_refresh_xy which can tag redraw
find no longer changes changes to the action zone.

===================================================================

M       source/blender/editors/screen/screen_edit.c
M       source/blender/editors/screen/screen_intern.h
M       source/blender/editors/screen/screen_ops.c

===================================================================

diff --git a/source/blender/editors/screen/screen_edit.c 
b/source/blender/editors/screen/screen_edit.c
index 615f47e51c3..3306003f18c 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1106,7 +1106,7 @@ void ED_screen_set_subwinactive(bContext *C, const 
wmEvent *event)
                for (sa = scr->areabase.first; sa; sa = sa->next) {
                        if (event->x > sa->totrct.xmin && event->x < 
sa->totrct.xmax)
                                if (event->y > sa->totrct.ymin && event->y < 
sa->totrct.ymax)
-                                       if (NULL == 
ED_area_actionzone_find_xy(sa, &event->x))
+                                       if (NULL == 
ED_area_actionzone_refresh_xy(sa, &event->x))
                                                break;
                }
                if (sa) {
diff --git a/source/blender/editors/screen/screen_intern.h 
b/source/blender/editors/screen/screen_intern.h
index cd12f30c3bb..63d616e986e 100644
--- a/source/blender/editors/screen/screen_intern.h
+++ b/source/blender/editors/screen/screen_intern.h
@@ -62,6 +62,7 @@ ScrEdge    *screen_find_active_scredge(bScreen *sc,
                                        const int mx, const int my);
 
 struct AZone *ED_area_actionzone_find_xy(ScrArea *sa, const int xy[2]);
+struct AZone *ED_area_actionzone_refresh_xy(ScrArea *sa, const int xy[2]);
 
 /* screen_context.c */
 int ed_screen_context(
diff --git a/source/blender/editors/screen/screen_ops.c 
b/source/blender/editors/screen/screen_ops.c
index d1510f60517..a77307af192 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -665,7 +665,7 @@ static void fullscreen_click_rcti_init(rcti *rect, const 
short x1, const short y
        BLI_rcti_init(rect, x, x + icon_size, y, y + icon_size);
 }
 
-AZone *ED_area_actionzone_find_xy(ScrArea *sa, const int xy[2])
+static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const 
bool test_only)
 {
        AZone *az = NULL;
 
@@ -682,40 +682,49 @@ AZone *ED_area_actionzone_find_xy(ScrArea *sa, const int 
xy[2])
                                break;
                        }
                        else if (az->type == AZONE_FULLSCREEN) {
-                               int mouse_radius, spot_radius, fadein_radius, 
fadeout_radius;
                                rcti click_rect;
-
                                fullscreen_click_rcti_init(&click_rect, az->x1, 
az->y1, az->x2, az->y2);
+                               const bool click_isect = 
BLI_rcti_isect_pt_v(&click_rect, xy);
 
-                               if (BLI_rcti_isect_pt_v(&click_rect, xy)) {
-                                       az->alpha = 1.0f;
+                               if (test_only) {
+                                       if (click_isect) {
+                                               break;
+                                       }
                                }
                                else {
-                                       mouse_radius = (xy[0] - az->x2) * 
(xy[0] - az->x2) + (xy[1] - az->y2) * (xy[1] - az->y2);
-                                       spot_radius = AZONESPOT * AZONESPOT;
-                                       fadein_radius = AZONEFADEIN * 
AZONEFADEIN;
-                                       fadeout_radius = AZONEFADEOUT * 
AZONEFADEOUT;
+                                       int mouse_radius, spot_radius, 
fadein_radius, fadeout_radius;
 
-                                       if (mouse_radius < spot_radius) {
+                                       fullscreen_click_rcti_init(&click_rect, 
az->x1, az->y1, az->x2, az->y2);
+                                       if (click_isect) {
                                                az->alpha = 1.0f;
                                        }
-                                       else if (mouse_radius < fadein_radius) {
-                                               az->alpha = 1.0f;
-                                       }
-                                       else if (mouse_radius < fadeout_radius) 
{
-                                               az->alpha = 1.0f - 
((float)(mouse_radius - fadein_radius)) / ((float)(fadeout_radius - 
fadein_radius));
-                                       }
                                        else {
-                                               az->alpha = 0.0f;
+                                               mouse_radius = (xy[0] - az->x2) 
* (xy[0] - az->x2) + (xy[1] - az->y2) * (xy[1] - az->y2);
+                                               spot_radius = AZONESPOT * 
AZONESPOT;
+                                               fadein_radius = AZONEFADEIN * 
AZONEFADEIN;
+                                               fadeout_radius = AZONEFADEOUT * 
AZONEFADEOUT;
+
+                                               if (mouse_radius < spot_radius) 
{
+                                                       az->alpha = 1.0f;
+                                               }
+                                               else if (mouse_radius < 
fadein_radius) {
+                                                       az->alpha = 1.0f;
+                                               }
+                                               else if (mouse_radius < 
fadeout_radius) {
+                                                       az->alpha = 1.0f - 
((float)(mouse_radius - fadein_radius)) / ((float)(fadeout_radius - 
fadein_radius));
+                                               }
+                                               else {
+                                                       az->alpha = 0.0f;
+                                               }
+
+                                               /* fade in/out but no click */
+                                               az = NULL;
                                        }
 
-                                       /* fade in/out but no click */
-                                       az = NULL;
+                                       /* XXX force redraw to show/hide the 
action zone */
+                                       ED_area_tag_redraw(sa);
+                                       break;
                                }
-
-                               /* XXX force redraw to show/hide the action 
zone */
-                               ED_area_tag_redraw(sa);
-                               break;
                        }
                }
        }
@@ -723,6 +732,15 @@ AZone *ED_area_actionzone_find_xy(ScrArea *sa, const int 
xy[2])
        return az;
 }
 
+AZone *ED_area_actionzone_find_xy(ScrArea *sa, const int xy[2])
+{
+       return area_actionzone_refresh_xy(sa, xy, true);
+}
+
+AZone *ED_area_actionzone_refresh_xy(ScrArea *sa, const int xy[2])
+{
+       return area_actionzone_refresh_xy(sa, xy, false);
+}
 
 static void actionzone_exit(wmOperator *op)
 {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to