rename flag for auto script execution since scriptlinks are no more.

This commit is contained in:
Campbell Barton 2010-02-27 01:47:46 +00:00
parent 4e931482f4
commit 15db857628
10 changed files with 17 additions and 17 deletions

@ -422,7 +422,7 @@ class USERPREF_PT_system(bpy.types.Panel):
col.prop(system, "dpi") col.prop(system, "dpi")
col.prop(system, "frame_server_port") col.prop(system, "frame_server_port")
col.prop(system, "scrollback", text="Console Scrollback") col.prop(system, "scrollback", text="Console Scrollback")
col.prop(system, "auto_run_python_scripts") col.prop(system, "auto_execute_scripts")
col.separator() col.separator()
col.separator() col.separator()

@ -113,7 +113,7 @@ typedef struct Global {
/* #define G_FACESELECT (1 << 8) use (mesh->editflag & ME_EDIT_PAINT_MASK) */ /* #define G_FACESELECT (1 << 8) use (mesh->editflag & ME_EDIT_PAINT_MASK) */
#define G_DEBUG (1 << 12) #define G_DEBUG (1 << 12)
#define G_DOSCRIPTLINKS (1 << 13) #define G_SCRIPT_AUTOEXEC (1 << 13)
/* #define G_NOFROZEN (1 << 17) also removed */ /* #define G_NOFROZEN (1 << 17) also removed */
#define G_GREASEPENCIL (1 << 17) #define G_GREASEPENCIL (1 << 17)

@ -291,7 +291,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
if (G.f & G_SWAP_EXCHANGE) bfd->globalf |= G_SWAP_EXCHANGE; if (G.f & G_SWAP_EXCHANGE) bfd->globalf |= G_SWAP_EXCHANGE;
else bfd->globalf &= ~G_SWAP_EXCHANGE; else bfd->globalf &= ~G_SWAP_EXCHANGE;
if ((U.flag & USER_DONT_DOSCRIPTLINKS)) bfd->globalf &= ~G_DOSCRIPTLINKS; if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE)) bfd->globalf &= ~G_SCRIPT_AUTOEXEC;
G.f= bfd->globalf; G.f= bfd->globalf;

@ -1947,7 +1947,7 @@ static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintT
/* only execute target calculation if allowed */ /* only execute target calculation if allowed */
#ifndef DISABLE_PYTHON #ifndef DISABLE_PYTHON
if (G.f & G_DOSCRIPTLINKS) if (G.f & G_SCRIPT_AUTOEXEC)
BPY_pyconstraint_target(data, ct); BPY_pyconstraint_target(data, ct);
#endif #endif
} }
@ -1963,7 +1963,7 @@ static void pycon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targ
bPythonConstraint *data= con->data; bPythonConstraint *data= con->data;
/* only evaluate in python if we're allowed to do so */ /* only evaluate in python if we're allowed to do so */
if ((G.f & G_DOSCRIPTLINKS)==0) return; if ((G.f & G_SCRIPT_AUTOEXEC)==0) return;
/* currently removed, until I this can be re-implemented for multiple targets */ /* currently removed, until I this can be re-implemented for multiple targets */
#if 0 #if 0

@ -403,7 +403,7 @@ extern UserDef U; /* from blenkernel blender.c */
#define USER_ADD_VIEWALIGNED (1 << 19) #define USER_ADD_VIEWALIGNED (1 << 19)
#define USER_RELPATHS (1 << 20) #define USER_RELPATHS (1 << 20)
#define USER_DRAGIMMEDIATE (1 << 21) #define USER_DRAGIMMEDIATE (1 << 21)
#define USER_DONT_DOSCRIPTLINKS (1 << 22) #define USER_SCRIPT_AUTOEXEC_DISABLE (1 << 22)
#define USER_FILENOUI (1 << 23) #define USER_FILENOUI (1 << 23)
#define USER_NONEGFRAMES (1 << 24) #define USER_NONEGFRAMES (1 << 24)

@ -2345,8 +2345,8 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ALLWINCODECS); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ALLWINCODECS);
RNA_def_property_ui_text(prop, "Enable All Codecs", "Enables automatic saving of preview images in the .blend file (Windows only)"); RNA_def_property_ui_text(prop, "Enable All Codecs", "Enables automatic saving of preview images in the .blend file (Windows only)");
prop= RNA_def_property(srna, "auto_run_python_scripts", PROP_BOOLEAN, PROP_NONE); prop= RNA_def_property(srna, "auto_execute_scripts", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_DONT_DOSCRIPTLINKS); RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_SCRIPT_AUTOEXEC_DISABLE);
RNA_def_property_ui_text(prop, "Auto Run Python Scripts", "Allow any .blend file to run scripts automatically (unsafe with blend files from an untrusted source)"); RNA_def_property_ui_text(prop, "Auto Run Python Scripts", "Allow any .blend file to run scripts automatically (unsafe with blend files from an untrusted source)");
prop= RNA_def_property(srna, "prefetch_frames", PROP_INT, PROP_NONE); prop= RNA_def_property(srna, "prefetch_frames", PROP_INT, PROP_NONE);

