diff options
-rw-r--r-- | source/blender/blenkernel/BKE_addon.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/addon.c | 7 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 6 |
3 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_addon.h b/source/blender/blenkernel/BKE_addon.h index e631d1d6537..3af6d3b61bf 100644 --- a/source/blender/blenkernel/BKE_addon.h +++ b/source/blender/blenkernel/BKE_addon.h @@ -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__ */ diff --git a/source/blender/blenkernel/intern/addon.c b/source/blender/blenkernel/intern/addon.c index 689e0fb5ee6..a9bb193a7a1 100644 --- a/source/blender/blenkernel/intern/addon.c +++ b/source/blender/blenkernel/intern/addon.c @@ -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)); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 5f4bf39a9bd..63bf29a26ea 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -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) { |