Merge commit 'origin/master (9395646c2c44cdf568ca950700d71fe966f2d80f)' into blender2.8
authorDalai Felinto <dfelinto@gmail.com>
Wed, 10 May 2017 12:21:14 +0000 (14:21 +0200)
committerDalai Felinto <dfelinto@gmail.com>
Wed, 10 May 2017 12:21:14 +0000 (14:21 +0200)
1  2 
source/blender/editors/interface/interface_handlers.c

index 59e0961f0db039c163942fe1b5a4ade8e6f2b050,bb30f82729464fca3ce271376c11c08f474e2fd9..ca0a5ffcbfcb06f36f83afdaf97f7c2449e953a8
@@@ -186,6 -186,7 +186,6 @@@ typedef struct uiSelectContextStore 
        uiSelectContextElem *elems;
        int elems_len;
        bool do_free;
 -      bool is_enabled;
        /* When set, simply copy values (don't apply difference).
         * Rules are:
         * - dragging numbers uses delta.
@@@ -201,9 -202,7 +201,9 @@@ static void ui_selectcontext_apply
          bContext *C, uiBut *but, struct uiSelectContextStore *selctx_data,
          const double value, const double value_orig);
  
 +#if 0
  #define IS_ALLSELECT_EVENT(event) ((event)->alt != 0)
 +#endif
  
  /** just show a tinted color so users know its activated */
  #define UI_BUT_IS_SELECT_CONTEXT UI_BUT_NODE_ACTIVE
@@@ -1180,11 -1179,14 +1180,11 @@@ static void ui_multibut_states_apply(bC
                                ui_but_execute_begin(C, ar, but, &active_back);
  
  #ifdef USE_ALLSELECT
 -                              if (data->select_others.is_enabled) {
 -                                      /* init once! */
 -                                      if (mbut_state->select_others.elems_len == 0) {
 -                                              ui_selectcontext_begin(C, but, &mbut_state->select_others);
 -                                      }
 -                                      if (mbut_state->select_others.elems_len == 0) {
 -                                              mbut_state->select_others.elems_len = -1;
 -                                      }
 +                              if (mbut_state->select_others.elems_len == 0) {
 +                                      ui_selectcontext_begin(C, but, &mbut_state->select_others);
 +                              }
 +                              if (mbut_state->select_others.elems_len == 0) {
 +                                      mbut_state->select_others.elems_len = -1;
                                }
  
                                /* needed so we apply the right deltas */
@@@ -2072,7 -2074,12 +2072,7 @@@ static void ui_apply_but(bContext *C, u
                else
  #  endif
                if (data->select_others.elems_len == 0) {
 -                      wmWindow *win = CTX_wm_window(C);
 -                      /* may have been enabled before activating */
 -                      if (data->select_others.is_enabled || IS_ALLSELECT_EVENT(win->eventstate)) {
 -                              ui_selectcontext_begin(C, but, &data->select_others);
 -                              data->select_others.is_enabled = true;
 -                      }
 +                      ui_selectcontext_begin(C, but, &data->select_others);
                }
                if (data->select_others.elems_len == 0) {
                        /* dont check again */
                        break;
                case UI_BTYPE_ROW:
                case UI_BTYPE_LISTROW:
 +              case UI_BTYPE_TAB:
                        ui_apply_but_ROW(C, block, but, data);
                        break;
                case UI_BTYPE_SCROLL:
@@@ -3074,7 -3080,11 +3074,7 @@@ static void ui_textedit_begin(bContext 
  
  #ifdef USE_ALLSELECT
        if (is_num_but) {
 -              if (IS_ALLSELECT_EVENT(win->eventstate)) {
 -                      data->select_others.is_enabled = true;
 -                      data->select_others.is_copy = true;
 -
 -              }
 +              data->select_others.is_copy = true;
        }
  #endif
  
@@@ -3674,6 -3684,15 +3674,6 @@@ static void ui_block_open_begin(bContex
                        data->menu->popup = but->block->handle->popup;
        }
  
 -#ifdef USE_ALLSELECT
 -      {
 -              wmWindow *win = CTX_wm_window(C);
 -              if (IS_ALLSELECT_EVENT(win->eventstate)) {
 -                      data->select_others.is_enabled = true;
 -              }
 -      }
 -#endif
 -
        /* this makes adjacent blocks auto open from now on */
        //if (but->block->auto_open == 0) but->block->auto_open = 1;
  }
@@@ -3855,18 -3874,6 +3855,18 @@@ static int ui_do_but_KEYEVT
        return WM_UI_HANDLER_CONTINUE;
  }
  
 +static int ui_do_but_TAB(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 +{
 +      if (data->state == BUTTON_STATE_HIGHLIGHT) {
 +              if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_RELEASE) {
 +                      button_activate_state(C, but, BUTTON_STATE_EXIT);
 +                      return WM_UI_HANDLER_CONTINUE;
 +              }
 +      }
 +
 +      return WM_UI_HANDLER_CONTINUE;
 +}
 +
  static bool ui_but_is_mouse_over_icon_extra(const ARegion *region, uiBut *but, const int mouse_xy[2])
  {
        int x = mouse_xy[0], y = mouse_xy[1];
@@@ -5211,8 -5218,7 +5211,8 @@@ static int ui_do_but_COLOR
                                if (!event->ctrl) {
                                        float color[3];
                                        Scene *scene = CTX_data_scene(C);
 -                                      Paint *paint = BKE_paint_get_active(scene);
 +                                      SceneLayer *sl = CTX_data_scene_layer(C);
 +                                      Paint *paint = BKE_paint_get_active(scene, sl);
                                        Brush *brush = BKE_paint_brush(paint);
  
                                        if (brush->flag & BRUSH_USE_GRADIENT) {
@@@ -6120,7 -6126,6 +6120,7 @@@ static int ui_do_but_CURVE
        int mx, my, a;
        bool changed = false;
        Scene *scene = CTX_data_scene(C);
 +      SceneLayer *sl = CTX_data_scene_layer(C);
  
        mx = event->x;
        my = event->y;
                                }
                                else {
                                        curvemapping_changed(cumap, true);  /* remove doubles */
 -                                      BKE_paint_invalidate_cursor_overlay(scene, cumap);
 +                                      BKE_paint_invalidate_cursor_overlay(scene, sl, cumap);
                                }
                        }
  
@@@ -7007,7 -7012,8 +7007,8 @@@ static bool ui_but_menu(bContext *C, ui
                }
  
                /* Set the operator pointer for python access */
-               uiLayoutSetContextPointer(layout,"button_operator", but->opptr);
+               if (but->opptr)
+                       uiLayoutSetContextPointer(layout,"button_operator", but->opptr);
  
                uiItemS(layout);
        }
@@@ -7127,9 -7133,6 +7128,9 @@@ static int ui_do_button(bContext *C, ui
                case UI_BTYPE_HOTKEY_EVENT:
                        retval = ui_do_but_HOTKEYEVT(C, but, data, event);
                        break;
 +              case UI_BTYPE_TAB:
 +                      retval = ui_do_but_TAB(C, but, data, event);
 +                      break;
                case UI_BTYPE_BUT_TOGGLE:
                case UI_BTYPE_TOGGLE:
                case UI_BTYPE_ICON_TOGGLE: