[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52228] trunk/blender/source/blender/ editors/space_node/node_view.c: Z sampling for nodes backdrop

Dalai Felinto dfelinto at gmail.com
Thu Nov 15 14:10:26 CET 2012


Revision: 52228
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52228
Author:   dfelinto
Date:     2012-11-15 13:10:24 +0000 (Thu, 15 Nov 2012)
Log Message:
-----------
Z sampling for nodes backdrop
As it turned out,  the node space was the only place we have the option to sample the backdrop buffer RGB, but not the zed.
This code is copied from image space.

Now one can use the viewer node and sample the depth while looking at the color buffer (so Map Range Node works even better)
Patch written during BlenderPRO 2012, Bras?\195?\173lia ;)
(reviewed by Lukas Toenne)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_node/node_view.c

Modified: trunk/blender/source/blender/editors/space_node/node_view.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_view.c	2012-11-15 06:10:09 UTC (rev 52227)
+++ trunk/blender/source/blender/editors/space_node/node_view.c	2012-11-15 13:10:24 UTC (rev 52228)
@@ -330,7 +330,13 @@
 
 	unsigned char col[4];
 	float colf[4];
+	
+	int z;
+	float zf;
 
+	int *zp;
+	float *zfp;
+
 	int draw;
 	int color_manage;
 } ImageSampleInfo;
@@ -343,8 +349,7 @@
 	if (info->draw) {
 		ED_image_draw_info(scene, ar, info->color_manage, FALSE, info->channels,
 		                   info->x, info->y, info->col, info->colf,
-		                   NULL, NULL /* zbuf - unused for nodes */
-		                   );
+		                   info->zp, info->zfp);
 	}
 }
 
@@ -443,6 +448,9 @@
 		info->draw = 1;
 		info->channels = ibuf->channels;
 
+		info->zp = NULL;
+		info->zfp = NULL;
+
 		if (ibuf->rect) {
 			cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
 
@@ -468,6 +476,15 @@
 
 			info->color_manage = TRUE;
 		}
+		
+		if (ibuf->zbuf) {
+			info->z = ibuf->zbuf[y * ibuf->x + x];
+			info->zp = &info->z;
+		}
+		if (ibuf->zbuf_float) {
+			info->zf = ibuf->zbuf_float[y * ibuf->x + x];
+			info->zfp = &info->zf;
+		}
 
 		ED_node_sample_set(info->colf);
 	}




More information about the Bf-blender-cvs mailing list