Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMatt Ebb <matt@mke3.net>2010-07-30 04:06:59 +0400
committerMatt Ebb <matt@mke3.net>2010-07-30 04:06:59 +0400
commiteec131899647cdf17c50553e265a925857f35cfe (patch)
tree7b71e94792babf0f3191115d6f4c6e5344d54169 /source
parentb1f53d98e4332cfa17b7e30fb8fa11feda5d826e (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_colortools.h4
-rw-r--r--source/blender/blenkernel/intern/brush.c2
-rw-r--r--source/blender/blenkernel/intern/colortools.c16
-rw-r--r--source/blender/editors/interface/interface_templates.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c1
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c2
6 files changed, 22 insertions, 7 deletions
diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h
index 1f2dee6dcfc..e0ebedb320b 100644
--- a/source/blender/blenkernel/BKE_colortools.h
+++ b/source/blender/blenkernel/BKE_colortools.h
@@ -53,9 +53,11 @@ void curvemapping_free(struct CurveMapping *cumap);
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);
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 1e4fb13d1df..b9d7ea177d4 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -452,7 +452,7 @@ void brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset)
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);
}
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index a07c18f42f3..11801557c99 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -236,7 +236,7 @@ void curvemap_insert(CurveMap *cuma, float x, float y)
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 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset)
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;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 6bc81b7ab18..28d0e131ef2 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1747,7 +1747,7 @@ static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event)
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 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
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;
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index ecce64f2d10..30b3ddf6e8d 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -216,7 +216,6 @@ void BRUSH_OT_curve_preset(wmOperatorType *ot)
{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", ""},
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
index 95db66d92f7..9eb79bb8c36 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
@@ -141,7 +141,7 @@ static void node_composit_init_huecorrect(bNode* node)
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 */