Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-06-22 12:37:47 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-06-22 12:37:47 +0300
commitcbf5c738d6edaa3e5feecab6a97327cbfd96e06e (patch)
treeea06760f7501bf735d9a6dc6c8242da59f3db671
parent1870a1adc75dece1e9eac3aa632da6e903780c86 (diff)
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.
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c4
-rw-r--r--source/blender/python/generic/bpy_internal_import.c4
-rw-r--r--source/blender/python/generic/bpy_internal_import.h2
-rw-r--r--source/blender/python/intern/bpy.c4
-rw-r--r--source/blender/python/intern/bpy_library_write.c2
-rw-r--r--source/blender/python/intern/bpy_rna.c6
-rw-r--r--source/blender/python/intern/bpy_rna_anim.c5
-rw-r--r--source/blender/python/intern/bpy_rna_id_collection.c3
-rw-r--r--source/blender/python/intern/gpu_offscreen.c5
9 files changed, 21 insertions, 14 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 2c5fd4e7bf7..e8474efa31f 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -38,6 +38,7 @@
#include "BKE_customdata.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
+#include "BKE_library.h"
#include "bmesh.h"
@@ -905,8 +906,9 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
/* python won't ensure matching uv/mtex */
BM_mesh_cd_validate(bm);
+ BLI_assert(BKE_id_is_in_gobal_main(&me->id));
BM_mesh_bm_to_me(
- G.main, /* XXX UGLY! */
+ G_MAIN, /* XXX UGLY! */
bm, me,
(&(struct BMeshToMeshParams){
.calc_object_remap = true,
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index fb89d7c9e30..553f7e43e45 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -185,7 +185,7 @@ PyObject *bpy_text_import_name(const char *name, int *found)
Text *text;
char txtname[MAX_ID_NAME - 2];
int namelen = strlen(name);
-//XXX Main *maggie = bpy_import_main ? bpy_import_main:G.main;
+//XXX Main *maggie = bpy_import_main ? bpy_import_main : G_MAIN;
Main *maggie = bpy_import_main;
*found = 0;
@@ -234,7 +234,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
Text *text;
const char *name;
const char *filepath;
-//XXX Main *maggie = bpy_import_main ? bpy_import_main:G.main;
+//XXX Main *maggie = bpy_import_main ? bpy_import_main : G_MAIN;
Main *maggie = bpy_import_main;
if (!maggie) {
diff --git a/source/blender/python/generic/bpy_internal_import.h b/source/blender/python/generic/bpy_internal_import.h
index a184087e359..29b11fbe8ff 100644
--- a/source/blender/python/generic/bpy_internal_import.h
+++ b/source/blender/python/generic/bpy_internal_import.h
@@ -51,7 +51,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found);
void bpy_text_filename_get(char *fn, size_t fn_len, struct Text *text);
-/* The game engine has its own Main struct, if this is set search this rather than G.main */
+/* The game engine has its own Main struct, if this is set search this rather than G_MAIN */
struct Main *bpy_import_main_get(void);
void bpy_import_main_set(struct Main *maggie);
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 26dc5827da1..82f710e4acf 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -34,7 +34,7 @@
#include "BLI_string.h"
#include "BKE_appdir.h"
-#include "BKE_global.h" /* XXX, G.main only */
+#include "BKE_global.h" /* XXX, G_MAIN only */
#include "BKE_blender_version.h"
#include "BKE_bpath.h"
@@ -136,7 +136,7 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
list = PyList_New(0);
- BKE_bpath_traverse_main(G.main, bpy_blend_paths_visit_cb, flag, (void *)list);
+ BKE_bpath_traverse_main(G_MAIN, bpy_blend_paths_visit_cb, flag, (void *)list);
return list;
}
diff --git a/source/blender/python/intern/bpy_library_write.c b/source/blender/python/intern/bpy_library_write.c
index ead10efb212..76b7ccf72fa 100644
--- a/source/blender/python/intern/bpy_library_write.c
+++ b/source/blender/python/intern/bpy_library_write.c
@@ -95,7 +95,7 @@ static PyObject *bpy_lib_write(PyObject *UNUSED(self), PyObject *args, PyObject
return NULL;
}
- Main *bmain_src = G.main;
+ Main *bmain_src = G_MAIN;
int write_flags = 0;
if (use_relative_remap) {
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 30ab2049b78..8c47ba3c2c5 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -7017,7 +7017,7 @@ PyObject *BPY_rna_module(void)
PointerRNA ptr;
/* for now, return the base RNA type rather than a real module */
- RNA_main_pointer_create(G.main, &ptr);
+ RNA_main_pointer_create(G_MAIN, &ptr);
pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
rna_module_ptr = &pyrna->ptr;
@@ -7028,9 +7028,9 @@ void BPY_update_rna_module(void)
{
if (rna_module_ptr) {
#if 0
- RNA_main_pointer_create(G.main, rna_module_ptr);
+ RNA_main_pointer_create(G_MAIN, rna_module_ptr);
#else
- rna_module_ptr->data = G.main; /* just set data is enough */
+ rna_module_ptr->data = G_MAIN; /* just set data is enough */
#endif
}
}
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)
diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c
index ee40d30d73b..4806c2266ba 100644
--- a/source/blender/python/intern/bpy_rna_id_collection.c
+++ b/source/blender/python/intern/bpy_rna_id_collection.c
@@ -160,7 +160,7 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
BPy_StructRNA *pyrna = (BPy_StructRNA *)self;
Main *bmain = pyrna->ptr.data;
#else
- Main *bmain = G.main; /* XXX Ugly, but should work! */
+ Main *bmain = G_MAIN; /* XXX Ugly, but should work! */
#endif
PyObject *subset = NULL;
@@ -230,7 +230,6 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
lb_index = set_listbasepointers(bmain, lb_array);
while (lb_index--) {
-
if (val_types_bitmap && lb_array[lb_index]->first) {
if (!id_check_type(lb_array[lb_index]->first, val_types_bitmap)) {
continue;
diff --git a/source/blender/python/intern/gpu_offscreen.c b/source/blender/python/intern/gpu_offscreen.c
index 4520495a4b8..3b9b3c70ead 100644
--- a/source/blender/python/intern/gpu_offscreen.c
+++ b/source/blender/python/intern/gpu_offscreen.c
@@ -36,6 +36,7 @@
#include "WM_types.h"
#include "BKE_global.h"
+#include "BKE_library.h"
#include "ED_screen.h"
@@ -169,7 +170,7 @@ static PyObject *pygpu_offscreen_draw_view3d(BPy_GPUOffScreen *self, PyObject *a
MatrixObject *py_mat_modelview, *py_mat_projection;
PyObject *py_scene, *py_region, *py_view3d;
- struct Main *bmain = G.main; /* XXX UGLY! */
+ struct Main *bmain = G_MAIN; /* XXX UGLY! */
Scene *scene;
View3D *v3d;
ARegion *ar;
@@ -191,6 +192,8 @@ static PyObject *pygpu_offscreen_draw_view3d(BPy_GPUOffScreen *self, PyObject *a
return NULL;
}
+ BLI_assert(BKE_id_is_in_gobal_main(&scene->id));
+
fx = GPU_fx_compositor_create();
fx_settings = v3d->fx_settings; /* full copy */