UI: only show "Edit Translations" when addon used
This commit is contained in:
parent
0a8af46707
commit
d4519f54b3
@ -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__ */
|
||||
|
@ -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));
|
||||
|
@ -61,6 +61,7 @@
|
||||
|
||||
#include "PIL_time.h"
|
||||
|
||||
#include "BKE_addon.h"
|
||||
#include "BKE_colorband.h"
|
||||
#include "BKE_blender_undo.h"
|
||||
#include "BKE_brush.h"
|
||||
@ -7140,7 +7141,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) {
|
||||
|
Loading…
Reference in New Issue
Block a user