@ -87,7 +87,7 @@ static int bpy_pydriver_create_dict(void)
/* If there's a Blender text called pydrivers.py, import it. /* If there's a Blender text called pydrivers.py, import it.
* Users can add their own functions to this module. * Users can add their own functions to this module.
*/ */
if (G.f & G_DOSCRIPTLINKS) { if (G.f & G_SCRIPT_AUTOEXEC) {
mod = importText("pydrivers"); /* can also use PyImport_Import() */ mod = importText("pydrivers"); /* can also use PyImport_Import() */
if (mod) { if (mod) {
PyDict_SetItemString(d, "pydrivers", mod); PyDict_SetItemString(d, "pydrivers", mod);
@ -159,14 +159,14 @@ float BPY_pydriver_eval (ChannelDriver *driver)
int i; int i;
/* sanity checks - should driver be executed? */ /* sanity checks - should driver be executed? */
/*if (G.f & G_DOSCRIPTLINKS)==0) return result; */ /*if (G.f & G_SCRIPT_AUTOEXEC)==0) return result; */
/* get the py expression to be evaluated */ /* get the py expression to be evaluated */
expr = driver->expression; expr = driver->expression;
if ((expr == NULL) || (expr[0]=='\0')) if ((expr == NULL) || (expr[0]=='\0'))
return result; return result;
if(!(G.fileflags & G_DOSCRIPTLINKS)) { if(!(G.fileflags & G_SCRIPT_AUTOEXEC)) {
printf("skipping driver '%s', automatic scripts are disabled\n", driver->expression); printf("skipping driver '%s', automatic scripts are disabled\n", driver->expression);
return result; return result;
} }

@ -631,7 +631,7 @@ void BPY_load_user_modules(bContext *C)
for(text=CTX_data_main(C)->text.first; text; text= text->id.next) { 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")) { if(text->flags & TXT_ISSCRIPT && BLI_testextensie(text->id.name+2, ".py")) {
if(!(G.fileflags & G_DOSCRIPTLINKS)) { if(!(G.fileflags & G_SCRIPT_AUTOEXEC)) {
printf("scripts disabled for \"%s\", skipping '%s'\n", bmain->name, text->id.name+2); printf("scripts disabled for \"%s\", skipping '%s'\n", bmain->name, text->id.name+2);
} }
else { else {

@ -1329,7 +1329,7 @@ static void open_set_load_ui(wmOperator *op)
static void open_set_use_scripts(wmOperator *op) static void open_set_use_scripts(wmOperator *op)
{ {
if(!RNA_property_is_set(op->ptr, "use_scripts")) if(!RNA_property_is_set(op->ptr, "use_scripts"))
RNA_boolean_set(op->ptr, "use_scripts", (U.flag & USER_DONT_DOSCRIPTLINKS)); RNA_boolean_set(op->ptr, "use_scripts", (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE));
} }
static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event) static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
@ -1357,9 +1357,9 @@ static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
G.fileflags |= G_FILE_NO_UI; G.fileflags |= G_FILE_NO_UI;
if(RNA_boolean_get(op->ptr, "use_scripts")) if(RNA_boolean_get(op->ptr, "use_scripts"))
G.fileflags |= G_DOSCRIPTLINKS; G.fileflags |= G_SCRIPT_AUTOEXEC;
else else
G.fileflags &= ~G_DOSCRIPTLINKS; G.fileflags &= ~G_SCRIPT_AUTOEXEC;
// XXX wm in context is not set correctly after WM_read_file -> crash // XXX wm in context is not set correctly after WM_read_file -> crash
// do it before for now, but is this correct with multiple windows? // do it before for now, but is this correct with multiple windows?

@ -301,7 +301,7 @@ static int end_arguments(int argc, char **argv, void *data)
static int disable_python(int argc, char **argv, void *data) static int disable_python(int argc, char **argv, void *data)
{ {
G.f &= ~G_DOSCRIPTLINKS; G.f &= ~G_SCRIPT_AUTOEXEC;
return 0; return 0;
} }
@ -951,7 +951,7 @@ int main(int argc, char **argv)
/* first test for background */ /* first test for background */
G.f |= G_DOSCRIPTLINKS; /* script links enabled by default */ G.f |= G_SCRIPT_AUTOEXEC; /* script links enabled by default */
ba = BLI_argsInit(argc, argv); /* skip binary path */ ba = BLI_argsInit(argc, argv); /* skip binary path */
setupArguments(C, ba, &syshandle); setupArguments(C, ba, &syshandle);