option to set the blend file as from a 'Trusted Source' on load.
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user