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:
authorAntony Riakiotakis <kalast@gmail.com>2015-02-11 17:07:04 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-02-11 17:07:24 +0300
commitf7e131a6acd800a311e50b680e5be6d9824a1df7 (patch)
tree30cbe9ff93d0e59d806df735a83ba0f3d4df99a1 /source/blender/blenkernel/intern/paint.c
parentb7bac19acaa41567967a43ae8aa8756e23f27a83 (diff)
Cavity masking - add curve control to cavity mask and move relevant
structs to paint struct (might be useful for vertex paint too in the future) Cavity masking now has a curve control. The control will set the amount of masking for positive cavity ("pointness") or negative cavity ("cavity") with x axis being the amount of cavity and 0.0 = full cavity, 1.0 = full pointness, 0.5 = no cavity and the y axis being the amount of alpha.
Diffstat (limited to 'source/blender/blenkernel/intern/paint.c')
-rw-r--r--source/blender/blenkernel/intern/paint.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 58591242e5b..431eec0d220 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -48,6 +48,7 @@
#include "BLI_listbase.h"
#include "BKE_brush.h"
+#include "BKE_colortools.h"
#include "BKE_main.h"
#include "BKE_context.h"
#include "BKE_crazyspace.h"
@@ -395,6 +396,21 @@ bool BKE_paint_select_elem_test(Object *ob)
BKE_paint_select_face_test(ob));
}
+void BKE_paint_cavity_curve_preset(Paint *p, int preset)
+{
+ CurveMap *cm = NULL;
+
+ if (!p->cavity_curve)
+ p->cavity_curve = curvemapping_add(1, 0, 0, 1, 1);
+
+ cm = p->cavity_curve->cm;
+ cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
+
+ p->cavity_curve->preset = preset;
+ curvemap_reset(cm, &p->cavity_curve->clipr, p->cavity_curve->preset, CURVEMAP_SLOPE_POSITIVE);
+ curvemapping_changed(p->cavity_curve, false);
+}
+
void BKE_paint_init(UnifiedPaintSettings *ups, Paint *p, const char col[3])
{
Brush *brush;
@@ -410,12 +426,15 @@ void BKE_paint_init(UnifiedPaintSettings *ups, Paint *p, const char col[3])
ups->last_stroke_valid = false;
zero_v3(ups->average_stroke_accum);
ups->average_stroke_counter = 0;
+ if (!p->cavity_curve)
+ BKE_paint_cavity_curve_preset(p, CURVE_PRESET_LINE);
}
void BKE_paint_free(Paint *paint)
{
id_us_min((ID *)paint->brush);
id_us_min((ID *)paint->palette);
+ curvemapping_free(paint->cavity_curve);
}
/* called when copying scene settings, so even if 'src' and 'tar' are the same
@@ -427,6 +446,7 @@ void BKE_paint_copy(Paint *src, Paint *tar)
tar->brush = src->brush;
id_us_plus((ID *)tar->brush);
id_us_plus((ID *)tar->palette);
+ tar->cavity_curve = curvemapping_copy(src->cavity_curve);
}
void BKE_paint_stroke_get_average(Scene *scene, Object *ob, float stroke[3])