diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-15 11:04:11 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-15 11:04:11 +0300 |
commit | b65a56ccb52e656cbdc9033180c26fb56d5c5ffd (patch) | |
tree | 7f21f7388fc39c19f3eff4333f50c5b72f2becba /source/blender/windowmanager/intern/wm_files.c | |
parent | b332a27429f40ef51deeff8de163d2280edb2314 (diff) |
fix [#26494] Auto run Python scripts option in User Preferences problem
- opening a file with blender by passing it as an argument would and loading it once in blender left script auto execute flag in a different state.
- command line args --enable/disable-autoexec were being overridden by the user prefs.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 48528574f7e..ebf3e856241 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -267,8 +267,11 @@ static void wm_init_userdef(bContext *C) else G.fileflags &= ~G_FILE_NO_UI; /* set the python auto-execute setting from user prefs */ - /* disabled by default, unless explicitly enabled in the command line */ - if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |= G_SCRIPT_AUTOEXEC; + /* enabled by default, unless explicitly enabled in the command line which overrides */ + if((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) { + if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |= G_SCRIPT_AUTOEXEC; + else G.f &= ~G_SCRIPT_AUTOEXEC; + } if(U.tempdir[0]) BLI_where_is_temp(btempdir, FILE_MAX, 1); } @@ -300,8 +303,10 @@ void WM_read_file(bContext *C, const char *name, ReportList *reports) /* this flag is initialized by the operator but overwritten on read. * need to re-enable it here else drivers + registered scripts wont work. */ - if(G_f & G_SCRIPT_AUTOEXEC) G.f |= G_SCRIPT_AUTOEXEC; - else G.f &= ~G_SCRIPT_AUTOEXEC; + if(G.f != G_f) { + const int flags_keep= (G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF); + G.f= (G.f & ~flags_keep) | (G_f & flags_keep); + } /* match the read WM with current WM */ wm_window_match_do(C, &wmbase); |