Commit: e6609deba2b601bbd22d17c246eab2265ccd20a1
Author: Campbell Barton
Date:   Wed Jun 20 15:50:54 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBe6609deba2b601bbd22d17c246eab2265ccd20a1

Merge branch 'master' into blender2.8

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



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

diff --cc source/blender/editors/screen/screen_edit.c
index 8c9182abad0,3306003f18c..53abe3ed4ea
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@@ -991,24 -1093,21 +991,24 @@@ static void screen_cursor_set(wmWindow 
  
  /* called in wm_event_system.c. sets state vars in screen, cursors */
  /* event type is mouse move */
 -void ED_screen_set_subwinactive(bContext *C, const wmEvent *event)
 +void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
  {
 -      wmWindow *win = CTX_wm_window(C);
 +      bScreen *scr = WM_window_get_active_screen(win);
  
 -      if (win->screen) {
 -              bScreen *scr = win->screen;
 -              ScrArea *sa;
 +      if (scr) {
 +              ScrArea *sa = NULL;
                ARegion *ar;
 -              int oldswin = scr->subwinactive;
 +              ARegion *old_ar = scr->active_region;
  
 -              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_refresh_xy(sa, &event->x))
 +              ED_screen_areas_iter(win, scr, area_iter) {
 +                      if (xy[0] > area_iter->totrct.xmin && xy[0] < 
area_iter->totrct.xmax) {
 +                              if (xy[1] > area_iter->totrct.ymin && xy[1] < 
area_iter->totrct.ymax) {
-                                       if 
(ED_area_actionzone_find_xy(area_iter, xy) == NULL) {
++                                      if 
(ED_area_actionzone_refresh_xy(area_iter, xy) == NULL) {
 +                                              sa = area_iter;
                                                break;
 +                                      }
 +                              }
 +                      }
                }
                if (sa) {
                        /* make overlap active when mouse over */
diff --cc source/blender/editors/screen/screen_intern.h
index 89c2b1563c4,63d616e986e..2c343fb9d70
--- a/source/blender/editors/screen/screen_intern.h
+++ b/source/blender/editors/screen/screen_intern.h
@@@ -56,18 -50,19 +56,19 @@@ bScreen    *screen_change_prepare(bScre
  ScrArea    *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int 
merge);
  int         screen_area_join(struct bContext *C, bScreen *scr, ScrArea *sa1, 
ScrArea *sa2);
  int         area_getorientation(ScrArea *sa, ScrArea *sb);
 -void        select_connected_scredge(bScreen *sc, ScrEdge *edge);
 +void        select_connected_scredge(const wmWindow *win, ScrEdge *edge);
  
 -void        removenotused_scrverts(bScreen *sc);
 -void        removedouble_scrverts(bScreen *sc);
 -void        removedouble_scredges(bScreen *sc);
 -void        removenotused_scredges(bScreen *sc);
  bool        scredge_is_horizontal(ScrEdge *se);
 -ScrEdge    *screen_find_active_scredge(bScreen *sc,
 -                                       const int winsize_x, const int 
winsize_y,
 -                                       const int mx, const int my);
 +ScrEdge     *screen_area_map_find_active_scredge(
 +        const struct ScrAreaMap *area_map,
 +        const rcti *bounds_rect,
 +        const int mx, const int my);
 +ScrEdge    *screen_find_active_scredge(
 +        const wmWindow *win, const bScreen *screen,
 +        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 --cc source/blender/editors/screen/screen_ops.c
index df52ce696d9,a77307af192..6ca037bfb5c
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@@ -686,94 -682,50 +686,110 @@@ static AZone *area_actionzone_refresh_x
                                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;
++                                              int mouse_radius, spot_radius, 
fadein_radius, fadeout_radius;
+                                               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_no_rebuild(sa);
-                               break;
                        }
 +                      else if (az->type == AZONE_REGION_SCROLL) {
 +                              ARegion *ar = az->ar;
 +                              View2D *v2d = &ar->v2d;
 +                              const short isect_value = 
UI_view2d_mouse_in_scrollers(ar, v2d, xy[0], xy[1]);
-                               bool redraw = false;
- 
-                               if (isect_value == 'h') {
-                                       if (az->direction == AZ_SCROLL_HOR) {
-                                               az->alpha = 1.0f;
-                                               v2d->alpha_hor = 255;
-                                               v2d->size_hor = 
V2D_SCROLL_HEIGHT;
-                                               redraw = true;
-                                       }
-                               }
-                               else if (isect_value == 'v') {
-                                       if (az->direction == AZ_SCROLL_VERT) {
-                                               az->alpha = 1.0f;
-                                               v2d->alpha_vert = 255;
-                                               v2d->size_vert = 
V2D_SCROLL_WIDTH;
-                                               redraw = true;
++                              if (test_only) {
++                                      if (isect_value != 0) {
++                                              break;
 +                                      }
 +                              }
 +                              else {
-                                       const int local_xy[2] = {xy[0] - 
ar->winrct.xmin, xy[1] - ar->winrct.ymin};
-                                       float dist_fac = 0.0f, alpha = 0.0f;
- 
-                                       if (az->direction == AZ_SCROLL_HOR) {
-                                               dist_fac = 
BLI_rcti_length_y(&v2d->hor, local_xy[1]) / AZONEFADEIN;
-                                               CLAMP(dist_fac, 0.0f, 1.0f);
-                                               alpha = 1.0f - dist_fac;
- 
-                                               v2d->alpha_hor = alpha * 255;
-                                               v2d->size_hor = 
round_fl_to_int(V2D_SCROLL_HEIGHT -
-                                                                               
((V2D_SCROLL_HEIGHT - V2D_SCROLL_HEIGHT_MIN) * dist_fac));
++                                      bool redraw = false;
++
++                                      if (isect_value == 'h') {
++                                              if (az->direction == 
AZ_SCROLL_HOR) {
++                                                      az->alpha = 1.0f;
++                                                      v2d->alpha_hor = 255;
++                                                      v2d->size_hor = 
V2D_SCROLL_HEIGHT;
++                                                      redraw = true;
++                                              }
 +                                      }
-                                       else if (az->direction == 
AZ_SCROLL_VERT) {
-                                               dist_fac = 
BLI_rcti_length_x(&v2d->vert, local_xy[0]) / AZONEFADEIN;
-                                               CLAMP(dist_fac, 0.0f, 1.0f);
-                                               alpha = 1.0f - dist_fac;
- 
-                                               v2d->alpha_vert = alpha * 255;
-                                               v2d->size_vert = 
round_fl_to_int(V2D_SCROLL_WIDTH -
-                                                                               
 ((V2D_SCROLL_WIDTH - V2D_SCROLL_WIDTH_MIN) * dist_fac));
++                                      else if (isect_value == 'v') {
++                                              if (az->direction == 
AZ_SCROLL_VERT) {
++                                                      az->alpha = 1.0f;
++                                                      v2d->alpha_vert = 255;
++                                                      v2d->size_vert = 
V2D_SCROLL_WIDTH;
++                                                      redraw = true;
++                                              }
++                                      }
++                                      else {
++                                              const int local_xy[2] = {xy[0] 
- ar->winrct.xmin, xy[1] - ar->winrct.ymin};
++                                              float dist_fac = 0.0f, alpha = 
0.0f;
++
++                                              if (az->direction == 
AZ_SCROLL_HOR) {
++                                                      dist_fac = 
BLI_rcti_length_y(&v2d->hor, local_xy[1]) / AZONEFADEIN;
++                                                      CLAMP(dist_fac, 0.0f, 
1.0f);
++                                                      alpha = 1.0f - dist_fac;
++
++                                                      v2d->alpha_hor = alpha 
* 255;
++                                                      v2d->size_hor = 
round_fl_to_int(
++                                                              
V2D_SCROLL_HEIGHT -
++                                                              
((V2D_SCROLL_HEIGHT - V2D_SCROLL_HEIGHT_MIN) * dist_fac));
++                                              }
++                                              else if (az->direction == 
AZ_SCROLL_VERT) {
++                                                      dist_fac = 
BLI_rcti_length_x(&v2d->vert, local_xy[0]) / AZONEFADEIN;
++                                                      CLAMP(dist_fac, 0.0f, 
1.0f);
++                                                      alpha = 1.0f - dist_fac;
++
++                                                      v2d->alpha_vert = alpha 
* 255;
++                                                      v2d->size_vert = 
round_fl_to_int(
++                                                              
V2D_SCROLL_WIDTH -
++                                                              
((V2D_SCROLL_WIDTH - V2D_SCROLL_WIDTH_MIN) * dist_fac));
++                                              }
++                                              az->alpha = alpha;
++                                              redraw = true;
 +                                      }
-                                       az->alpha = alpha;
-                                       redraw = true;
-                               }
 +
-                               if (redraw) {
-                                       ED_area_tag_redraw_no_rebuild(sa);
++                                      if (redraw) {
++                                              
ED_area_tag_redraw_no_rebuild(sa);
++                                      }
++                                      /* Don't return! */
 +                              }
-                               /* Don't return! */
 +                      }
                }
        }

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

Reply via email to