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
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/annotate_paint.c84
-rw-r--r--source/blender/editors/gpencil/gpencil_brush.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_interpolate.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c15
-rw-r--r--source/blender/editors/gpencil/gpencil_primitive.c13
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c12
6 files changed, 23 insertions, 105 deletions
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index e59e5d6a878..c9c4a67644e 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -561,87 +561,6 @@ static short gp_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure
return GP_STROKEADD_INVALID;
}
-/* simplify a stroke (in buffer) before storing it
- * - applies a reverse Chaikin filter
- * - code adapted from etch-a-ton branch
- */
-static void gp_stroke_simplify(tGPsdata *p)
-{
- bGPdata *gpd = p->gpd;
- tGPspoint *old_points = (tGPspoint *)gpd->runtime.sbuffer;
- short num_points = gpd->runtime.sbuffer_used;
- short flag = gpd->runtime.sbuffer_sflag;
- short i, j;
-
- /* only simplify if simplification is enabled, and we're not doing a straight line */
- if (!(U.gp_settings & GP_PAINT_DOSIMPLIFY) || (p->paintmode == GP_PAINTMODE_DRAW_STRAIGHT)) {
- return;
- }
-
- /* don't simplify if less than 4 points in buffer */
- if ((num_points <= 4) || (old_points == NULL)) {
- return;
- }
-
- /* clear buffer (but don't free mem yet) so that we can write to it
- * - firstly set sbuffer to NULL, so a new one is allocated
- * - secondly, reset flag after, as it gets cleared auto
- */
- gpd->runtime.sbuffer = NULL;
- gp_session_validatebuffer(p);
- gpd->runtime.sbuffer_sflag = flag;
-
-/* macro used in loop to get position of new point
- * - used due to the mixture of datatypes in use here
- */
-#define GP_SIMPLIFY_AVPOINT(offs, sfac) \
- { \
- co[0] += (float)(old_points[offs].x * sfac); \
- co[1] += (float)(old_points[offs].y * sfac); \
- pressure += old_points[offs].pressure * sfac; \
- time += old_points[offs].time * sfac; \
- } \
- (void)0
-
- /* XXX Here too, do not lose start and end points! */
- gp_stroke_addpoint(
- p, &old_points->x, old_points->pressure, p->inittime + (double)old_points->time);
- for (i = 0, j = 0; i < num_points; i++) {
- if (i - j == 3) {
- float co[2], pressure, time;
- float mco[2];
-
- /* initialize values */
- co[0] = 0.0f;
- co[1] = 0.0f;
- pressure = 0.0f;
- time = 0.0f;
-
- /* using macro, calculate new point */
- GP_SIMPLIFY_AVPOINT(j, -0.25f);
- GP_SIMPLIFY_AVPOINT(j + 1, 0.75f);
- GP_SIMPLIFY_AVPOINT(j + 2, 0.75f);
- GP_SIMPLIFY_AVPOINT(j + 3, -0.25f);
-
- /* set values for adding */
- mco[0] = co[0];
- mco[1] = co[1];
-
- /* ignore return values on this... assume to be ok for now */
- gp_stroke_addpoint(p, mco, pressure, p->inittime + (double)time);
-
- j += 2;
- }
- }
- gp_stroke_addpoint(p,
- &old_points[num_points - 1].x,
- old_points[num_points - 1].pressure,
- p->inittime + (double)old_points[num_points - 1].time);
-
- /* free old buffer */
- MEM_freeN(old_points);
-}
-
/* make a new stroke from the buffer data */
static void gp_stroke_newfrombuffer(tGPsdata *p)
{
@@ -1466,9 +1385,6 @@ static void gp_paint_strokeend(tGPsdata *p)
/* check if doing eraser or not */
if ((p->gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) {
- /* simplify stroke before transferring? */
- gp_stroke_simplify(p);
-
/* transfer stroke to frame */
gp_stroke_newfrombuffer(p);
}
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 1a7422cd174..8e4d2655ef0 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -1283,7 +1283,7 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
/* Init multi-edit falloff curve data before doing anything,
* so we won't have to do it again later. */
if (gso->is_multiframe) {
- curvemapping_initialize(ts->gp_sculpt.cur_falloff);
+ BKE_curvemapping_initialize(ts->gp_sculpt.cur_falloff);
}
/* initialise custom data for brushes */
diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c
index 698e508a2a5..86de9a75a56 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -1003,7 +1003,7 @@ static int gpencil_interpolate_seq_exec(bContext *C, wmOperator *op)
if (ipo_settings->type == GP_IPO_CURVEMAP) {
/* custom curvemap */
if (ipo_settings->custom_ipo) {
- factor = curvemapping_evaluateF(ipo_settings->custom_ipo, 0, factor);
+ factor = BKE_curvemapping_evaluateF(ipo_settings->custom_ipo, 0, factor);
}
else {
BKE_report(op->reports, RPT_ERROR, "Custom interpolation curve does not exist");
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index a271274fa71..06ff0e744b9 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -476,7 +476,7 @@ static void gp_brush_jitter(bGPdata *gpd,
{
float tmp_pressure = pressure;
if (brush->gpencil_settings->draw_jitter > 0.0f) {
- float curvef = curvemapping_evaluateF(brush->gpencil_settings->curve_jitter, 0, pressure);
+ float curvef = BKE_curvemapping_evaluateF(brush->gpencil_settings->curve_jitter, 0, pressure);
tmp_pressure = curvef * brush->gpencil_settings->draw_sensitivity;
}
/* exponential value */
@@ -671,7 +671,7 @@ static short gp_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure
/* store settings */
/* pressure */
if (brush->gpencil_settings->flag & GP_BRUSH_USE_PRESSURE) {
- float curvef = curvemapping_evaluateF(
+ float curvef = BKE_curvemapping_evaluateF(
brush->gpencil_settings->curve_sensitivity, 0, pressure);
pt->pressure = curvef * brush->gpencil_settings->draw_sensitivity;
}
@@ -695,7 +695,7 @@ static short gp_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure
/* apply randomness to pressure */
if ((brush->gpencil_settings->flag & GP_BRUSH_GROUP_RANDOM) &&
(brush->gpencil_settings->draw_random_press > 0.0f)) {
- float curvef = curvemapping_evaluateF(
+ float curvef = BKE_curvemapping_evaluateF(
brush->gpencil_settings->curve_sensitivity, 0, pressure);
float tmp_pressure = curvef * brush->gpencil_settings->draw_sensitivity;
if (BLI_rng_get_float(p->rng) > 0.5f) {
@@ -731,7 +731,8 @@ static short gp_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure
/* color strength */
if (brush->gpencil_settings->flag & GP_BRUSH_USE_STENGTH_PRESSURE) {
- float curvef = curvemapping_evaluateF(brush->gpencil_settings->curve_strength, 0, pressure);
+ float curvef = BKE_curvemapping_evaluateF(
+ brush->gpencil_settings->curve_strength, 0, pressure);
float tmp_pressure = curvef * brush->gpencil_settings->draw_sensitivity;
pt->strength = tmp_pressure * brush->gpencil_settings->draw_strength;
@@ -1809,9 +1810,9 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata *p)
changed = true;
}
/* be sure curves are initializated */
- curvemapping_initialize(paint->brush->gpencil_settings->curve_sensitivity);
- curvemapping_initialize(paint->brush->gpencil_settings->curve_strength);
- curvemapping_initialize(paint->brush->gpencil_settings->curve_jitter);
+ BKE_curvemapping_initialize(paint->brush->gpencil_settings->curve_sensitivity);
+ BKE_curvemapping_initialize(paint->brush->gpencil_settings->curve_strength);
+ BKE_curvemapping_initialize(paint->brush->gpencil_settings->curve_jitter);
/* assign to temp tGPsdata */
p->brush = paint->brush;
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 816517d6ef9..25913fe821a 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -704,13 +704,13 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
gp_session_validatebuffer(tgpi);
gp_init_colors(tgpi);
if (gset->flag & GP_SCULPT_SETT_FLAG_PRIMITIVE_CURVE) {
- curvemapping_initialize(ts->gp_sculpt.cur_primitive);
+ BKE_curvemapping_initialize(ts->gp_sculpt.cur_primitive);
}
if (tgpi->brush->gpencil_settings->flag & GP_BRUSH_USE_JITTER_PRESSURE) {
- curvemapping_initialize(tgpi->brush->gpencil_settings->curve_jitter);
+ BKE_curvemapping_initialize(tgpi->brush->gpencil_settings->curve_jitter);
}
if (tgpi->brush->gpencil_settings->flag & GP_BRUSH_USE_STENGTH_PRESSURE) {
- curvemapping_initialize(tgpi->brush->gpencil_settings->curve_strength);
+ BKE_curvemapping_initialize(tgpi->brush->gpencil_settings->curve_strength);
}
/* get an array of depths, far depths are blended */
@@ -834,7 +834,7 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
/* normalize value to evaluate curve */
if (gset->flag & GP_SCULPT_SETT_FLAG_PRIMITIVE_CURVE) {
float value = (float)i / (gps->totpoints - 1);
- curve_pressure = curvemapping_evaluateF(gset->cur_primitive, 0, value);
+ curve_pressure = BKE_curvemapping_evaluateF(gset->cur_primitive, 0, value);
pressure = curve_pressure;
}
@@ -844,7 +844,8 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
float jitter;
if (brush->gpencil_settings->flag & GP_BRUSH_USE_JITTER_PRESSURE) {
- jitter = curvemapping_evaluateF(brush->gpencil_settings->curve_jitter, 0, curve_pressure);
+ jitter = BKE_curvemapping_evaluateF(
+ brush->gpencil_settings->curve_jitter, 0, curve_pressure);
jitter *= brush->gpencil_settings->draw_sensitivity;
}
else {
@@ -890,7 +891,7 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
/* color strength */
if (brush->gpencil_settings->flag & GP_BRUSH_USE_STENGTH_PRESSURE) {
- float curvef = curvemapping_evaluateF(
+ float curvef = BKE_curvemapping_evaluateF(
brush->gpencil_settings->curve_strength, 0, curve_pressure);
strength *= curvef * brush->gpencil_settings->draw_sensitivity;
strength *= brush->gpencil_settings->draw_strength;
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index a475e43755c..2a0f16a4bbf 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1396,13 +1396,13 @@ void ED_gpencil_add_defaults(bContext *C, Object *ob)
/* ensure multiframe falloff curve */
if (ts->gp_sculpt.cur_falloff == NULL) {
- ts->gp_sculpt.cur_falloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
+ ts->gp_sculpt.cur_falloff = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
CurveMapping *gp_falloff_curve = ts->gp_sculpt.cur_falloff;
- curvemapping_initialize(gp_falloff_curve);
- curvemap_reset(gp_falloff_curve->cm,
- &gp_falloff_curve->clipr,
- CURVE_PRESET_GAUSS,
- CURVEMAP_SLOPE_POSITIVE);
+ BKE_curvemapping_initialize(gp_falloff_curve);
+ BKE_curvemap_reset(gp_falloff_curve->cm,
+ &gp_falloff_curve->clipr,
+ CURVE_PRESET_GAUSS,
+ CURVEMAP_SLOPE_POSITIVE);
}
}