Fix T44558 - "Clear Keyframes" complains when operating on an array property and it had deleted the action in the process

This commit is contained in:
Joshua Leung 2015-04-30 22:43:48 +12:00
parent 16794f908f
commit debcd6b217
Notes: blender-bot 2023-02-14 11:24:03 +01:00
Referenced by issue #44558, Minor Bug - Clear Keyframes not smart enough
1 changed files with 12 additions and 1 deletions

View File

@ -1884,8 +1884,19 @@ static int clear_key_button_exec(bContext *C, wmOperator *op)
else
length = 1;
for (a = 0; a < length; a++)
for (a = 0; a < length; a++) {
AnimData *adt = BKE_animdata_from_id(ptr.id.data);
success += clear_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index + a, 0);
/* T44558 - Stop if there's no animdata anymore
* This is needed if only the first item in an array is keyed,
* and we're clearing for the whole array
*/
if (ELEM(NULL, adt, adt->action)) {
break;
}
}
MEM_freeN(path);
}