fix for own error with image info display, also dont draw if the mouse is outside...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 15 Feb 2011 04:06:13 +0000 (04:06 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 15 Feb 2011 04:06:13 +0000 (04:06 +0000)
source/blender/editors/space_image/image_draw.c
source/blender/editors/space_image/image_ops.c
source/blender/python/intern/bpy_driver.h

index 0dcfa9e3bcc7fef702edd07b203841c9e4baf35e..9593c896c2255d479404343850fa07bbdeef3009 100644 (file)
@@ -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);
index 9fad528b583e14d3b707b21998cdbd4181b2363b..fdf5cea880ba7b5e3e7696e7efcb5b5cc929c417 100644 (file)
@@ -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)
index 2627bf8b174719a578e25bd0d60e78e4a4082d7d..27a077248fa0fe3138b773e8551e1e0c329d45af 100644 (file)
@@ -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;