GPencil: Change Brush defaults for Block and Marker
authorAntonioya <blendergit@gmail.com>
Thu, 14 Mar 2019 13:03:04 +0000 (14:03 +0100)
committerAntonioya <blendergit@gmail.com>
Thu, 14 Mar 2019 13:03:04 +0000 (14:03 +0100)
Still pending the change in default 2D template.

Changes reviewed by @pepeland and @mendio

source/blender/blenkernel/intern/brush.c

index e0823e9..6610d35 100644 (file)
@@ -207,14 +207,15 @@ typedef enum eGPCurveMappingPreset {
        GPCURVE_PRESET_PENCIL = 0,
        GPCURVE_PRESET_INK = 1,
        GPCURVE_PRESET_INKNOISE = 2,
+       GPCURVE_PRESET_MARKER = 3
 } eGPCurveMappingPreset;
 
-static void brush_gpencil_curvemap_reset(CurveMap *cuma, int preset)
+static void brush_gpencil_curvemap_reset(CurveMap *cuma, int tot, int preset)
 {
        if (cuma->curve)
                MEM_freeN(cuma->curve);
 
-       cuma->totpoint = 3;
+       cuma->totpoint = tot;
        cuma->curve = MEM_callocN(cuma->totpoint * sizeof(CurveMapPoint), __func__);
 
        switch (preset) {
@@ -242,6 +243,16 @@ static void brush_gpencil_curvemap_reset(CurveMap *cuma, int preset)
                        cuma->curve[2].x = 1.0f;
                        cuma->curve[2].y = 1.0f;
                        break;
+               case GPCURVE_PRESET_MARKER:
+                       cuma->curve[0].x = 0.0f;
+                       cuma->curve[0].y = 0.0f;
+                       cuma->curve[1].x = 0.38f;
+                       cuma->curve[1].y = 0.22f;
+                       cuma->curve[2].x = 0.65f;
+                       cuma->curve[2].y = 0.68f;
+                       cuma->curve[3].x = 1.0f;
+                       cuma->curve[3].y = 1.0f;
+                       break;
        }
 
        if (cuma->table) {
@@ -358,7 +369,7 @@ void BKE_brush_gpencil_presets(bContext *C)
        custom_curve = brush->gpencil_settings->curve_sensitivity;
        curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f);
        curvemapping_initialize(custom_curve);
-       brush_gpencil_curvemap_reset(custom_curve->cm, GPCURVE_PRESET_INK);
+       brush_gpencil_curvemap_reset(custom_curve->cm, 3, GPCURVE_PRESET_INK);
 
        /* Ink Noise brush */
        brush = BKE_brush_add_gpencil(bmain, ts, "Draw Noise");
@@ -395,7 +406,7 @@ void BKE_brush_gpencil_presets(bContext *C)
        custom_curve = brush->gpencil_settings->curve_sensitivity;
        curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f);
        curvemapping_initialize(custom_curve);
-       brush_gpencil_curvemap_reset(custom_curve->cm, GPCURVE_PRESET_INKNOISE);
+       brush_gpencil_curvemap_reset(custom_curve->cm, 3, GPCURVE_PRESET_INKNOISE);
 
        /* Block Basic brush */
        brush = BKE_brush_add_gpencil(bmain, ts, "Draw Block");
@@ -403,7 +414,7 @@ void BKE_brush_gpencil_presets(bContext *C)
        brush->gpencil_settings->flag |= (GP_BRUSH_USE_PRESSURE | GP_BRUSH_ENABLE_CURSOR);
        brush->gpencil_settings->draw_sensitivity = 1.0f;
 
-       brush->gpencil_settings->draw_strength = 0.7f;
+       brush->gpencil_settings->draw_strength = 1.0f;
        brush->gpencil_settings->flag |= GP_BRUSH_USE_STENGTH_PRESSURE;
 
        brush->gpencil_settings->draw_random_press = 0.0f;
@@ -414,8 +425,7 @@ void BKE_brush_gpencil_presets(bContext *C)
        brush->gpencil_settings->draw_angle = 0.0f;
        brush->gpencil_settings->draw_angle_factor = 0.0f;
 
-       brush->gpencil_settings->flag |= GP_BRUSH_GROUP_SETTINGS;
-       brush->gpencil_settings->draw_smoothfac = 0.0f;
+       brush->gpencil_settings->draw_smoothfac = 0.1f;
        brush->gpencil_settings->draw_smoothlvl = 1;
        brush->gpencil_settings->thick_smoothfac = 1.0f;
        brush->gpencil_settings->thick_smoothlvl = 3;
@@ -442,7 +452,7 @@ void BKE_brush_gpencil_presets(bContext *C)
        brush->gpencil_settings->draw_jitter = 0.0f;
        brush->gpencil_settings->flag |= GP_BRUSH_USE_JITTER_PRESSURE;
 
-       brush->gpencil_settings->draw_angle = M_PI_4; /* 45 degrees */
+       brush->gpencil_settings->draw_angle = DEG2RAD(20.0f);
        brush->gpencil_settings->draw_angle_factor = 1.0f;
 
        brush->gpencil_settings->flag |= GP_BRUSH_GROUP_SETTINGS;
@@ -457,6 +467,11 @@ void BKE_brush_gpencil_presets(bContext *C)
 
        brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS;
        brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR;
+       /* Curve */
+       custom_curve = brush->gpencil_settings->curve_sensitivity;
+       curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f);
+       curvemapping_initialize(custom_curve);
+       brush_gpencil_curvemap_reset(custom_curve->cm, 4, GPCURVE_PRESET_MARKER);
 
        /* Fill brush */
        brush = BKE_brush_add_gpencil(bmain, ts, "Fill Area");