Revision: 49235
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49235
Author:   campbellbarton
Date:     2012-07-26 09:06:23 +0000 (Thu, 26 Jul 2012)
Log Message:
-----------
image histogram/sample line couldn't show HDR colors. now allow zooming the 
view to see colors up to 10.0

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/colortools.c
    trunk/blender/source/blender/editors/interface/interface_draw.c
    trunk/blender/source/blender/editors/interface/interface_handlers.c
    trunk/blender/source/blender/editors/space_image/image_ops.c

Modified: trunk/blender/source/blender/blenkernel/intern/colortools.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/colortools.c 2012-07-26 
08:57:41 UTC (rev 49234)
+++ trunk/blender/source/blender/blenkernel/intern/colortools.c 2012-07-26 
09:06:23 UTC (rev 49235)
@@ -961,7 +961,7 @@
        hist->channels = 3;
        hist->x_resolution = 256;
        hist->xmax = 1.0f;
-       hist->ymax = 1.0f;
+       /* hist->ymax = 1.0f; */ /* now do this on the operator _only_ */
 
        if (ibuf->rect == NULL && ibuf->rect_float == NULL) return;
 

Modified: trunk/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_draw.c     
2012-07-26 08:57:41 UTC (rev 49234)
+++ trunk/blender/source/blender/editors/interface/interface_draw.c     
2012-07-26 09:06:23 UTC (rev 49235)
@@ -714,6 +714,8 @@
        }
 }
 
+#define HISTOGRAM_TOT_GRID_LINES 4
+
 void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors 
*UNUSED(wcol), rcti *recti)
 {
        Histogram *hist = (Histogram *)but->poin;
@@ -749,9 +751,16 @@
 
        glColor4f(1.f, 1.f, 1.f, 0.08f);
        /* draw grid lines here */
-       for (i = 1; i < 4; i++) {
-               fdrawline(rect.xmin, rect.ymin + (i / 4.f) * h, rect.xmax, 
rect.ymin + (i / 4.f) * h);
-               fdrawline(rect.xmin + (i / 4.f) * w, rect.ymin, rect.xmin + (i 
/ 4.f) * w, rect.ymax);
+       for (i = 1; i < (HISTOGRAM_TOT_GRID_LINES + 1); i++) {
+               const float fac = (float)i / (float)HISTOGRAM_TOT_GRID_LINES;
+
+               /* so we can tell the 1.0 color point */
+               if (i == HISTOGRAM_TOT_GRID_LINES) {
+                       glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
+               }
+
+               fdrawline(rect.xmin, rect.ymin + fac * h, rect.xmax, rect.ymin 
+ fac * h);
+               fdrawline(rect.xmin + fac * w, rect.ymin, rect.xmin + fac * w, 
rect.ymax);
        }
        
        if (hist->mode == HISTO_MODE_LUMA) {
@@ -773,6 +782,8 @@
        draw_scope_end(&rect, scissor);
 }
 
+#undef HISTOGRAM_TOT_GRID_LINES
+
 void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors 
*UNUSED(wcol), rcti *recti)
 {
        Scopes *scopes = (Scopes *)but->poin;

Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c 
2012-07-26 08:57:41 UTC (rev 49234)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c 
2012-07-26 09:06:23 UTC (rev 49235)
@@ -3872,7 +3872,8 @@
                const float yfac = minf(powf(hist->ymax, 2.0f), 1.0f) * 0.5f;
                hist->ymax += dy * yfac;
        
-               CLAMP(hist->ymax, 1.f, 100.f);
+               /* 0.1 allows us to see HDR colors up to 10 */
+               CLAMP(hist->ymax, 0.1f, 100.f);
        }
        
        data->draglastx = mx;

Modified: trunk/blender/source/blender/editors/space_image/image_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_image/image_ops.c        
2012-07-26 08:57:41 UTC (rev 49234)
+++ trunk/blender/source/blender/editors/space_image/image_ops.c        
2012-07-26 09:06:23 UTC (rev 49235)
@@ -213,6 +213,10 @@
                if (ED_space_image_show_uvedit(sima, obedit) && 
(toolsettings->use_uv_sculpt))
                        return 0;
        }
+       else if (sima->mode != SI_MODE_VIEW) {
+               return 0;
+       }
+
        return space_image_main_area_poll(C);
 }
 /********************** view pan operator *********************/
@@ -2152,6 +2156,9 @@
 
        BKE_histogram_update_sample_line(hist, ibuf, (scene->r.color_mgt_flag & 
R_COLOR_MANAGEMENT) != 0);
        
+       /* reset y zoom */
+       hist->ymax = 1.0f;
+
        ED_space_image_release_buffer(sima, lock);
        
        ED_area_tag_redraw(CTX_wm_area(C));

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to