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:
authorCampbell Barton <ideasman42@gmail.com>2021-03-04 15:13:07 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-03-04 15:13:07 +0300
commit386e3dd842a7ed6a9cc068e3fb02478cc97969e5 (patch)
treeeebf46e54d7c63b7ef6bbca880e88b867df90b58 /source/blender/python/intern/bpy_library_write.c
parentd9e567d36573bf81549ea5c4914a65b3a21dafcc (diff)
PyAPI: use methods for bpy.data.libraries.load & write
Replace static methods with regular methods. Now the 'Main' value is taken from the collection. Needed to support multiple 'Main' instances in Python, see T86183.
Diffstat (limited to 'source/blender/python/intern/bpy_library_write.c')
-rw-r--r--source/blender/python/intern/bpy_library_write.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/python/intern/bpy_library_write.c b/source/blender/python/intern/bpy_library_write.c
index 66d20dd357f..f26f305cca8 100644
--- a/source/blender/python/intern/bpy_library_write.c
+++ b/source/blender/python/intern/bpy_library_write.c
@@ -71,7 +71,7 @@ PyDoc_STRVAR(
" :type fake_user: bool\n"
" :arg compress: When True, write a compressed blend file.\n"
" :type compress: bool\n");
-static PyObject *bpy_lib_write(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
+static PyObject *bpy_lib_write(BPy_PropertyRNA *self, PyObject *args, PyObject *kw)
{
/* args */
const char *filepath;
@@ -114,7 +114,7 @@ static PyObject *bpy_lib_write(PyObject *UNUSED(self), PyObject *args, PyObject
return NULL;
}
- Main *bmain_src = G_MAIN;
+ Main *bmain_src = self->ptr.data; /* Typically #G_MAIN */
int write_flags = 0;
if (use_compress) {
@@ -220,6 +220,6 @@ finally:
PyMethodDef BPY_library_write_method_def = {
"write",
(PyCFunction)bpy_lib_write,
- METH_STATIC | METH_VARARGS | METH_KEYWORDS,
+ METH_VARARGS | METH_KEYWORDS,
bpy_lib_write_doc,
};