Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Thu, 21 Jun 2018 14:43:39 +0000 (16:43 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 21 Jun 2018 14:43:39 +0000 (16:43 +0200)
1  2 
intern/cycles/blender/addon/version_update.py
source/blender/editors/interface/interface_handlers.c

index d25488670e4f9cfafeb54bf1035032426e7cf707,fa76113fa6ffc1062ac09d83b70e56b5bff1caa4..9d202c870777f1609827451e7ebccb71fd380ea0
@@@ -6714,15 -6837,33 +6714,35 @@@ static void ui_but_menu_add_path_operat
        RNA_string_set(&props_ptr, "filepath", dir);
  }
  
+ static void ui_but_menu_lazy_init(
+         bContext *C, uiBut *but,
+         uiPopupMenu **pup_p, uiLayout **layout_p)
+ {
+       if (*pup_p != NULL) {
+               return;
+       }
+       uiStringInfo label = {BUT_GET_LABEL, NULL};
+       /* highly unlikely getting the label ever fails */
+       UI_but_string_info_get(C, but, &label, NULL);
+       *pup_p = UI_popup_menu_begin(C, label.strinfo ? label.strinfo : "", ICON_NONE);
+       *layout_p = UI_popup_menu_layout(*pup_p);
+       if (label.strinfo) {
+               MEM_freeN(label.strinfo);
+       }
+       uiLayoutSetOperatorContext(*layout_p, WM_OP_INVOKE_DEFAULT);
+ }
  static bool ui_but_menu(bContext *C, uiBut *but)
  {
-       uiPopupMenu *pup;
-       uiLayout *layout;
+       uiPopupMenu *pup = NULL;
+       uiLayout *layout = NULL;
        MenuType *mt = WM_menutype_find("WM_MT_button_context", true);
        bool is_array, is_array_component;
-       uiStringInfo label = {BUT_GET_LABEL, NULL};
 +      wmOperatorType *ot;
 +      PointerRNA op_ptr;
  
  /*    if ((but->rnapoin.data && but->rnaprop) == 0 && but->optype == NULL)*/
  /*            return 0;*/
                return false;
        }
  
-       /* highly unlikely getting the label ever fails */
-       UI_but_string_info_get(C, but, &label, NULL);
-       pup = UI_popup_menu_begin(C, label.strinfo ? label.strinfo : "", ICON_NONE);
-       layout = UI_popup_menu_layout(pup);
-       if (label.strinfo)
-               MEM_freeN(label.strinfo);
-       uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
        if (but->rnapoin.data && but->rnaprop) {
 -
+               ui_but_menu_lazy_init(C, but, &pup, &layout);
                PointerRNA *ptr = &but->rnapoin;
                PropertyRNA *prop = but->rnaprop;
                const PropertyType type = RNA_property_type(prop);