Fix broken shapekeys: check for 'NULL' `from` pointer too.
Add check for `NULL` `from` pointer to `BLO_main_validate_shapekeys`, and delete these shapekeys, as they are fully invalid and impossible to recover. Found in a studio production file (`animation test/snow_parkour/shots/0040/0040.lighting.blend`, svn rev `1111`). Would be nice to know how this was generated too...
This commit is contained in:
parent
574f685855
commit
92d3a15239
Notes:
blender-bot
2023-02-13 22:19:17 +01:00
Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
|
@ -199,5 +199,20 @@ bool BLO_main_validate_shapekeys(Main *bmain, ReportList *reports)
|
|||
|
||||
BKE_main_unlock(bmain);
|
||||
|
||||
/* NOTE: #BKE_id_delete also locks `bmain`, so we need to do this loop outside of the lock here.
|
||||
*/
|
||||
LISTBASE_FOREACH_MUTABLE (Key *, shapekey, &bmain->shapekeys) {
|
||||
if (shapekey->from != NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BKE_reportf(reports,
|
||||
RPT_ERROR,
|
||||
"Shapekey %s has an invalid 'from' pointer (%p), it will be deleted",
|
||||
shapekey->id.name,
|
||||
shapekey->from);
|
||||
BKE_id_delete(bmain, shapekey);
|
||||
}
|
||||
|
||||
return is_valid;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue