Save_Mainfile operator only needs window for invoke. Removed poll function and replace by a check in invoke that cancels if no window is present.

Makes it possible to be called in background mode.
This commit is contained in:
Martin Poirier 2009-12-04 19:07:25 +00:00
parent f21ec89081
commit e9b7482b6a

@ -1555,6 +1555,10 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
{ {
char name[FILE_MAX]; char name[FILE_MAX];
/* cancel if no active window */
if (CTX_wm_window(C) == NULL)
return OPERATOR_CANCELLED;
save_set_compress(op); save_set_compress(op);
BLI_strncpy(name, G.sce, FILE_MAX); BLI_strncpy(name, G.sce, FILE_MAX);
@ -1577,7 +1581,7 @@ static void WM_OT_save_mainfile(wmOperatorType *ot)
ot->invoke= wm_save_mainfile_invoke; ot->invoke= wm_save_mainfile_invoke;
ot->exec= wm_save_as_mainfile_exec; ot->exec= wm_save_as_mainfile_exec;
ot->poll= WM_operator_winactive; ot->poll= NULL;
WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER); WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER);
RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file."); RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file.");