option to set the blend file as from a 'Trusted Source' on load.

This commit is contained in:
2010-02-27 01:27:22 +00:00
parent 5be3bf73be
commit 4e931482f4
3 changed files with 32 additions and 6 deletions

View File

@@ -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 */

View File

@@ -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);
}
}
}
}