From be8c8942f4592fc5249ad9400b16b2c1fd8996c3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Feb 2011 04:06:13 +0000 Subject: [PATCH] fix for own error with image info display, also dont draw if the mouse is outside the image. --- source/blender/editors/space_image/image_draw.c | 14 +++++++------- source/blender/editors/space_image/image_ops.c | 6 +++--- source/blender/python/intern/bpy_driver.h | 2 ++ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 0dcfa9e3bcc..9593c896c22 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -132,23 +132,23 @@ void draw_image_info(ARegion *ar, int channels, int x, int y, char *cp, float *f char str[256]; int ofs= 0; - ofs += BLI_snprintf(str, sizeof(str)-ofs, "X: %4d Y: %4d ", x, y); + ofs += BLI_snprintf(str + ofs, sizeof(str)-ofs, "X: %4d Y: %4d ", x, y); if(cp) - ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| R: %3d G: %3d B: %3d A: %3d ", cp[0], cp[1], cp[2], cp[3]); + ofs+= BLI_snprintf(str + ofs, sizeof(str)-ofs, "| R: %3d G: %3d B: %3d A: %3d ", cp[0], cp[1], cp[2], cp[3]); if(fp) { if(channels==4) - ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| R: %.3f G: %.3f B: %.3f A: %.3f ", fp[0], fp[1], fp[2], fp[3]); + ofs+= BLI_snprintf(str + ofs, sizeof(str)-ofs, "| R: %.3f G: %.3f B: %.3f A: %.3f ", fp[0], fp[1], fp[2], fp[3]); else if(channels==1) - ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| Val: %.3f ", fp[0]); + ofs+= BLI_snprintf(str + ofs, sizeof(str)-ofs, "| Val: %.3f ", fp[0]); else if(channels==3) - ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| R: %.3f G: %.3f B: %.3f ", fp[0], fp[1], fp[2]); + ofs+= BLI_snprintf(str + ofs, sizeof(str)-ofs, "| R: %.3f G: %.3f B: %.3f ", fp[0], fp[1], fp[2]); } if(zp) - ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| Z: %.4f ", 0.5+0.5*(((float)*zp)/(float)0x7fffffff)); + ofs+= BLI_snprintf(str + ofs, sizeof(str)-ofs, "| Z: %.4f ", 0.5+0.5*(((float)*zp)/(float)0x7fffffff)); if(zpf) - ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| Z: %.3f ", *zpf); + ofs+= BLI_snprintf(str + ofs, sizeof(str)-ofs, "| Z: %.3f ", *zpf); (void)ofs; glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 9fad528b583..fdf5cea880b 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1529,9 +1529,9 @@ typedef struct ImageSampleInfo { static void sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_info) { ImageSampleInfo *info= arg_info; - - draw_image_info(ar, info->channels, info->x, info->y, info->colp, - info->colfp, info->zp, info->zfp); + if(info->draw) { + draw_image_info(ar, info->channels, info->x, info->y, info->colp, info->colfp, info->zp, info->zfp); + } } static void sample_apply(bContext *C, wmOperator *op, wmEvent *event) diff --git a/source/blender/python/intern/bpy_driver.h b/source/blender/python/intern/bpy_driver.h index 2627bf8b174..27a077248fa 100644 --- a/source/blender/python/intern/bpy_driver.h +++ b/source/blender/python/intern/bpy_driver.h @@ -24,6 +24,8 @@ #ifndef BPY_DRIVER_H #define BPY_DRIVER_H +struct ChannelDriver; + int bpy_pydriver_create_dict(void); extern PyObject *bpy_pydriver_Dict;