Revision: 30882
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30882
Author:   broken
Date:     2010-07-30 02:06:59 +0200 (Fri, 30 Jul 2010)

Log Message:
-----------
Preview commit in sculpt brushes broke resetting curves in other areas (rgb 
curves etc).

Fixed by adding a 'slope' parameter to curvemap_reset() to mirror curve presets 
around Y axis.

Also removed curve preset with 'random' icon, wasn't doing what it looked like 
it should, 
this was intended only for hue correct node anyway.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_image.py
    trunk/blender/release/scripts/ui/space_view3d_toolbar.py
    trunk/blender/source/blender/blenkernel/BKE_colortools.h
    trunk/blender/source/blender/blenkernel/intern/brush.c
    trunk/blender/source/blender/blenkernel/intern/colortools.c
    trunk/blender/source/blender/editors/interface/interface_templates.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
    trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c

Modified: trunk/blender/release/scripts/ui/space_image.py
===================================================================
--- trunk/blender/release/scripts/ui/space_image.py     2010-07-29 22:34:46 UTC 
(rev 30881)
+++ trunk/blender/release/scripts/ui/space_image.py     2010-07-30 00:06:59 UTC 
(rev 30882)
@@ -673,7 +673,6 @@
         row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 
'SHARP'
         row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 
'LINE'
         row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 
'MAX'
-        row.operator("brush.curve_preset", icon="RNDCURVE", text="").shape = 
'MID9'
 
 classes = [
     IMAGE_MT_view,

Modified: trunk/blender/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- trunk/blender/release/scripts/ui/space_view3d_toolbar.py    2010-07-29 
22:34:46 UTC (rev 30881)
+++ trunk/blender/release/scripts/ui/space_view3d_toolbar.py    2010-07-30 
00:06:59 UTC (rev 30882)
@@ -986,7 +986,6 @@
         row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 
'SHARP'
         row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 
'LINE'
         row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 
'MAX'
-        row.operator("brush.curve_preset", icon="RNDCURVE", text="").shape = 
'MID9'
 
 class VIEW3D_PT_sculpt_options(PaintPanel):
     bl_label = "Options"

Modified: trunk/blender/source/blender/blenkernel/BKE_colortools.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_colortools.h    2010-07-29 
22:34:46 UTC (rev 30881)
+++ trunk/blender/source/blender/blenkernel/BKE_colortools.h    2010-07-30 
00:06:59 UTC (rev 30882)
@@ -53,9 +53,11 @@
 struct CurveMapping    *curvemapping_copy(struct CurveMapping *cumap);
 void                           curvemapping_set_black_white(struct 
CurveMapping *cumap, float *black, float *white);
 
+#define CURVEMAP_SLOPE_NEGATIVE        0
+#define CURVEMAP_SLOPE_POSITIVE        1
+void                           curvemap_reset(struct CurveMap *cuma, struct 
rctf *clipr, int preset, int slope);
 void                           curvemap_remove(struct CurveMap *cuma, int 
flag);
 void                           curvemap_insert(struct CurveMap *cuma, float x, 
float y);
-void                           curvemap_reset(struct CurveMap *cuma, struct 
rctf *clipr, int preset);
 void                           curvemap_sethandle(struct CurveMap *cuma, int 
type);
 
 void                           curvemapping_changed(struct CurveMapping 
*cumap, int rem_doubles);

Modified: trunk/blender/source/blender/blenkernel/intern/brush.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/brush.c      2010-07-29 
22:34:46 UTC (rev 30881)
+++ trunk/blender/source/blender/blenkernel/intern/brush.c      2010-07-30 
00:06:59 UTC (rev 30882)
@@ -452,7 +452,7 @@
        cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
 
        b->curve->preset = preset;
-       curvemap_reset(cm, &b->curve->clipr, b->curve->preset);
+       curvemap_reset(cm, &b->curve->clipr, b->curve->preset, 
CURVEMAP_SLOPE_NEGATIVE);
        curvemapping_changed(b->curve, 0);
 }
 

