From 0156a677c7d13106a1d049d74fca43b5311eb53e Mon Sep 17 00:00:00 2001 From: Joseph Eagar Date: Wed, 28 Sep 2022 16:22:34 -0700 Subject: Sculpt: New Cavity Automasking Mode Add new cavity automasking mode based on local mesh curvature. Cavity masking is a great way to quickly add detail in crevices and the like. It's meant to be used with the Paint brush in color attribute mode. It does work with other brushes but the results can be unpredictable. {F13131497} The old "dirty mask" operator has been replace with a new "mask from cavity" operator that shares the same code with cavity automasking. Differences from the sculpt-dev implementation: * It uses the word "cavity." When I first implemented this I wasn't aware this feature existed in other software (and other paint modes in Blender), and for reasons that escape me today I initially decided to call it a concave or concavity mask. * The cavity factor works a bit differently. It's no longer non-linear and functions as a simple scale around 0.5f. * Supports custom curves. * Supports blurring. Reviewed By: Julian Kaspar, Jeroen Bakker and Campbell Barton Differential Revision: https://developer.blender.org/D15122 Ref D15122 --- source/blender/blenloader/intern/versioning_300.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/versioning_300.cc b/source/blender/blenloader/intern/versioning_300.cc index 11c88a5d69b..878a4078295 100644 --- a/source/blender/blenloader/intern/versioning_300.cc +++ b/source/blender/blenloader/intern/versioning_300.cc @@ -3337,6 +3337,14 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } + if (!DNA_struct_elem_find(fd->filesdna, "Sculpt", "float", "automasking_cavity_factor")) { + LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { + if (scene->toolsettings && scene->toolsettings->sculpt) { + scene->toolsettings->sculpt->automasking_cavity_factor = 0.5f; + } + } + } + if (!MAIN_VERSION_ATLEAST(bmain, 302, 14)) { /* Compensate for previously wrong squared distance. */ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { @@ -3519,6 +3527,7 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) BKE_main_namemap_validate_and_fix(bmain); } + if (!MAIN_VERSION_ATLEAST(bmain, 304, 1)) { /* Image generation information transferred to tiles. */ if (!DNA_struct_elem_find(fd->filesdna, "ImageTile", "int", "gen_x")) { @@ -3575,6 +3584,13 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) FOREACH_NODETREE_END; } + if (!MAIN_VERSION_ATLEAST(bmain, 304, 2)) { + /* Initialize brush curves sculpt settings. */ + LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) { + brush->automasking_cavity_factor = 0.5f; + } + } + /** * Versioning code until next subversion bump goes here. * -- cgit v1.2.3