fix for own error with image info display, also dont draw if the mouse is outside the image.
This commit is contained in:
		@@ -132,23 +132,23 @@ void draw_image_info(ARegion *ar, int channels, int x, int y, char *cp, float *f
 | 
				
			|||||||
	char str[256];
 | 
						char str[256];
 | 
				
			||||||
	int ofs= 0;
 | 
						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)
 | 
						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(fp) {
 | 
				
			||||||
		if(channels==4)
 | 
							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)
 | 
							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)
 | 
							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)
 | 
						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)
 | 
						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;
 | 
						(void)ofs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
 | 
						glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1529,9 +1529,9 @@ typedef struct ImageSampleInfo {
 | 
				
			|||||||
static void sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_info)
 | 
					static void sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	ImageSampleInfo *info= arg_info;
 | 
						ImageSampleInfo *info= arg_info;
 | 
				
			||||||
 | 
						if(info->draw) {
 | 
				
			||||||
	draw_image_info(ar, info->channels, info->x, info->y, info->colp,
 | 
							draw_image_info(ar, info->channels, info->x, info->y, info->colp, info->colfp, info->zp, info->zfp);
 | 
				
			||||||
		info->colfp, info->zp, info->zfp);
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
 | 
					static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,6 +24,8 @@
 | 
				
			|||||||
#ifndef BPY_DRIVER_H
 | 
					#ifndef BPY_DRIVER_H
 | 
				
			||||||
#define BPY_DRIVER_H
 | 
					#define BPY_DRIVER_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct ChannelDriver;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int bpy_pydriver_create_dict(void);
 | 
					int bpy_pydriver_create_dict(void);
 | 
				
			||||||
extern PyObject *bpy_pydriver_Dict;
 | 
					extern PyObject *bpy_pydriver_Dict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user