Modified: trunk/blender/source/blender/blenkernel/intern/colortools.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/colortools.c 2010-07-29 
22:34:46 UTC (rev 30881)
+++ trunk/blender/source/blender/blenkernel/intern/colortools.c 2010-07-30 
00:06:59 UTC (rev 30882)
@@ -236,7 +236,7 @@
        cuma->curve= cmp;
 }
 
-void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset)
+void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset, int slope)
 {
        if(cuma->curve)
                MEM_freeN(cuma->curve);
@@ -320,6 +320,20 @@
                        break;
        }
 
+       /* mirror curve in x direction to have positive slope
+        * rather than default negative slope */
+       if (slope == CURVEMAP_SLOPE_POSITIVE) {
+               int i, last=cuma->totpoint-1;
+               CurveMapPoint *newpoints= MEM_dupallocN(cuma->curve);
+               
+               for (i=0; i<cuma->totpoint; i++) {
+                       newpoints[i].y = cuma->curve[last-i].y;
+               }
+               
+               MEM_freeN(cuma->curve);
+               cuma->curve = newpoints;
+       }
+       
        if(cuma->table) {
                MEM_freeN(cuma->table);
                cuma->table= NULL;

Modified: trunk/blender/source/blender/editors/interface/interface_templates.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_templates.c        
2010-07-29 22:34:46 UTC (rev 30881)
+++ trunk/blender/source/blender/editors/interface/interface_templates.c        
2010-07-30 00:06:59 UTC (rev 30882)
@@ -1747,7 +1747,7 @@
 
        switch(event) {
                case 0: /* reset */
-                       curvemap_reset(cuma, &cumap->clipr,     cumap->preset);
+                       curvemap_reset(cuma, &cumap->clipr,     cumap->preset, 
CURVEMAP_SLOPE_POSITIVE);
                        curvemapping_changed(cumap, 0);
                        break;
                case 1:
@@ -1827,7 +1827,7 @@
        
        cumap->preset = CURVE_PRESET_LINE;
        for(a=0; a<CM_TOT; a++)
-               curvemap_reset(cumap->cm+a, &cumap->clipr, cumap->preset);
+               curvemap_reset(cumap->cm+a, &cumap->clipr, cumap->preset, 
CURVEMAP_SLOPE_POSITIVE);
        
        cumap->black[0]=cumap->black[1]=cumap->black[2]= 0.0f;
        cumap->white[0]=cumap->white[1]=cumap->white[2]= 1.0f;

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c     
2010-07-29 22:34:46 UTC (rev 30881)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c     
2010-07-30 00:06:59 UTC (rev 30882)
@@ -216,7 +216,6 @@
                {CURVE_PRESET_SHARP, "SHARP", 0, "Sharp", ""},
                {CURVE_PRESET_SMOOTH, "SMOOTH", 0, "Smooth", ""},
                {CURVE_PRESET_MAX, "MAX", 0, "Max", ""},
-               {CURVE_PRESET_MID9, "MID9", 0, "Mid9", ""},
                {CURVE_PRESET_LINE, "LINE", 0, "Line", ""},
                {CURVE_PRESET_ROUND, "ROUND", 0, "Round", ""},
                {CURVE_PRESET_ROOT, "ROOT", 0, "Root", ""},

Modified: trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c        
2010-07-29 22:34:46 UTC (rev 30881)
+++ trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c        
2010-07-30 00:06:59 UTC (rev 30882)
@@ -141,7 +141,7 @@
        
        for (c=0; c<3; c++) {
                CurveMap *cuma = &cumapping->cm[c];
-               curvemap_reset(cuma, &cumapping->clipr, cumapping->preset);
+               curvemap_reset(cuma, &cumapping->clipr, cumapping->preset, 
CURVEMAP_SLOPE_POSITIVE);
        }
        
        /* default to showing Saturation */


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to