From cbf5c738d6edaa3e5feecab6a97327cbfd96e06e Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 22 Jun 2018 11:37:47 +0200 Subject: Cleanup: get rid of last G.main's in bpy area. Essentially 'validating' them as G_MAIN, and adding some asserts in dubious places, that handled IDs are actually in G_MAIN. --- source/blender/python/intern/bpy_rna_anim.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/blender/python/intern/bpy_rna_anim.c') diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c index 3eec87593dc..73809e96560 100644 --- a/source/blender/python/intern/bpy_rna_anim.c +++ b/source/blender/python/intern/bpy_rna_anim.c @@ -45,6 +45,7 @@ #include "BKE_fcurve.h" #include "BKE_global.h" #include "BKE_idcode.h" +#include "BKE_library.h" #include "BKE_report.h" #include "RNA_access.h" @@ -266,12 +267,14 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb return PyBool_FromLong(result); } else { + ID *id = self->ptr.id.data; ReportList reports; short result; BKE_reports_init(&reports, RPT_STORE); - result = insert_keyframe(G.main, &reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, keytype, options); + BLI_assert(BKE_id_is_in_gobal_main(id)); + result = insert_keyframe(G_MAIN, &reports, id, NULL, group_name, path_full, index, cfra, keytype, options); MEM_freeN((void *)path_full); if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) -- cgit v1.2.3