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:
Diffstat (limited to 'source/blender/python/generic/bpy_internal_import.c')
-rw-r--r--source/blender/python/generic/bpy_internal_import.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 394c388394a..3ee0c76a44a 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -30,9 +30,10 @@
#include "DNA_text_types.h"
#include "MEM_guardedalloc.h"
+#include "BKE_utildefines.h" /* UNUSED */
#include "BKE_text.h" /* txt_to_buf */
#include "BKE_main.h"
-#include "BKE_global.h" /* grr, only for G.sce */
+#include "BKE_global.h" /* grr, only for G.main->name */
#include "BLI_listbase.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
@@ -61,7 +62,7 @@ void bpy_import_main_set(struct Main *maggie)
/* returns a dummy filename for a textblock so we can tell what file a text block comes from */
void bpy_text_filename_get(char *fn, Text *text)
{
- sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.sce, text->id.name+2);
+ sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.main->name, text->id.name+2);
/* XXX, this is a bug in python's Py_CompileString()!
the string encoding should not be required to be utf-8
@@ -191,24 +192,24 @@ PyObject *bpy_text_reimport( PyObject *module, int *found )
}
-static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * kw)
+static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject * kw)
{
PyObject *exception, *err, *tb;
char *name;
int found= 0;
PyObject *globals = NULL, *locals = NULL, *fromlist = NULL;
- PyObject *newmodule;
+ int level= -1; /* relative imports */
+ PyObject *newmodule;
//PyObject_Print(args, stderr, 0);
- int dummy_val; /* what does this do?*/
static char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", 0};
if( !PyArg_ParseTupleAndKeywords( args, kw, "s|OOOi:bpy_import_meth", kwlist,
- &name, &globals, &locals, &fromlist, &dummy_val) )
+ &name, &globals, &locals, &fromlist, &level) )
return NULL;
/* import existing builtin modules or modules that have been imported already */
- newmodule = PyImport_ImportModuleEx( name, globals, locals, fromlist );
+ newmodule= PyImport_ImportModuleLevel(name, globals, locals, fromlist, level);
if(newmodule)
return newmodule;
@@ -244,7 +245,7 @@ static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * k
* our reload() module, to handle reloading in-memory scripts
*/
-static PyObject *blender_reload( PyObject * self, PyObject * module )
+static PyObject *blender_reload(PyObject *UNUSED(self), PyObject * module)
{
PyObject *exception, *err, *tb;
PyObject *newmodule = NULL;