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:
-rw-r--r--source/blender/python/BPY_interface.c86
-rw-r--r--source/blender/python/api2_2x/Camera.h2
-rw-r--r--source/blender/python/api2_2x/Draw.c19
-rw-r--r--source/blender/python/api2_2x/Image.h2
-rw-r--r--source/blender/python/api2_2x/Material.h2
-rw-r--r--source/blender/python/api2_2x/Object.h2
6 files changed, 56 insertions, 57 deletions
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c
index fefa80e9c21..6fa69c0e795 100644
--- a/source/blender/python/BPY_interface.c
+++ b/source/blender/python/BPY_interface.c
@@ -176,10 +176,10 @@ void BPY_Err_Handle(Text *text)
PyErr_Print();
tb = PySys_GetObject("last_traceback");
- if (!tb) {
- printf("\nCan't get traceback\n");
- return;
- }
+ if (!tb) {
+ printf("\nCan't get traceback\n");
+ return;
+ }
Py_INCREF(tb);
@@ -193,9 +193,9 @@ void BPY_Err_Handle(Text *text)
v = PyObject_GetAttrString(tb, "tb_next");
if (v == Py_None || strcmp(PyString_AsString(traceback_getFilename(v)),
- GetName(text))) {
+ GetName(text))) {
break;
- }
+ }
Py_DECREF(tb);
tb = v;
@@ -210,7 +210,7 @@ void BPY_Err_Handle(Text *text)
Py_DECREF(tb);
}
- return;
+ return;
}
/*****************************************************************************/
@@ -293,7 +293,7 @@ void BPY_free_compiled_text(struct Text* text)
Py_DECREF((PyObject*) text->compiled);
text->compiled = NULL;
- return;
+ return;
}
/*****************************************************************************/
@@ -317,7 +317,7 @@ void BPY_clear_bad_scriptlinks(struct Text *byebye)
allqueue(REDRAWBUTSSCRIPT, 0);
*/
- return;
+ return;
}
/*****************************************************************************/
@@ -338,7 +338,7 @@ void BPY_do_all_scripts(short event)
BPY_do_pyscript (&(G.scene->id), event);
- return;
+ return;
}
/*****************************************************************************/
@@ -373,7 +373,7 @@ void BPY_do_pyscript(struct ID *id, short event)
}
}
- return;
+ return;
}
/*****************************************************************************/
@@ -389,7 +389,7 @@ void BPY_free_scriptlink(struct ScriptLink *slink)
if(slink->scripts) MEM_freeN(slink->scripts);
}
- return;
+ return;
}
/*****************************************************************************/
@@ -415,7 +415,7 @@ void BPY_copy_scriptlink(struct ScriptLink *scriptlink)
memcpy(scriptlink->flag, tmp, sizeof(short)*scriptlink->totscript);
}
- return;
+ return;
}
/*****************************************************************************/
@@ -448,36 +448,36 @@ PyObject * RunPython(Text *text, PyObject *globaldict)
if (!text->compiled) { /* if it wasn't already compiled, do it now */
-#ifdef BLENDER_SANDBOX_MODE
+/*#ifdef BLENDER_SANDBOX_MODE
-/* IGNORE THIS ALL FOR A WHILE, IT'S VERY INCOMPLETE AND WILL CHANGE
- * CONSIDERABLY IN THE NEXT COMMIT. THE ifdef won't stay, either. */
+// IGNORE THIS ALL FOR A WHILE, IT'S VERY INCOMPLETE AND WILL CHANGE
+// CONSIDERABLY IN THE NEXT COMMIT. THE ifdef won't stay, either.
-/* The import statement is a security risk, so we don't allow it in
- * SANDBOX MODE. Instead, we import all needed modules ourselves and
- * substitute all 'import' and '__import__' statements in the code by
- * '#mport' and '#_import__', resp., making their lines become comments
- * in Python (to let scripts run without import errors). */
+// The import statement is a security risk, so we don't allow it in
+// SANDBOX MODE. Instead, we import all needed modules ourselves and
+// substitute all 'import' and '__import__' statements in the code by
+// '#mport' and '#_import__', resp., making their lines become comments
+// in Python (to let scripts run without import errors).
-/* Disable importing only for the safest sandbox mode */
+// Disable importing only for the safest sandbox mode
- txt_move_bof(text, 0); /* move to the beginning of the script */
+ txt_move_bof(text, 0); // move to the beginning of the script
-/* Search all occurrences of 'import' in the script */
-/* XXX Also check for from ... import ... */
- while (txt_find_string (text, "import")) {
- char *line = text->sell->line;
+// Search all occurrences of 'import' in the script
+// XXX Also check for from ... import ...
+ while (txt_find_string (text, "import")) {
+ char *line = text->sell->line;
- if (text->curc > 1) /* is it '__import__' ? */
- if (strncmp (&line[text->curc - 2],
- "__import__", 10) == 0) text->curc -= 2;
+ if (text->curc > 1) // is it '__import__' ?
+ if (strncmp (&line[text->curc - 2],
+ "__import__", 10) == 0) text->curc -= 2;
- line[text->curc] = '#'; /* change them to '#mport' or '#_import__' */
- }
+ line[text->curc] = '#'; // change them to '#mport' or '#_import__'
+ }
-#endif
+#endif */
- buf = txt_to_buf(text);
+ buf = txt_to_buf(text);
text->compiled = Py_CompileString(buf, GetName(text), Py_file_input);
@@ -485,15 +485,16 @@ PyObject * RunPython(Text *text, PyObject *globaldict)
if (PyErr_Occurred()) {
BPY_free_compiled_text(text);
- return NULL;
+ return NULL;
}
}
-#ifdef BLENDER_SANDBOX_MODE
- //save the script as a dict entry and call the eval code for it
- //then return
- PyDict_SetItemString(globaldict, "_SB_code", text->compiled);
-#endif
+
+/*#ifdef BLENDER_SANDBOX_MODE
+ //save the script as a dict entry and call the eval code for it
+ //then return
+ PyDict_SetItemString(globaldict, "_SB_code", text->compiled);
+#endif */
return PyEval_EvalCode(text->compiled, globaldict, globaldict);
}
@@ -528,7 +529,7 @@ void ReleaseGlobalDictionary (PyObject * dict)
PyDict_Clear (dict);
Py_DECREF (dict); /* Release dictionary. */
- return;
+ return;
}
/*****************************************************************************/
@@ -547,6 +548,5 @@ void DoAllScriptsFromList (ListBase *list, short event)
id = id->next;
}
- return;
+ return;
}
-
diff --git a/source/blender/python/api2_2x/Camera.h b/source/blender/python/api2_2x/Camera.h
index ce943ecc7ed..6f35d651e58 100644
--- a/source/blender/python/api2_2x/Camera.h
+++ b/source/blender/python/api2_2x/Camera.h
@@ -40,7 +40,7 @@
#include "gen_utils.h"
/* The Camera PyType Object defined in Camera.c */
-PyTypeObject Camera_Type;
+extern PyTypeObject Camera_Type;
#define BPy_Camera_Check(v) \
((v)->ob_type == &Camera_Type) /* for type checking */
diff --git a/source/blender/python/api2_2x/Draw.c b/source/blender/python/api2_2x/Draw.c
index c82a00a664b..7bbfa03d8a1 100644
--- a/source/blender/python/api2_2x/Draw.c
+++ b/source/blender/python/api2_2x/Draw.c
@@ -115,16 +115,15 @@ static void exit_pydraw(SpaceText *st)
static void exec_callback(SpaceText *st, PyObject *callback, PyObject *args)
{
PyObject *result = PyObject_CallObject (callback, args);
- printf ("In exec_callback\n");
- if (result==NULL) {
- printf("In exec_callback, result == NULL\n");
- st->text->compiled= NULL;
- PyErr_Print();
- exit_pydraw(st);
+
+ if (result == NULL) {
+ st->text->compiled = NULL;
+ PyErr_Print ();
+ exit_pydraw (st);
}
- printf ("In exec_callback 2\n");
- Py_XDECREF(result);
- Py_DECREF(args);
+
+ Py_XDECREF (result);
+ Py_DECREF (args);
}
/* BPY_spacetext_do_pywin_draw, the static spacetext_do_pywin_buttons and
@@ -165,7 +164,7 @@ static void spacetext_do_pywin_buttons(SpaceText *st, unsigned short event)
void BPY_spacetext_do_pywin_event(SpaceText *st, unsigned short event, short val)
{
- if (event==QKEY && G.qual & (LR_ALTKEY|LR_CTRLKEY|LR_SHIFTKEY)) {
+ if (event == QKEY && G.qual & (LR_ALTKEY|LR_CTRLKEY|LR_SHIFTKEY)) {
exit_pydraw(st);
return;
}
diff --git a/source/blender/python/api2_2x/Image.h b/source/blender/python/api2_2x/Image.h
index 729efa7cff1..08104875f7a 100644
--- a/source/blender/python/api2_2x/Image.h
+++ b/source/blender/python/api2_2x/Image.h
@@ -45,7 +45,7 @@ typedef struct {
} C_Image;
-PyTypeObject Image_Type; /* The Image PyType Object */
+extern PyTypeObject Image_Type; /* The Image PyType Object */
#define C_Image_Check(v) ((v)->ob_type == &Image_Type) /* for type checking */
diff --git a/source/blender/python/api2_2x/Material.h b/source/blender/python/api2_2x/Material.h
index 0387295fc14..437722fac37 100644
--- a/source/blender/python/api2_2x/Material.h
+++ b/source/blender/python/api2_2x/Material.h
@@ -48,7 +48,7 @@ typedef struct {
} C_Material;
-PyTypeObject Material_Type; /* The Material PyType Object */
+extern PyTypeObject Material_Type; /* The Material PyType Object */
#define C_Material_Check(v) \
((v)->ob_type == &Material_Type) /* for type checking */
diff --git a/source/blender/python/api2_2x/Object.h b/source/blender/python/api2_2x/Object.h
index 8623820d60d..711596580e7 100644
--- a/source/blender/python/api2_2x/Object.h
+++ b/source/blender/python/api2_2x/Object.h
@@ -57,7 +57,7 @@
#include "modules.h"
/* The Object PyType Object defined in Object.c */
-PyTypeObject Object_Type;
+extern PyTypeObject Object_Type;
#define C_Object_Check(v) \
((v)->ob_type == &Object_Type) /* for type checking */