Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2012-11-15 17:10:24 +0400
committerDalai Felinto <dfelinto@gmail.com>2012-11-15 17:10:24 +0400
commitabeeea6a96dcb69451a394546f75501a61382b9d (patch)
tree4317195991c112f1728056d2cf3ab655374b52ae /source/blender/editors
parent029d29e4f7da16c4736a3cbcd1081dc50b18694f (diff)
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ília ;) (reviewed by Lukas Toenne)
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_node/node_view.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c
index ccf5c4b540f..a4ea2e3e630 100644
--- a/source/blender/editors/space_node/node_view.c
+++ b/source/blender/editors/space_node/node_view.c
@@ -330,6 +330,12 @@ typedef struct ImageSampleInfo {
unsigned char col[4];
float colf[4];
+
+ int z;
+ float zf;
+
+ int *zp;
+ float *zfp;
int draw;
int color_manage;
@@ -343,8 +349,7 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
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 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
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 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
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);
}