Commit: dcdf548e54e254f258e7872f533296c2918991d2 Author: Antonio Vazquez Date: Tue Nov 12 17:31:41 2019 +0100 Branches: greasepencil-object https://developer.blender.org/rBdcdf548e54e254f258e7872f533296c2918991d2
GPencil: Fix double Brush initialization =================================================================== M source/blender/blenkernel/BKE_brush.h M source/blender/blenkernel/intern/brush.c M source/blender/blenloader/intern/versioning_280.c =================================================================== diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index cbad6fd6122..5d350ffa764 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -59,6 +59,7 @@ void BKE_brush_free(struct Brush *brush); void BKE_brush_sculpt_reset(struct Brush *brush); void BKE_brush_gpencil_presets(struct Main *bmain, struct ToolSettings *ts); +void BKE_brush_gpencil_vertex_presets(struct Main *bmain, struct ToolSettings *ts); /* image icon function */ struct ImBuf *get_brush_icon(struct Brush *brush); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 3f5a9bbd411..07ff14b6f0f 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -273,7 +273,7 @@ static Brush *gpencil_brush_ensure( return brush; } -/* create a set of grease pencil presets. */ +/* Create a set of grease pencil Drawing presets. */ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts) { #define SMOOTH_STROKE_RADIUS 40 @@ -281,9 +281,8 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts) #define ACTIVE_SMOOTH 0.35f Paint *paint = &ts->gp_paint->paint; - Paint *vertexpaint = &ts->gp_vertexpaint->paint; - Brush *brush, *deft_draw, *deft_vertex; + Brush *brush, *deft_draw; CurveMapping *custom_curve; bool new_brush = false; /* Airbrush brush. */ @@ -663,7 +662,21 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts) zero_v3(brush->secondary_rgb); } - /* Vertex Paint Brushes. */ + /* Set default Draw brush. */ + BKE_paint_brush_set(paint, deft_draw); +} + +/* Create a set of grease pencil Vertex Paint presets. */ +void BKE_brush_gpencil_vertex_presets(Main *bmain, ToolSettings *ts) +{ +#define SMOOTH_STROKE_RADIUS 40 +#define SMOOTH_STROKE_FACTOR 0.9f +#define ACTIVE_SMOOTH 0.35f + + Paint *vertexpaint = &ts->gp_vertexpaint->paint; + + Brush *brush, *deft_vertex; + bool new_brush = false; /* Vertex Draw brush. */ brush = gpencil_brush_ensure(bmain, ts, "Vertex Draw", OB_MODE_VERTEX_GPENCIL, &new_brush); brush->gpencil_settings->icon_id = GP_BRUSH_ICON_VERTEX_DRAW; @@ -733,9 +746,6 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts) /* Set default Vertex brush. */ BKE_paint_brush_set(vertexpaint, deft_vertex); - - /* Set default Draw brush. */ - BKE_paint_brush_set(paint, deft_draw); } struct Brush *BKE_brush_first_search(struct Main *bmain, const eObjectMode ob_mode) diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index a96ad004b95..6c31b99a046 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -1294,7 +1294,7 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports)) if (!MAIN_VERSION_ATLEAST(bmain, 282, 2)) { /* Init all Vertex Paint brushes. */ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) { - BKE_brush_gpencil_presets(bmain, scene->toolsettings); + BKE_brush_gpencil_vertex_presets(bmain, scene->toolsettings); /* Ensure new Vertex Paint mode. */ BKE_paint_ensure_from_paintmode(scene, PAINT_MODE_GPENCIL_VERTEX); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs