Revision: 47669
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47669
Author:   nazgul
Date:     2012-06-10 12:19:14 +0000 (Sun, 10 Jun 2012)
Log Message:
-----------
Merging r47667 through r47668 from trunk into soc-2011-tomato

Revision Links:
--------------
    
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47667
    
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47668

Modified Paths:
--------------
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_image.py
    branches/soc-2011-tomato/source/blender/editors/interface/interface_draw.c
    branches/soc-2011-tomato/source/blender/editors/space_image/image_draw.c
    branches/soc-2011-tomato/source/blender/editors/space_image/image_intern.h
    branches/soc-2011-tomato/source/blender/editors/space_image/image_ops.c
    branches/soc-2011-tomato/source/blender/editors/space_image/space_image.c
    branches/soc-2011-tomato/source/blender/makesdna/DNA_color_types.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_color.c

Property Changed:
----------------
    branches/soc-2011-tomato/
    branches/soc-2011-tomato/source/blender/editors/interface/interface.c
    branches/soc-2011-tomato/source/blender/editors/space_outliner/


Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-47666
   + 
/branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-47668

Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_image.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_image.py       
2012-06-10 12:15:39 UTC (rev 47668)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_image.py       
2012-06-10 12:19:14 UTC (rev 47669)
@@ -502,9 +502,12 @@
         layout = self.layout
 
         sima = context.space_data
+        hist = sima.scopes.histogram
 
         layout.template_histogram(sima.scopes, "histogram")
-        layout.prop(sima.scopes.histogram, "mode", icon_only=True)
+        row = layout.row(align=True)
+        row.prop(hist, "mode", icon_only=True, expand=True)
+        row.prop(hist, "show_line", text="")
 
 
 class IMAGE_PT_view_waveform(Panel):
@@ -560,10 +563,13 @@
         layout = self.layout
 
         sima = context.space_data
+        hist = sima.sample_histogram
 
         layout.operator("image.sample_line")
         layout.template_histogram(sima, "sample_histogram")
-        layout.prop(sima.sample_histogram, "mode")
+        row = layout.row(align=True)
+        row.prop(hist, "mode", expand=True)
+        row.prop(hist, "show_line", text="")
 
 
 class IMAGE_PT_scope_sample(Panel):


Property changes on: 
branches/soc-2011-tomato/source/blender/editors/interface/interface.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_candy/source/blender/editors/interface/interface.c:45070-46163
/branches/ge_harmony/source/blender/editors/interface/interface.c:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber/source/blender/editors/interface/interface.c:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers/source/blender/editors/interface/interface.c:38694-39989
/trunk/blender/source/blender/editors/interface/interface.c:36831-47666
   + /branches/ge_candy/source/blender/editors/interface/interface.c:45070-46163
/branches/ge_harmony/source/blender/editors/interface/interface.c:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber/source/blender/editors/interface/interface.c:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers/source/blender/editors/interface/interface.c:38694-39989
/trunk/blender/source/blender/editors/interface/interface.c:36831-47668

Modified: 
branches/soc-2011-tomato/source/blender/editors/interface/interface_draw.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/interface/interface_draw.c  
2012-06-10 12:15:39 UTC (rev 47668)
+++ branches/soc-2011-tomato/source/blender/editors/interface/interface_draw.c  
2012-06-10 12:19:14 UTC (rev 47669)
@@ -659,37 +659,59 @@
 }
 
 static void histogram_draw_one(float r, float g, float b, float alpha,
-                               float x, float y, float w, float h, float 
*data, int res)
+                               float x, float y, float w, float h, float 
*data, int res, const short is_line)
 {
        int i;
        
-       /* under the curve */
-       glBlendFunc(GL_SRC_ALPHA, GL_ONE);
-       glColor4f(r, g, b, alpha);
-       
-       glShadeModel(GL_FLAT);
-       glBegin(GL_QUAD_STRIP);
-       glVertex2f(x, y);
-       glVertex2f(x, y + (data[0] * h));
-       for (i = 1; i < res; i++) {
-               float x2 = x + i * (w / (float)res);
-               glVertex2f(x2, y + (data[i] * h));
-               glVertex2f(x2, y);
+       if (is_line) {
+
+               glLineWidth(1.5);
+               glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+               glColor4f(r, g, b, alpha);
+
+               /* curve outline */
+
+               glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+               glEnable(GL_LINE_SMOOTH);
+               glBegin(GL_LINE_STRIP);
+               for (i = 0; i < res; i++) {
+                       float x2 = x + i * (w / (float)res);
+                       glVertex2f(x2, y + (data[i] * h));
+               }
+               glEnd();
+               glDisable(GL_LINE_SMOOTH);
+
+               glLineWidth(1.0);
        }
-       glEnd();
-       
-       /* curve outline */
-       glColor4f(0.f, 0.f, 0.f, 0.25f);
-       
-       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-       glEnable(GL_LINE_SMOOTH);
-       glBegin(GL_LINE_STRIP);
-       for (i = 0; i < res; i++) {
-               float x2 = x + i * (w / (float)res);
-               glVertex2f(x2, y + (data[i] * h));
+       else {
+               /* under the curve */
+               glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+               glColor4f(r, g, b, alpha);
+
+               glShadeModel(GL_FLAT);
+               glBegin(GL_QUAD_STRIP);
+               glVertex2f(x, y);
+               glVertex2f(x, y + (data[0] * h));
+               for (i = 1; i < res; i++) {
+                       float x2 = x + i * (w / (float)res);
+                       glVertex2f(x2, y + (data[i] * h));
+                       glVertex2f(x2, y);
+               }
+               glEnd();
+
+               /* curve outline */
+               glColor4f(0.f, 0.f, 0.f, 0.25f);
+
+               glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+               glEnable(GL_LINE_SMOOTH);
+               glBegin(GL_LINE_STRIP);
+               for (i = 0; i < res; i++) {
+                       float x2 = x + i * (w / (float)res);
+                       glVertex2f(x2, y + (data[i] * h));
+               }
+               glEnd();
+               glDisable(GL_LINE_SMOOTH);
        }
-       glEnd();
-       glDisable(GL_LINE_SMOOTH);
 }
 
 void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors 
*UNUSED(wcol), rcti *recti)
@@ -699,6 +721,7 @@
        rctf rect;
        int i;
        float w, h;
+       const short is_line = (hist->flag & HISTO_FLAG_LINE) != 0;
        //float alpha;
        GLint scissor[4];
        
@@ -732,14 +755,14 @@
        }
        
        if (hist->mode == HISTO_MODE_LUMA)
