Paint: Scale brush size in preparation for planned 5.0 changes

This commit, in conjunction with !139561, is used to ensure consistent
values for the brush size while we transition it from representing
radius to diameter.

Related to #134204

Pull Request: https://projects.blender.org/blender/blender/pulls/139813
This commit is contained in:
Sean Kim
2025-06-05 00:46:10 +02:00
committed by Sean Kim
parent 2bbc9e73fc
commit 582c7d94b8
2 changed files with 11 additions and 0 deletions

View File

@@ -210,6 +210,11 @@ static void brush_foreach_id(ID *id, LibraryForeachIDData *data)
static void brush_blend_write(BlendWriter *writer, ID *id, const void *id_address)
{
Brush *brush = reinterpret_cast<Brush *>(id);
/* In 5.0 we intend to change the brush.size value from representing radius to representing
* diameter. This and the corresponding code in `brush_blend_read_data` should be removed once
* that transition is complete. */
brush->size *= 2;
brush->unprojected_radius *= 2.0;
BLO_write_id_struct(writer, Brush, id_address, &brush->id);
BKE_id_blend_write(writer, &brush->id);

View File

@@ -1016,6 +1016,12 @@ static void scene_blend_write(BlendWriter *writer, ID *id, const void *id_addres
ToolSettings *tos = sce->toolsettings;
BLO_write_struct(writer, ToolSettings, tos);
/* In 5.0 we intend to change the brush.size value from representing radius to representing
* diameter. This and the corresponding code in `brush_blend_read_data` should be removed once
* that transition is complete. */
tos->unified_paint_settings.size *= 2;
tos->unified_paint_settings.unprojected_radius *= 2.0f;
if (tos->unified_paint_settings.curve_rand_hue) {
BKE_curvemapping_blend_write(writer, tos->unified_paint_settings.curve_rand_hue);
}