Refactor: reduce indentation in ANIM_nla_mapping_get()

Flip conditions and use early returns to simplify `ANIM_nla_mapping_get()`.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/119463
This commit is contained in:
Sybren A. Stüvel 2024-03-14 15:10:01 +01:00
parent 0ac7dd966c
commit af7a68d31f

View file

@ -221,27 +221,30 @@ AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale)
/* apart from strictly keyframe-related contexts, this shouldn't even happen */
/* XXX: nla and channel here may not be necessary... */
if (ELEM(ac->datatype,
ANIMCONT_ACTION,
ANIMCONT_SHAPEKEY,
ANIMCONT_DOPESHEET,
ANIMCONT_FCURVES,
ANIMCONT_NLA,
ANIMCONT_CHANNEL,
ANIMCONT_TIMELINE))
if (!ELEM(ac->datatype,
ANIMCONT_ACTION,
ANIMCONT_SHAPEKEY,
ANIMCONT_DOPESHEET,
ANIMCONT_FCURVES,
ANIMCONT_NLA,
ANIMCONT_CHANNEL,
ANIMCONT_TIMELINE))
{
/* handling depends on the type of animation-context we've got */
if (ale) {
/* NLA Control Curves occur on NLA strips,
* and shouldn't be subjected to this kind of mapping. */
if (ale->type != ANIMTYPE_NLACURVE) {
return ale->adt;
}
}
return nullptr;
}
/* cannot handle... */
return nullptr;
/* handling depends on the type of animation-context we've got */
if (!ale) {
return nullptr;
}
/* NLA Control Curves occur on NLA strips,
* and shouldn't be subjected to this kind of mapping. */
if (ale->type == ANIMTYPE_NLACURVE) {
return nullptr;
}
return ale->adt;
}
/* ------------------- */