[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32746] trunk/blender/source/blender/ makesrna/intern/rna_image_api.c: bugfix [#24287] Saving the render result through the API does not use the scene settings

Campbell Barton ideasman42 at gmail.com
Thu Oct 28 00:13:05 CEST 2010


Revision: 32746
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32746
Author:   campbellbarton
Date:     2010-10-28 00:13:05 +0200 (Thu, 28 Oct 2010)

Log Message:
-----------
bugfix [#24287] Saving the render result through the API does not use the scene settings
use scene alpha and dither settings.

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_image_api.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_image_api.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_image_api.c	2010-10-27 18:24:58 UTC (rev 32745)
+++ trunk/blender/source/blender/makesrna/intern/rna_image_api.c	2010-10-27 22:13:05 UTC (rev 32746)
@@ -73,9 +73,17 @@
 		if (ibuf == NULL) {
 			BKE_reportf(reports, RPT_ERROR, "Couldn't acquire buffer from image");
 		}
-
-		if (!BKE_write_ibuf(NULL, ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality)) {
-			BKE_reportf(reports, RPT_ERROR, "Couldn't write image: %s", path);
+		else {
+			/* temp swap out the color */
+			const unsigned char imb_depth_back= ibuf->depth;
+			const float dither_back= ibuf->dither; 
+			ibuf->depth= scene->r.planes;
+			ibuf->dither= scene->r.dither_intensity;
+			if (!BKE_write_ibuf(NULL, ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality)) {
+				BKE_reportf(reports, RPT_ERROR, "Couldn't write image: %s", path);
+			}
+			ibuf->depth= imb_depth_back;
+			ibuf->dither= dither_back;
 		}
 
 		BKE_image_release_ibuf(image, lock);





More information about the Bf-blender-cvs mailing list