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:
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_colortools.h9
-rw-r--r--source/blender/blenkernel/intern/brush.c3
-rw-r--r--source/blender/blenkernel/intern/colortools.c12
-rw-r--r--source/blender/blenloader/intern/readfile.c5
-rw-r--r--source/blender/editors/interface/interface_templates.c11
-rw-r--r--source/blender/makesdna/DNA_color_types.h10
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c23
7 files changed, 37 insertions, 36 deletions
diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h
index 3e1d4fe927b..dca8ccb6dbf 100644
--- a/source/blender/blenkernel/BKE_colortools.h
+++ b/source/blender/blenkernel/BKE_colortools.h
@@ -45,13 +45,6 @@ struct rctf;
# define DO_INLINE static inline
#endif
-typedef enum CurveMappingPreset {
- CURVE_PRESET_LINE,
- CURVE_PRESET_SHARP,
- CURVE_PRESET_SMOOTH,
- CURVE_PRESET_MAX
-} CurveMappingPreset;
-
void floatbuf_to_srgb_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int w);
void floatbuf_to_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int w);
@@ -62,7 +55,7 @@ void curvemapping_set_black_white(struct CurveMapping *cumap, float *black, f
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, CurveMappingPreset preset);
+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 bc30b2669e8..f2cb7d31592 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -237,7 +237,8 @@ void brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset)
cm = b->curve->cm;
cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
- curvemap_reset(cm, &b->curve->clipr, preset);
+ b->curve->preset = preset;
+ curvemap_reset(cm, &b->curve->clipr, b->curve->preset);
curvemapping_changed(b->curve, 0);
}
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 71b497660e9..28b70b539c1 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -239,7 +239,7 @@ void curvemap_insert(CurveMap *cuma, float x, float y)
cuma->curve= cmp;
}
-void curvemap_reset(CurveMap *cuma, rctf *clipr, CurveMappingPreset preset)
+void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset)
{
if(cuma->curve)
MEM_freeN(cuma->curve);
@@ -249,6 +249,7 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, CurveMappingPreset preset)
case CURVE_PRESET_SHARP: cuma->totpoint= 3; break;
case CURVE_PRESET_SMOOTH: cuma->totpoint= 4; break;
case CURVE_PRESET_MAX: cuma->totpoint= 2; break;
+ case CURVE_PRESET_MID9: cuma->totpoint= 9;
}
cuma->curve= MEM_callocN(cuma->totpoint*sizeof(CurveMapPoint), "curve points");
@@ -286,6 +287,15 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, CurveMappingPreset preset)
cuma->curve[1].x= 1;
cuma->curve[1].y= 1;
break;
+ case CURVE_PRESET_MID9:
+ {
+ int i;
+ for (i=0; i < cuma->totpoint; i++)
+ {
+ cuma->curve[i].x= i / ((float)cuma->totpoint-1);
+ cuma->curve[i].y= 0.5;
+ }
+ }
}
if(cuma->table) {
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index fbde733f717..b80e3df717c 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -10647,6 +10647,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* put 2.50 compatibility code here until next subversion bump */
{
+ Brush *brush;
+
+ for (brush= main->brush.first; brush; brush= brush->id.next) {
+ if (brush->curve) brush->curve->preset = CURVE_PRESET_SMOOTH;
+ }
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index e3dac41979d..efd741a12f6 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1707,7 +1707,7 @@ static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event)
switch(event) {
case 0: /* reset */
- curvemap_reset(cuma, &cumap->clipr, CURVE_PRESET_LINE);
+ curvemap_reset(cuma, &cumap->clipr, cumap->preset);
curvemapping_changed(cumap, 0);
break;
case 1:
@@ -1729,10 +1729,6 @@ static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event)
cuma->flag |= CUMA_EXTEND_EXTRAPOLATE;
curvemapping_changed(cumap, 0);
break;
- case 6: /* reset smooth */
- curvemap_reset(cuma, &cumap->clipr, CURVE_PRESET_SMOOTH);
- curvemapping_changed(cumap, 0);
- break;
}
ED_region_tag_redraw(CTX_wm_region(C));
}
@@ -1770,7 +1766,7 @@ static uiBlock *curvemap_brush_tools_func(bContext *C, struct ARegion *ar, void
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset View", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Vector Handle", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Auto Handle", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset Curve", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset Curve", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 50);
@@ -1789,8 +1785,9 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
CurveMapping *cumap = cumap_v;
int a;
+ cumap->preset = CURVE_PRESET_LINE;
for(a=0; a<CM_TOT; a++)
- curvemap_reset(cumap->cm+a, &cumap->clipr, CURVE_PRESET_LINE);
+ curvemap_reset(cumap->cm+a, &cumap->clipr, cumap->preset);
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/makesdna/DNA_color_types.h b/source/blender/makesdna/DNA_color_types.h
index 5d6802290c2..5b4786c0be2 100644
--- a/source/blender/makesdna/DNA_color_types.h
+++ b/source/blender/makesdna/DNA_color_types.h
@@ -64,6 +64,7 @@ typedef struct CurveMap {
typedef struct CurveMapping {
int flag, cur; /* cur; for buttons, to show active curve */
+ int preset, pad;
rctf curr, clipr; /* current rect, clip rect (is default rect too) */
@@ -80,6 +81,15 @@ typedef struct CurveMapping {
#define CUMA_DRAW_CFRA 4
#define CUMA_DRAW_SAMPLE 8
+/* cumapping->preset */
+typedef enum CurveMappingPreset {
+ CURVE_PRESET_LINE,
+ CURVE_PRESET_SHARP,
+ CURVE_PRESET_SMOOTH,
+ CURVE_PRESET_MAX,
+ CURVE_PRESET_MID9
+} CurveMappingPreset;
+
typedef struct Histogram {
int channels;
int x_resolution;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
index 0517811fe0d..58850cf3568 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c
@@ -137,28 +137,13 @@ static void node_composit_exec_huecorrect(void *data, bNode *node, bNodeStack **
static void node_composit_init_huecorrect(bNode* node)
{
CurveMapping *cumapping = node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
- int c, i;
+ int c;
+
+ cumapping->preset = CURVE_PRESET_MID9;
for (c=0; c<3; c++) {
CurveMap *cuma = &cumapping->cm[c];
-
- /* set default horizontal curve */
- if(cuma->curve)
- MEM_freeN(cuma->curve);
-
- cuma->totpoint= 9;
- cuma->curve= MEM_callocN(cuma->totpoint*sizeof(CurveMapPoint), "curve points");
-
- for (i=0; i < cuma->totpoint; i++)
- {
- cuma->curve[i].x= i / ((float)cuma->totpoint-1);
- cuma->curve[i].y= 0.5;
- }
-
- if(cuma->table) {
- MEM_freeN(cuma->table);
- cuma->table= NULL;
- }
+ curvemap_reset(cuma, &cumapping->clipr, cumapping->preset);
}
/* default to showing Saturation */