Fix [#21047] Sample color too dark when not using color managment
authorMatt Ebb <matt@mke3.net>
Tue, 9 Mar 2010 02:29:59 +0000 (02:29 +0000)
committerMatt Ebb <matt@mke3.net>
Tue, 9 Mar 2010 02:29:59 +0000 (02:29 +0000)
source/blender/editors/interface/interface_ops.c

index c23e7f8..d66288c 100644 (file)
@@ -94,6 +94,7 @@ static int eyedropper_cancel(bContext *C, wmOperator *op)
 
 static void eyedropper_sample(bContext *C, Eyedropper *eye, short mx, short my)
 {
+       const int color_manage = CTX_data_scene(C)->r.color_mgt_flag & R_COLOR_MANAGEMENT;
        float col[3];
                
        glReadBuffer(GL_FRONT);
@@ -101,11 +102,11 @@ static void eyedropper_sample(bContext *C, Eyedropper *eye, short mx, short my)
        glReadBuffer(GL_BACK);
        
        if(RNA_property_type(eye->prop) == PROP_FLOAT) {
-
+               
                if (RNA_property_array_length(&eye->ptr, eye->prop) < 3) return;
 
                /* convert from screen (srgb) space to linear rgb space */
-               if (RNA_property_subtype(eye->prop) == PROP_COLOR)
+               if (color_manage && RNA_property_subtype(eye->prop) == PROP_COLOR)
                        srgb_to_linearrgb_v3_v3(col, col);
                
                RNA_property_float_set_array(&eye->ptr, eye->prop, col);