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

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

index 7c58ac88a236c0d99d45e87186ec973cb1788869,b5f88158e16b7b8028286b137008a49e2e312fd9..fae71f1fbc22c381500b79cc81c09271de111f03
@@@ -483,12 -408,11 +483,12 @@@ static void template_ID
        PointerRNA idptr;
        // ListBase *lb; // UNUSED
        ID *id, *idfrom;
-       const bool editable = RNA_property_editable(&template->ptr, template->prop);
-       const bool use_previews = template->preview = (flag & UI_ID_PREVIEWS) != 0;
+       const bool editable = RNA_property_editable(&template_ui->ptr, template_ui->prop);
++      const bool use_previews = template_ui->preview = (flag & UI_ID_PREVIEWS) != 0;
  
-       idptr = RNA_property_pointer_get(&template->ptr, template->prop);
+       idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop);
        id = idptr.data;
-       idfrom = template->ptr.id.data;
+       idfrom = template_ui->ptr.id.data;
        // lb = template->idlb;
  
        block = uiLayoutGetBlock(layout);
        if (idptr.type)
                type = idptr.type;
  
 -      if (flag & UI_ID_PREVIEWS) {
 -              template_ui->preview = true;
 -
 -              but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template_ui), "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6,
 -                                   TIP_(template_id_browse_tip(type)));
 -              ui_def_but_icon(but, id ? ui_id_icon_get(C, id, true) : RNA_struct_ui_icon(type),
 -                              UI_HAS_ICON | UI_BUT_ICON_PREVIEW);
 -
 -              if ((idfrom && idfrom->lib) || !editable)
 -                      UI_but_flag_enable(but, UI_BUT_DISABLED);
 -              
 -              uiLayoutRow(layout, true);
 -      }
 -      else if (flag & UI_ID_BROWSE) {
 -              but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template_ui), "", 0, 0, UI_UNIT_X * 1.6, UI_UNIT_Y,
 -                                   TIP_(template_id_browse_tip(type)));
 -              ui_def_but_icon(but, RNA_struct_ui_icon(type), UI_HAS_ICON);
 -              /* default dragging of icon for id browse buttons */
 -              UI_but_drag_set_id(but, id);
 -              UI_but_drawflag_enable(but, UI_BUT_ICON_LEFT);
 -
 -              if ((idfrom && idfrom->lib) || !editable)
 -                      UI_but_flag_enable(but, UI_BUT_DISABLED);
 +      if (flag & UI_ID_BROWSE) {
 +              template_add_button_search_menu(
-                       C, layout, block, &template->ptr, template->prop,
-                       id_search_menu, MEM_dupallocN(template), TIP_(template_id_browse_tip(type)),
++                      C, layout, block, &template_ui->ptr, template_ui->prop,
++                      id_search_menu, MEM_dupallocN(template_ui), TIP_(template_id_browse_tip(type)),
 +                      use_previews, editable);
        }
  
        /* text button with name */
  
                //text_idbutton(id, name);
                name[0] = '\0';
 -              but = uiDefButR(block, UI_BTYPE_TEXT, 0, name, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y,
 -                              &idptr, "name", -1, 0, 0, -1, -1, RNA_struct_ui_description(type));
 +              but = uiDefButR(
 +                      block, UI_BTYPE_TEXT, 0, name, 0, 0, TEMPLATE_SEARCH_TEXTBUT_WIDTH, TEMPLATE_SEARCH_TEXTBUT_HEIGHT,
 +                      &idptr, "name", -1, 0, 0, -1, -1, RNA_struct_ui_description(type));
-               UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_RENAME));
+               UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_RENAME));
                if (user_alert) UI_but_flag_enable(but, UI_BUT_REDALERT);
  
                if (id->lib) {