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.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 96b5645f0e7..0baa4008f2d 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -180,8 +180,9 @@ PyObject *bpy_text_import_name(const char *name, int *found)
}
/* we know this cant be importable, the name is too long for blender! */
- if (namelen >= (MAX_ID_NAME - 2) - 3)
+ if (namelen >= (MAX_ID_NAME - 2) - 3) {
return NULL;
+ }
memcpy(txtname, name, namelen);
memcpy(&txtname[namelen], ".py", 4);
@@ -200,10 +201,12 @@ PyObject *bpy_text_import_name(const char *name, int *found)
maggie = maggie->next;
}
- if (!text)
+ if (!text) {
return NULL;
- else
+ }
+ else {
*found = 1;
+ }
return bpy_text_import(text);
}
@@ -229,8 +232,9 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
*found = 0;
/* get name, filename from the module itself */
- if ((name = PyModule_GetName(module)) == NULL)
+ if ((name = PyModule_GetName(module)) == NULL) {
return NULL;
+ }
{
PyObject *module_file = PyModule_GetFilenameObject(module);
@@ -248,10 +252,12 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
text = BLI_findstring(&maggie->texts, BLI_path_basename(filepath), offsetof(ID, name) + 2);
/* uh-oh.... didn't find it */
- if (!text)
+ if (!text) {
return NULL;
- else
+ }
+ else {
*found = 1;
+ }
if (bpy_text_compile(text) == false) {
return NULL;
@@ -283,8 +289,9 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
/* import existing builtin modules or modules that have been imported already */
newmodule = PyImport_ImportModuleLevel(name, globals, locals, fromlist, level);
- if (newmodule)
+ if (newmodule) {
return newmodule;
+ }
PyErr_Fetch(&exception, &err, &tb); /* get the python error in case we cant import as blender text either */
@@ -330,8 +337,9 @@ static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
newmodule = PyObject_CallFunctionObjArgs(imp_reload_orig, module, NULL);
- if (newmodule)
+ if (newmodule) {
return newmodule;
+ }
/* no file, try importing from memory */
PyErr_Fetch(&exception, &err, &tb); /*restore for probable later use */