Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Fri, 8 Dec 2017 13:54:59 +0000 (14:54 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Fri, 8 Dec 2017 13:54:59 +0000 (14:54 +0100)
Conflicts:
source/blender/editors/interface/interface_templates.c

1  2 
source/blender/editors/interface/interface_templates.c

index fae71f1fbc22c381500b79cc81c09271de111f03,1aadeb26103dc471a8c2372e0b5a58cdb031a2d6..dc55f7a1f433c79e6bfea83d9813358aabb4bc2a
@@@ -295,16 -177,61 +295,16 @@@ static void id_search_cb(const bContex
  /* ID Search browse menu, open */
  static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
  {
-       static TemplateID template;
 -      static char search[256];
+       static TemplateID template_ui;
 -      PointerRNA idptr;
 -      wmWindow *win = CTX_wm_window(C);
 -      uiBlock *block;
 -      uiBut *but;
 -      
 -      /* clear initial search string, then all items show */
 -      search[0] = 0;
 +      PointerRNA active_item_ptr;
 +
        /* arg_litem is malloced, can be freed by parent button */
-       template = *((TemplateID *)arg_litem);
-       active_item_ptr = RNA_property_pointer_get(&template.ptr, template.prop);
+       template_ui = *((TemplateID *)arg_litem);
 -      
 -      /* get active id for showing first item */
 -      idptr = RNA_property_pointer_get(&template_ui.ptr, template_ui.prop);
++      active_item_ptr = RNA_property_pointer_get(&template_ui.ptr, template_ui.prop);
  
 -      block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
 -      UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_SEARCH_MENU);
 -      
 -      /* preview thumbnails */
 -      if (template_ui.prv_rows > 0 && template_ui.prv_cols > 0) {
 -              int w = 4 * U.widget_unit * template_ui.prv_cols;
 -              int h = 5 * U.widget_unit * template_ui.prv_rows;
 -              
 -              /* fake button, it holds space for search items */
 -              uiDefBut(block, UI_BTYPE_LABEL, 0, "", 10, 26, w, h, NULL, 0, 0, 0, 0, NULL);
 -              
 -              but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, w, UI_UNIT_Y,
 -                                   template_ui.prv_rows, template_ui.prv_cols, "");
 -              UI_but_func_search_set(
 -                      but, ui_searchbox_create_generic, id_search_cb,
 -                      &template_ui, id_search_call_cb, idptr.data);
 -      }
 -      /* list view */
 -      else {
 -              const int searchbox_width  = UI_searchbox_size_x();
 -              const int searchbox_height = UI_searchbox_size_y();
 -              
 -              /* fake button, it holds space for search items */
 -              uiDefBut(block, UI_BTYPE_LABEL, 0, "", 10, 15, searchbox_width, searchbox_height, NULL, 0, 0, 0, 0, NULL);
 -              but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, searchbox_width, UI_UNIT_Y - 1, 0, 0, "");
 -              UI_but_func_search_set(
 -                      but, ui_searchbox_create_generic, id_search_cb,
 -                      &template_ui, id_search_call_cb, idptr.data);
 -      }
 -              
 -      
 -      UI_block_bounds_set_normal(block, 0.3f * U.widget_unit);
 -      UI_block_direction_set(block, UI_DIR_DOWN);
 -      
 -      /* give search-field focus */
 -      UI_but_focus_on_enter_event(win, but);
 -      /* this type of search menu requires undo */
 -      but->flag |= UI_BUT_UNDO;
 -      
 -      return block;
 +      return template_common_search_menu(
-                      C, ar, id_search_cb, &template, id_search_call_cb, active_item_ptr.data,
-                      template.prv_rows, template.prv_cols);
++                     C, ar, id_search_cb, &template_ui, id_search_call_cb, active_item_ptr.data,
++                     template_ui.prv_rows, template_ui.prv_cols);
  }
  
  /************************ ID Template ***************************/
@@@ -408,8 -335,8 +408,8 @@@ static void template_id_cb(bContext *C
                                else {
                                        if (id) {
                                                Main *bmain = CTX_data_main(C);
-                                               id_single_user(C, id, &template->ptr, template->prop);
+                                               id_single_user(C, id, &template_ui->ptr, template_ui->prop);
 -                                              DAG_relations_tag_update(bmain);
 +                                              DEG_relations_tag_update(bmain);
                                        }
                                }
                        }