From ac8d7873278c47e8e282b7f83888108e2720a451 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 2 Nov 2018 09:10:23 +1100 Subject: Tool System: brushes are now categorized by tool The toolbar now shows brush types, the brush selector now only shows brushes matching the current tool type. Details: - Add's Paint.tool_slots (used by the toolbar). - Removed custom grease pencil brush tool code. - Bumped subversion. See T57526 for details. --- source/blender/blenloader/intern/readfile.c | 7 +++++++ source/blender/blenloader/intern/versioning_280.c | 11 ++++++++++- source/blender/blenloader/intern/writefile.c | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ddda9eb610e..6b5b5c59706 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5910,6 +5910,11 @@ static void link_paint(FileData *fd, Scene *sce, Paint *p) { if (p) { p->brush = newlibadr_us(fd, sce->id.lib, p->brush); + for (int i = 0; i < p->tool_slots_len; i++) { + if (p->tool_slots[i].brush != NULL) { + p->tool_slots[i].brush = newlibadr_us(fd, sce->id.lib, p->tool_slots[i].brush); + } + } p->palette = newlibadr_us(fd, sce->id.lib, p->palette); p->paint_cursor = NULL; } @@ -6205,6 +6210,8 @@ static void direct_link_paint(FileData *fd, Paint *p) direct_link_curvemapping(fd, p->cavity_curve); else BKE_paint_cavity_curve_preset(p, CURVE_PRESET_LINE); + + p->tool_slots = newdataadr(fd, p->tool_slots); } static void direct_link_paint_helper(FileData *fd, Paint **paint) diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 98bebd70d14..1384a4f28e2 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -909,6 +909,15 @@ void do_versions_after_linking_280(Main *bmain) } } } + + if (!MAIN_VERSION_ATLEAST(bmain, 280, 30)) { + for (Brush *brush = bmain->brush.first; brush; brush = brush->id.next) { + if (brush->gpencil_settings != NULL) { + brush->gpencil_tool = brush->gpencil_settings->brush_type; + } + } + BKE_paint_toolslots_init_from_main(bmain); + } } /* NOTE: this version patch is intended for versions < 2.52.2, but was initially introduced in 2.27 already. @@ -2030,7 +2039,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) for (Brush *brush = bmain->brush.first; brush; brush = brush->id.next) { if (brush->gpencil_settings != NULL) { BrushGpencilSettings *gp = brush->gpencil_settings; - if (gp->brush_type == GP_BRUSH_TYPE_ERASE) { + if (gp->brush_type == GPAINT_TOOL_ERASE) { gp->era_strength_f = 100.0f; gp->era_thickness_f = 10.0f; } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 16bc845a3e9..c3693de4866 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2434,6 +2434,7 @@ static void write_paint(WriteData *wd, Paint *p) if (p->cavity_curve) { write_curvemapping(wd, p->cavity_curve); } + writedata(wd, DATA, sizeof(PaintToolSlot) * p->tool_slots_len, p->tool_slots); } static void write_layer_collections(WriteData *wd, ListBase *lb) -- cgit v1.2.3