diff --git a/source/blender/blenkernel/intern/brush.cc b/source/blender/blenkernel/intern/brush.cc index 534aa5da607..ac5cb6dcd43 100644 --- a/source/blender/blenkernel/intern/brush.cc +++ b/source/blender/blenkernel/intern/brush.cc @@ -401,6 +401,13 @@ static void brush_blend_read_data(BlendDataReader *reader, ID *id) brush->icon_imbuf = nullptr; brush->has_unsaved_changes = false; + + /* Prior to 5.0, the brush->size value is expected to be the radius, not the diameter. To ensure + * correct behavior, convert this when reading newer files. */ + if (BLO_read_fileversion_get(reader) > 500) { + brush->size = std::max(brush->size / 2, 1); + brush->unprojected_radius = std::max(brush->unprojected_radius / 2, 0.001f); + } } static void brush_blend_read_after_liblink(BlendLibReader * /*reader*/, ID *id) diff --git a/source/blender/blenkernel/intern/scene.cc b/source/blender/blenkernel/intern/scene.cc index 3ec88fb6f60..4b4f56c08c9 100644 --- a/source/blender/blenkernel/intern/scene.cc +++ b/source/blender/blenkernel/intern/scene.cc @@ -1224,6 +1224,13 @@ static void scene_blend_read_data(BlendDataReader *reader, ID *id) zero_v3(ups->last_location); ups->last_hit = 0; + /* Prior to 5.0, the brush->size value is expected to be the radius, not the diameter. To + * ensure correct behavior, convert this when reading newer files. */ + if (BLO_read_fileversion_get(reader)) { + ups->size = std::max(ups->size / 2, 1); + ups->unprojected_radius = std::max(ups->unprojected_radius / 2, 0.001f); + } + BLO_read_struct(reader, CurveMapping, &ups->curve_rand_hue); if (ups->curve_rand_hue) { BKE_curvemapping_blend_read(reader, ups->curve_rand_hue);