Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2022-07-11 20:09:56 +0300
committerBastien Montagne <bastien@blender.org>2022-07-11 20:16:04 +0300
commit2a1d12d7a0edd7ecffda3c5e1bf5c3b512976bbb (patch)
tree2a83a01684e1e4ecd8a06c1c5182356cb4ad9ba5 /source/blender/blenkernel/intern/idtype.c
parent995c904d00e1e0713a1549ca16b2775a9dcdd281 (diff)
Fix (studio-reported) crash in ID remapping code on rare cases.
Some ID types did not have a filter value, even though they would be used in remapping code, leading to missing remappings. In that specific case, shape keys would actually never be properly remapped. Reproducible in r1230 of `Heist/pro/animation_test/einar/einar_new_expression_shapes2.blend`,
Diffstat (limited to 'source/blender/blenkernel/intern/idtype.c')
-rw-r--r--source/blender/blenkernel/intern/idtype.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/idtype.c b/source/blender/blenkernel/intern/idtype.c
index e55143d6852..edb6fe5d69b 100644
--- a/source/blender/blenkernel/intern/idtype.c
+++ b/source/blender/blenkernel/intern/idtype.c
@@ -209,7 +209,11 @@ uint64_t BKE_idtype_idcode_to_idfilter(const short idcode)
case ID_##_id: \
return FILTER_ID_##_id
- switch (idcode) {
+#define CASE_IDFILTER_NONE(_id) \
+ case ID_##_id: \
+ return 0
+
+ switch ((ID_Type)idcode) {
CASE_IDFILTER(AC);
CASE_IDFILTER(AR);
CASE_IDFILTER(BR);
@@ -220,7 +224,10 @@ uint64_t BKE_idtype_idcode_to_idfilter(const short idcode)
CASE_IDFILTER(GR);
CASE_IDFILTER(CV);
CASE_IDFILTER(IM);
+ CASE_IDFILTER_NONE(IP);
+ CASE_IDFILTER(KE);
CASE_IDFILTER(LA);
+ CASE_IDFILTER_NONE(LI);
CASE_IDFILTER(LS);
CASE_IDFILTER(LT);
CASE_IDFILTER(MA);
@@ -236,6 +243,7 @@ uint64_t BKE_idtype_idcode_to_idfilter(const short idcode)
CASE_IDFILTER(PT);
CASE_IDFILTER(LP);
CASE_IDFILTER(SCE);
+ CASE_IDFILTER(SCR);
CASE_IDFILTER(SIM);
CASE_IDFILTER(SPK);
CASE_IDFILTER(SO);
@@ -243,13 +251,16 @@ uint64_t BKE_idtype_idcode_to_idfilter(const short idcode)
CASE_IDFILTER(TXT);
CASE_IDFILTER(VF);
CASE_IDFILTER(VO);
+ CASE_IDFILTER(WM);
CASE_IDFILTER(WO);
CASE_IDFILTER(WS);
- default:
- return 0;
}
+ BLI_assert_unreachable();
+ return 0;
+
#undef CASE_IDFILTER
+#undef CASE_IDFILTER_NONE
}
short BKE_idtype_idcode_from_idfilter(const uint64_t idfilter)
@@ -269,6 +280,7 @@ short BKE_idtype_idcode_from_idfilter(const uint64_t idfilter)
CASE_IDFILTER(GR);
CASE_IDFILTER(CV);
CASE_IDFILTER(IM);
+ CASE_IDFILTER(KE);
CASE_IDFILTER(LA);
CASE_IDFILTER(LS);
CASE_IDFILTER(LT);
@@ -285,6 +297,7 @@ short BKE_idtype_idcode_from_idfilter(const uint64_t idfilter)
CASE_IDFILTER(PT);
CASE_IDFILTER(LP);
CASE_IDFILTER(SCE);
+ CASE_IDFILTER(SCR);
CASE_IDFILTER(SIM);
CASE_IDFILTER(SPK);
CASE_IDFILTER(SO);
@@ -292,11 +305,14 @@ short BKE_idtype_idcode_from_idfilter(const uint64_t idfilter)
CASE_IDFILTER(TXT);
CASE_IDFILTER(VF);
CASE_IDFILTER(VO);
+ CASE_IDFILTER(WM);
CASE_IDFILTER(WO);
- default:
- return 0;
+ CASE_IDFILTER(WS);
}
+ BLI_assert_unreachable();
+ return 0;
+
#undef CASE_IDFILTER
}