diff --git a/source/blender/editors/gpencil_legacy/gpencil_bake_animation.cc b/source/blender/editors/gpencil_legacy/gpencil_bake_animation.cc index 525cf876b94..08bc8f2a266 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_bake_animation.cc +++ b/source/blender/editors/gpencil_legacy/gpencil_bake_animation.cc @@ -25,6 +25,8 @@ #include "BKE_material.h" #include "BKE_scene.hh" +#include "ANIM_action_legacy.hh" + #include "BLT_translation.hh" #include "DEG_depsgraph.hh" @@ -103,11 +105,7 @@ static void animdata_keyframe_list_get(ListBase *ob_list, /* Loop all objects to get the list of keyframes used. */ LISTBASE_FOREACH (GpBakeOb *, elem, ob_list) { Object *ob = elem->ob; - AnimData *adt = BKE_animdata_from_id(&ob->id); - if ((adt == nullptr) || (adt->action == nullptr)) { - continue; - } - LISTBASE_FOREACH (FCurve *, fcurve, &adt->action->curves) { + for (FCurve *fcurve : blender::animrig::legacy::fcurves_for_assigned_action(ob->adt)) { int i; BezTriple *bezt; for (i = 0, bezt = fcurve->bezt; i < fcurve->totvert; i++, bezt++) { diff --git a/source/blender/editors/gpencil_legacy/gpencil_mesh.cc b/source/blender/editors/gpencil_legacy/gpencil_mesh.cc index 1315da56774..1de1a5b8c5b 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_mesh.cc +++ b/source/blender/editors/gpencil_legacy/gpencil_mesh.cc @@ -29,6 +29,8 @@ #include "BKE_report.hh" #include "BKE_scene.hh" +#include "ANIM_action_legacy.hh" + #include "DEG_depsgraph.hh" #include "DEG_depsgraph_query.hh" @@ -79,11 +81,7 @@ static void animdata_keyframe_list_get(ListBase *ob_list, /* Loop all objects to get the list of keyframes used. */ LISTBASE_FOREACH (GpBakeOb *, elem, ob_list) { Object *ob = elem->ob; - AnimData *adt = BKE_animdata_from_id(&ob->id); - if ((adt == nullptr) || (adt->action == nullptr)) { - continue; - } - LISTBASE_FOREACH (FCurve *, fcurve, &adt->action->curves) { + for (FCurve *fcurve : blender::animrig::legacy::fcurves_for_assigned_action(ob->adt)) { int i; BezTriple *bezt; for (i = 0, bezt = fcurve->bezt; i < fcurve->totvert; i++, bezt++) {