diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-06-10 13:44:27 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-06-10 13:44:27 +0400 |
commit | 9cf0bbb95c00129501d14f97be3f33cc208771fb (patch) | |
tree | 0ea82db58f4dfb3a999bb499149e9c4a69835e22 /source/blender/windowmanager | |
parent | 1f56eee95304e38b91e05cbb2e595948585b2f31 (diff) |
added a check to console auto-compleation for pythons struct_seq type, so bpy.app and sys.float_info autocompleate their attributes rather then bring treated as a typle.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 8f15a21c624..06d049d2cb5 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1485,6 +1485,14 @@ static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED( { const char *openname= G.main->name; + if(CTX_wm_window(C) == NULL) { + /* in rare cases this could happen, when trying to invoke in background + * mode on load for example. Don't use poll for this because exec() + * can still run without a window */ + BKE_report(op->reports, RPT_ERROR, "Context window not set"); + return OPERATOR_CANCELLED; + } + /* if possible, get the name of the most recently used .blend file */ if (G.recent_files.first) { struct RecentFile *recent = G.recent_files.first; @@ -1535,7 +1543,7 @@ static void WM_OT_open_mainfile(wmOperatorType *ot) ot->invoke= wm_open_mainfile_invoke; ot->exec= wm_open_mainfile_exec; - ot->poll= WM_operator_winactive; + /* ommit window poll so this can work in background mode */ WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH); @@ -1954,7 +1962,7 @@ static void WM_OT_save_mainfile(wmOperatorType *ot) ot->invoke= wm_save_mainfile_invoke; ot->exec= wm_save_as_mainfile_exec; ot->check= blend_save_check; - ot->poll= NULL; + /* ommit window poll so this can work in background mode */ WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH); RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file"); |