Cleanup: remove moar G.main usages.
[blender.git] / source / blender / editors / transform / transform_conversions.c
index a9b12a34593565603bb8662978fd7f3187ddfe04..6ce8d9dc5ac96e7a3bcc3f22a5d614ba9fb7d880 100644 (file)
@@ -5782,6 +5782,7 @@ static void clear_trans_object_base_flags(TransInfo *t)
 // NOTE: context may not always be available, so must check before using it as it's a luxury for a few cases
 void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, int tmode)
 {
+       Main *bmain = CTX_data_main(C);
        ID *id = &ob->id;
        FCurve *fcu;
 
@@ -5813,7 +5814,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob,
                        if (adt && adt->action) {
                                for (fcu = adt->action->curves.first; fcu; fcu = fcu->next) {
                                        fcu->flag &= ~FCURVE_SELECTED;
-                                       insert_keyframe(reports, id, adt->action,
+                                       insert_keyframe(bmain, reports, id, adt->action,
                                                        (fcu->grp ? fcu->grp->name : NULL),
                                                        fcu->rna_path, fcu->array_index, cfra,
                                                        ts->keyframe_type, flag);
@@ -5898,6 +5899,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob,
 // NOTE: context may not always be available, so must check before using it as it's a luxury for a few cases
 void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, int tmode, short targetless_ik)
 {
+       Main *bmain = CTX_data_main(C);
        ID *id = &ob->id;
        AnimData *adt = ob->adt;
        bAction *act = (adt) ? adt->action : NULL;
@@ -5950,7 +5952,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o
                                                                 * NOTE: this will do constraints too, but those are ok to do here too?
                                                                 */
                                                                if (pchanName && STREQ(pchanName, pchan->name)) {
-                                                                       insert_keyframe(reports, id, act,
+                                                                       insert_keyframe(bmain, reports, id, act,
                                                                                        ((fcu->grp) ? (fcu->grp->name) : (NULL)),
                                                                                        fcu->rna_path, fcu->array_index, cfra,
                                                                                        ts->keyframe_type, flag);