-               histogram_draw_one(1.0, 1.0, 1.0, 0.75, rect.xmin, rect.ymin, 
w, h, hist->data_luma, res);
+               histogram_draw_one(1.0, 1.0, 1.0, 0.75, rect.xmin, rect.ymin, 
w, h, hist->data_luma, res, is_line);
        else {
                if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_R)
-                       histogram_draw_one(1.0, 0.0, 0.0, 0.75, rect.xmin, 
rect.ymin, w, h, hist->data_r, res);
+                       histogram_draw_one(1.0, 0.0, 0.0, 0.75, rect.xmin, 
rect.ymin, w, h, hist->data_r, res, is_line);
                if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_G)
-                       histogram_draw_one(0.0, 1.0, 0.0, 0.75, rect.xmin, 
rect.ymin, w, h, hist->data_g, res);
+                       histogram_draw_one(0.0, 1.0, 0.0, 0.75, rect.xmin, 
rect.ymin, w, h, hist->data_g, res, is_line);
                if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_B)
-                       histogram_draw_one(0.0, 0.0, 1.0, 0.75, rect.xmin, 
rect.ymin, w, h, hist->data_b, res);
+                       histogram_draw_one(0.0, 0.0, 1.0, 0.75, rect.xmin, 
rect.ymin, w, h, hist->data_b, res, is_line);
        }
        
        /* outline, scale gripper */

Modified: 
branches/soc-2011-tomato/source/blender/editors/space_image/image_draw.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_image/image_draw.c    
2012-06-10 12:15:39 UTC (rev 47668)
+++ branches/soc-2011-tomato/source/blender/editors/space_image/image_draw.c    
2012-06-10 12:19:14 UTC (rev 47669)
@@ -578,6 +578,28 @@
        }
 }
 
+void draw_image_sample_line(SpaceImage *sima)
+{
+       if (sima->sample_line_hist.flag & HISTO_FLAG_SAMPLELINE) {
+               Histogram *hist = &sima->sample_line_hist;
+
+               glBegin(GL_LINES);
+               glColor3ub(0, 0, 0);
+               glVertex2fv(hist->co[0]);
+               glVertex2fv(hist->co[1]);
+               glEnd();
+
+               setlinestyle(1);
+               glBegin(GL_LINES);
+               glColor3ub(255, 255, 255);
+               glVertex2fv(hist->co[0]);
+               glVertex2fv(hist->co[1]);
+               glEnd();
+               setlinestyle(0);
+
+       }
+}
+
 /* XXX becomes WM paint cursor */
 #if 0
 static void draw_image_view_tool(Scene *scene)

Modified: 
branches/soc-2011-tomato/source/blender/editors/space_image/image_intern.h
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_image/image_intern.h  
2012-06-10 12:15:39 UTC (rev 47668)
+++ branches/soc-2011-tomato/source/blender/editors/space_image/image_intern.h  
2012-06-10 12:19:14 UTC (rev 47669)
@@ -54,6 +54,7 @@
 /* image_draw.c */
 void draw_image_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene 
*scene);
 void draw_image_grease_pencil(struct bContext *C, short onlyv2d);
+void draw_image_sample_line(struct SpaceImage *sima);
 
 /* image_ops.c */
 int space_image_main_area_poll(struct bContext *C);

Modified: 
branches/soc-2011-tomato/source/blender/editors/space_image/image_ops.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_image/image_ops.c     
2012-06-10 12:15:39 UTC (rev 47668)
+++ branches/soc-2011-tomato/source/blender/editors/space_image/image_ops.c     
2012-06-10 12:19:14 UTC (rev 47669)
@@ -2137,7 +2137,14 @@
        hist->x_resolution = 256;
        hist->xmax = 1.0f;
        hist->ymax = 1.0f;
-       
+
+       /* persistent draw */
+       hist->co[0][0] = x1f;
+       hist->co[0][1] = y1f;
+       hist->co[1][0] = x2f;
+       hist->co[1][1] = y2f;
+       hist->flag |= HISTO_FLAG_SAMPLELINE; /* keep drawing the flag after */
+
        for (i = 0; i < 256; i++) {
                x = (int)(0.5f + x1 + (float)i * (x2 - x1) / 255.0f);
                y = (int)(0.5f + y1 + (float)i * (y2 - y1) / 255.0f);
@@ -2179,7 +2186,10 @@
 static int image_sample_line_invoke(bContext *C, wmOperator *op, wmEvent 
*event)
 {
        SpaceImage *sima = CTX_wm_space_image(C);
-       
+
+       Histogram *hist = &sima->sample_line_hist;
+       hist->flag &= ~HISTO_FLAG_SAMPLELINE;
+
        if (!ED_space_image_has_buffer(sima))
                return OPERATOR_CANCELLED;
        

Modified: 
branches/soc-2011-tomato/source/blender/editors/space_image/space_image.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_image/space_image.c   
2012-06-10 12:15:39 UTC (rev 47668)

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to