Cleanup: simplify check for the existence of key-blocks

The active key was accessed to check if the key-blocks were empty,
the variable was then shadowed by the iterator.

Check if the key blocks list is empty instead.
This commit is contained in:
Campbell Barton 2024-03-29 10:13:06 +11:00
parent 99f93aa4c8
commit 3cfd4b4aba
1 changed files with 2 additions and 4 deletions

View File

@ -478,9 +478,8 @@ static int shape_key_clear_exec(bContext *C, wmOperator * /*op*/)
{
Object *ob = context_object(C);
Key *key = BKE_key_from_object(ob);
KeyBlock *kb = BKE_keyblock_from_object(ob);
if (!key || !kb) {
if (!key || BLI_listbase_is_empty(&key->block)) {
return OPERATOR_CANCELLED;
}
@ -514,10 +513,9 @@ static int shape_key_retime_exec(bContext *C, wmOperator * /*op*/)
{
Object *ob = context_object(C);
Key *key = BKE_key_from_object(ob);
KeyBlock *kb = BKE_keyblock_from_object(ob);
float cfra = 0.0f;
if (!key || !kb) {
if (!key || BLI_listbase_is_empty(&key->block)) {
return OPERATOR_CANCELLED;
}