[Bf-blender-cvs] [b5635fb] asset-experiments: Merge branch 'master' into asset-experiments
Bastien Montagne
noreply at git.blender.org
Thu Jun 11 16:35:41 CEST 2015
Commit: b5635fb70d38292b4dd9ecb77e034500d67e297c
Author: Bastien Montagne
Date: Thu Jun 11 16:31:30 2015 +0200
Branches: asset-experiments
https://developer.blender.org/rBb5635fb70d38292b4dd9ecb77e034500d67e297c
Merge branch 'master' into asset-experiments
Conflicts:
source/blender/blenkernel/intern/idcode.c
===================================================================
===================================================================
diff --cc source/blender/blenkernel/intern/idcode.c
index 54b2b85,091d8a6..8216513
--- a/source/blender/blenkernel/intern/idcode.c
+++ b/source/blender/blenkernel/intern/idcode.c
@@@ -176,90 -180,19 +180,103 @@@ const char *BKE_idcode_to_name_plural(i
}
/**
+ * Convert an idcode into an idfilter (e.g. ID_OB -> FILTER_ID_OB).
+ */
+int BKE_idcode_to_idfilter(const int idcode)
+{
+#define CASE_IDFILTER(_id) case ID_##_id: return FILTER_ID_##_id
+
+ switch (idcode) {
+ CASE_IDFILTER(AC);
+ CASE_IDFILTER(AR);
+ CASE_IDFILTER(BR);
+ CASE_IDFILTER(CA);
+ CASE_IDFILTER(CU);
+ CASE_IDFILTER(GD);
+ CASE_IDFILTER(GR);
+ CASE_IDFILTER(IM);
+ CASE_IDFILTER(LA);
+ CASE_IDFILTER(LS);
+ CASE_IDFILTER(LT);
+ CASE_IDFILTER(MA);
+ CASE_IDFILTER(MB);
+ CASE_IDFILTER(MC);
+ CASE_IDFILTER(ME);
+ CASE_IDFILTER(MSK);
+ CASE_IDFILTER(NT);
+ CASE_IDFILTER(OB);
+ CASE_IDFILTER(PAL);
+ CASE_IDFILTER(PC);
+ CASE_IDFILTER(SCE);
+ CASE_IDFILTER(SPK);
+ CASE_IDFILTER(SO);
+ CASE_IDFILTER(TE);
+ CASE_IDFILTER(TXT);
+ CASE_IDFILTER(VF);
+ CASE_IDFILTER(WO);
+ default:
+ return 0;
+ }
+
+#undef CASE_IDFILTER
+}
+
+/**
+ * Convert an idfilter into an idcode (e.g. FILTER_ID_OB -> ID_OB).
+ */
+int BKE_idcode_from_idfilter(const int idfilter)
+{
+#define CASE_IDFILTER(_id) case FILTER_ID_##_id: return ID_##_id
+
+ switch (idfilter) {
+ CASE_IDFILTER(AC);
+ CASE_IDFILTER(AR);
+ CASE_IDFILTER(BR);
+ CASE_IDFILTER(CA);
+ CASE_IDFILTER(CU);
+ CASE_IDFILTER(GD);
+ CASE_IDFILTER(GR);
+ CASE_IDFILTER(IM);
+ CASE_IDFILTER(LA);
+ CASE_IDFILTER(LS);
+ CASE_IDFILTER(LT);
+ CASE_IDFILTER(MA);
+ CASE_IDFILTER(MB);
+ CASE_IDFILTER(MC);
+ CASE_IDFILTER(ME);
+ CASE_IDFILTER(MSK);
+ CASE_IDFILTER(NT);
+ CASE_IDFILTER(OB);
+ CASE_IDFILTER(PAL);
+ CASE_IDFILTER(PC);
+ CASE_IDFILTER(SCE);
+ CASE_IDFILTER(SPK);
+ CASE_IDFILTER(SO);
+ CASE_IDFILTER(TE);
+ CASE_IDFILTER(TXT);
+ CASE_IDFILTER(VF);
+ CASE_IDFILTER(WO);
+ default:
+ return 0;
+ }
+
+#undef CASE_IDFILTER
+}
+
+/**
+ * Convert an idcode into its translations' context.
+ *
+ * \param code The code to convert.
+ * \return A static string representing the i18n context of the code.
+ */
+ const char *BKE_idcode_to_translation_context(int code)
+ {
+ IDType *idt = idtype_from_code(code);
+ BLI_assert(idt);
+ return idt ? idt->i18n_context : BLF_I18NCONTEXT_DEFAULT;
+ }
+
+ /**
* Return an ID code and steps the index forward 1.
*
* \param index start as 0.
More information about the Bf-blender-cvs
mailing list