From 15db857628198195936b80115329b8356645ea68 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 27 Feb 2010 01:47:46 +0000 Subject: [PATCH] rename flag for auto script execution since scriptlinks are no more. --- release/scripts/ui/space_userpref.py | 2 +- source/blender/blenkernel/BKE_global.h | 2 +- source/blender/blenkernel/intern/blender.c | 2 +- source/blender/blenkernel/intern/constraint.c | 4 ++-- source/blender/makesdna/DNA_userdef_types.h | 2 +- source/blender/makesrna/intern/rna_userdef.c | 4 ++-- source/blender/python/intern/bpy_driver.c | 6 +++--- source/blender/python/intern/bpy_interface.c | 2 +- source/blender/windowmanager/intern/wm_operators.c | 6 +++--- source/creator/creator.c | 4 ++-- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index 98dbd81fa57..0526f1e99d4 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -422,7 +422,7 @@ class USERPREF_PT_system(bpy.types.Panel): col.prop(system, "dpi") col.prop(system, "frame_server_port") col.prop(system, "scrollback", text="Console Scrollback") - col.prop(system, "auto_run_python_scripts") + col.prop(system, "auto_execute_scripts") col.separator() col.separator() diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 3aad5a8c1e4..6084b0cfb73 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -113,7 +113,7 @@ typedef struct Global { /* #define G_FACESELECT (1 << 8) use (mesh->editflag & ME_EDIT_PAINT_MASK) */ #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_GREASEPENCIL (1 << 17) diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 6239d9f71b3..b96493704b5 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -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; 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; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index c22510a2527..53a07193aa6 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1947,7 +1947,7 @@ static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintT /* only execute target calculation if allowed */ #ifndef DISABLE_PYTHON - if (G.f & G_DOSCRIPTLINKS) + if (G.f & G_SCRIPT_AUTOEXEC) BPY_pyconstraint_target(data, ct); #endif } @@ -1963,7 +1963,7 @@ static void pycon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targ bPythonConstraint *data= con->data; /* 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 */ #if 0 diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 57f2ab27cc1..85c6e73a909 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -403,7 +403,7 @@ extern UserDef U; /* from blenkernel blender.c */ #define USER_ADD_VIEWALIGNED (1 << 19) #define USER_RELPATHS (1 << 20) #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_NONEGFRAMES (1 << 24) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index f96678cda10..a2602bc3cb7 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -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_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); - RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_DONT_DOSCRIPTLINKS); + prop= RNA_def_property(srna, "auto_execute_scripts", PROP_BOOLEAN, PROP_NONE); + 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)"); prop= RNA_def_property(srna, "prefetch_frames", PROP_INT, PROP_NONE); diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index 24b8c0dc522..a4a28ec53d2 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -87,7 +87,7 @@ static int bpy_pydriver_create_dict(void) /* If there's a Blender text called pydrivers.py, import it. * 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() */ if (mod) { PyDict_SetItemString(d, "pydrivers", mod); @@ -159,14 +159,14 @@ float BPY_pydriver_eval (ChannelDriver *driver) int i; /* 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 */ expr = driver->expression; if ((expr == NULL) || (expr[0]=='\0')) return result; - if(!(G.fileflags & G_DOSCRIPTLINKS)) { + if(!(G.fileflags & G_SCRIPT_AUTOEXEC)) { printf("skipping driver '%s', automatic scripts are disabled\n", driver->expression); return result; } diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 4ad06e83e9f..db31bd01a7a 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -631,7 +631,7 @@ 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")) { - 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); } else { diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index eea33423d2b..3d8152ce76a 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1329,7 +1329,7 @@ static void open_set_load_ui(wmOperator *op) static void open_set_use_scripts(wmOperator *op) { 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) @@ -1357,9 +1357,9 @@ static int wm_open_mainfile_exec(bContext *C, wmOperator *op) G.fileflags |= G_FILE_NO_UI; if(RNA_boolean_get(op->ptr, "use_scripts")) - G.fileflags |= G_DOSCRIPTLINKS; + G.fileflags |= G_SCRIPT_AUTOEXEC; else - G.fileflags &= ~G_DOSCRIPTLINKS; + G.fileflags &= ~G_SCRIPT_AUTOEXEC; // 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? diff --git a/source/creator/creator.c b/source/creator/creator.c index bdb6d792c5e..4f3ad5d05d9 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -301,7 +301,7 @@ static int end_arguments(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; } @@ -951,7 +951,7 @@ int main(int argc, char **argv) /* 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 */ setupArguments(C, ba, &syshandle);