Merge branch 'master' into blender2.8

This commit is contained in:
Campbell Barton 2018-06-20 11:09:07 +02:00
commit b661a4d663
3 changed files with 13 additions and 3 deletions

View File

@ -51,7 +51,8 @@ void BKE_addon_pref_type_init(void);
void BKE_addon_pref_type_free(void);
struct bAddon *BKE_addon_new(void);
struct bAddon *BKE_addon_ensure(struct ListBase *addons, const char *module);
struct bAddon *BKE_addon_find(struct ListBase *addon_list, const char *module);
struct bAddon *BKE_addon_ensure(struct ListBase *addon_list, const char *module);
void BKE_addon_free(struct bAddon *addon);
#endif /* __BKE_ADDON_H__ */

View File

@ -53,9 +53,14 @@ bAddon *BKE_addon_new(void)
return addon;
}
bAddon *BKE_addon_find(ListBase *addon_list, const char *module)
{
return BLI_findstring(addon_list, module, offsetof(bAddon, module));
}
bAddon *BKE_addon_ensure(ListBase *addon_list, const char *module)
{
bAddon *addon = BLI_findstring(addon_list, module, offsetof(bAddon, module));
bAddon *addon = BKE_addon_find(addon_list, module);
if (addon == NULL) {
addon = BKE_addon_new();
BLI_strncpy(addon->module, module, sizeof(addon->module));

View File

@ -58,6 +58,7 @@
#include "PIL_time.h"
#include "BKE_addon.h"
#include "BKE_colorband.h"
#include "BKE_blender_undo.h"
#include "BKE_brush.h"
@ -7070,7 +7071,10 @@ static bool ui_but_menu(bContext *C, uiBut *but)
if (ui_block_is_menu(but->block) == false) {
uiItemFullO(layout, "UI_OT_editsource", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, NULL);
}
uiItemFullO(layout, "UI_OT_edittranslation_init", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, NULL);
if (BKE_addon_find(&U.addons, "ui_translate")) {
uiItemFullO(layout, "UI_OT_edittranslation_init", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, NULL);
}
mt = WM_menutype_find("WM_MT_button_context", true);
if (mt) {