[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25130] trunk/blender/source/blender/ windowmanager/intern/wm_operators.c: Save_Mainfile operator only needs window for invoke.

Martin Poirier theeth at yahoo.com
Fri Dec 4 20:07:25 CET 2009


Revision: 25130
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25130
Author:   theeth
Date:     2009-12-04 20:07:25 +0100 (Fri, 04 Dec 2009)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/windowmanager/intern/wm_operators.c

Modified: trunk/blender/source/blender/windowmanager/intern/wm_operators.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_operators.c	2009-12-04 19:06:17 UTC (rev 25129)
+++ trunk/blender/source/blender/windowmanager/intern/wm_operators.c	2009-12-04 19:07:25 UTC (rev 25130)
@@ -1555,6 +1555,10 @@
 {
 	char name[FILE_MAX];
 
+	/* cancel if no active window */
+	if (CTX_wm_window(C) == NULL)
+		return OPERATOR_CANCELLED;
+
 	save_set_compress(op);
 	
 	BLI_strncpy(name, G.sce, FILE_MAX);
@@ -1577,7 +1581,7 @@
 	
 	ot->invoke= wm_save_mainfile_invoke;
 	ot->exec= wm_save_as_mainfile_exec;
-	ot->poll= WM_operator_winactive;
+	ot->poll= NULL;
 	
 	WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER);
 	RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file.");





More information about the Bf-blender-cvs mailing list