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>2010-02-27 04:27:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-02-27 04:27:22 +0300
commit4e931482f48feab644b74308be92c385b8ebf3ec (patch)
treeae97ed3a2461d4f3cb6003d31aff0d8d92bac0e5 /source/blender/python
parent5be3bf73be1c80baa4a2327151a42992a8c5a7a3 (diff)
option to set the blend file as from a 'Trusted Source' on load.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/intern/bpy_driver.c6
-rw-r--r--source/blender/python/intern/bpy_interface.c18
2 files changed, 18 insertions, 6 deletions
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c
index 3c204bab9be..24b8c0dc522 100644
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@ -30,6 +30,7 @@
#include "BPY_extern.h"
#include "BKE_fcurve.h"
+#include "BKE_global.h"
#include <Python.h>
@@ -165,6 +166,11 @@ float BPY_pydriver_eval (ChannelDriver *driver)
if ((expr == NULL) || (expr[0]=='\0'))
return result;
+ if(!(G.fileflags & G_DOSCRIPTLINKS)) {
+ printf("skipping driver '%s', automatic scripts are disabled\n", driver->expression);
+ return result;
+ }
+
gilstate = PyGILState_Ensure();
/* init global dictionary for py-driver evaluation settings */
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 0b7c8759b5c..4ad06e83e9f 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -62,6 +62,7 @@
#include "BKE_text.h"
#include "BKE_context.h"
#include "BKE_main.h"
+#include "BKE_global.h" /* only for script checking */
#include "BPY_extern.h"
@@ -630,14 +631,19 @@ void BPY_load_user_modules(bContext *C)
for(text=CTX_data_main(C)->text.first; text; text= text->id.next) {
if(text->flags & TXT_ISSCRIPT && BLI_testextensie(text->id.name+2, ".py")) {
- PyObject *module= bpy_text_import(text);
-
- if (module==NULL) {
- PyErr_Print();
- PyErr_Clear();
+ if(!(G.fileflags & G_DOSCRIPTLINKS)) {
+ printf("scripts disabled for \"%s\", skipping '%s'\n", bmain->name, text->id.name+2);
}
else {
- Py_DECREF(module);
+ PyObject *module= bpy_text_import(text);
+
+ if (module==NULL) {
+ PyErr_Print();
+ PyErr_Clear();
+ }
+ else {
+ Py_DECREF(module);
+ }
}
}
}