[Bf-blender-cvs] [4f38624bf5d] master: IDType: Add `BKE_idtype_idcode_is_localizable`.

Bastien Montagne noreply at git.blender.org
Thu Sep 16 14:31:07 CEST 2021


Commit: 4f38624bf5df66ed1cf03a7167c9f959bab21ef9
Author: Bastien Montagne
Date:   Thu Sep 16 11:11:45 2021 +0200
Branches: master
https://developer.blender.org/rB4f38624bf5df66ed1cf03a7167c9f959bab21ef9

IDType: Add `BKE_idtype_idcode_is_localizable`.

This is the same as `BKE_idtype_idcode_is_linkable` currently, used only
in one place in UI code of IDtemplate.

===================================================================

M	source/blender/blenkernel/BKE_idtype.h
M	source/blender/editors/interface/interface_templates.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h
index 66355ac82ac..3b45db19919 100644
--- a/source/blender/blenkernel/BKE_idtype.h
+++ b/source/blender/blenkernel/BKE_idtype.h
@@ -281,9 +281,13 @@ const struct IDTypeInfo *BKE_idtype_get_info_from_id(const struct ID *id);
 const char *BKE_idtype_idcode_to_name(const short idcode);
 const char *BKE_idtype_idcode_to_name_plural(const short idcode);
 const char *BKE_idtype_idcode_to_translation_context(const short idcode);
-bool BKE_idtype_idcode_is_linkable(const short idcode);
+
 bool BKE_idtype_idcode_is_valid(const short idcode);
 
+bool BKE_idtype_idcode_is_linkable(const short idcode);
+/* Macro currently, since any linkable IDtype should be localizable. */
+#define BKE_idtype_idcode_is_localizable BKE_idtype_idcode_is_linkable
+
 short BKE_idtype_idcode_from_name(const char *idtype_name);
 
 uint64_t BKE_idtype_idcode_to_idfilter(const short idcode);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 08d78552710..b9e4f2ef44a 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1031,7 +1031,7 @@ static void template_ID(const bContext *C,
         UI_but_flag_enable(but, UI_BUT_DISABLED);
       }
       else {
-        const bool disabled = (!BKE_lib_id_make_local(CTX_data_main(C), id, true /* test */, 0) ||
+        const bool disabled = (!BKE_idtype_idcode_is_localizable(GS(id->name)) ||
                                (idfrom && idfrom->lib));
         but = uiDefIconBut(block,
                            UI_BTYPE_BUT,



More information about the Bf-blender-cvs mailing list