diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-03-31 13:54:44 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-03-31 13:54:44 +0300 |
commit | 2c29a94531225fe4f8d77171647016e37261de31 (patch) | |
tree | 225467fe2c53184f5c00ed0f3dd55a0d67c9cbc0 /source/blender/blenloader | |
parent | f55c46ca65155366d9f63b431c81236c9541cc69 (diff) |
temp-sculpt-colors: make requested changes
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_300.c | 98 |
1 files changed, 50 insertions, 48 deletions
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 5923f0eabf9..c675bc97d82 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -2437,54 +2437,6 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - /* Rebuild active/render color attribute references. */ - if (!MAIN_VERSION_ATLEAST(bmain, 302, 6)) { - LISTBASE_FOREACH (Brush *, br, &bmain->brushes) { - /* buggy code in wm_toolsystem broke smear in old files, - reset to defaults */ - if (br->sculpt_tool == SCULPT_TOOL_SMEAR) { - br->alpha = 1.0f; - br->spacing = 5; - br->flag &= ~BRUSH_ALPHA_PRESSURE; - br->flag &= ~BRUSH_SPACE_ATTEN; - br->curve_preset = BRUSH_CURVE_SPHERE; - } - } - - LISTBASE_FOREACH (Mesh *, me, &bmain->meshes) { - for (int step = 0; step < 2; step++) { - CustomDataLayer *actlayer = NULL; - - int vact1, vact2; - - if (step) { - vact1 = CustomData_get_render_layer_index(&me->vdata, CD_PROP_COLOR); - vact2 = CustomData_get_render_layer_index(&me->ldata, CD_MLOOPCOL); - } - else { - vact1 = CustomData_get_active_layer_index(&me->vdata, CD_PROP_COLOR); - vact2 = CustomData_get_active_layer_index(&me->ldata, CD_MLOOPCOL); - } - - if (vact1 != -1) { - actlayer = me->vdata.layers + vact1; - } - else if (vact2 != -1) { - actlayer = me->ldata.layers + vact2; - } - - if (actlayer) { - if (step) { - BKE_id_attributes_render_color_set(&me->id, actlayer); - } - else { - BKE_id_attributes_active_color_set(&me->id, actlayer); - } - } - } - } - } - if (!MAIN_VERSION_ATLEAST(bmain, 302, 7)) { /* Generate 'system' liboverrides IDs. * NOTE: This is a fairly rough process, based on very basic heuristics. Should be enough for a @@ -2537,6 +2489,56 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } + + /* Rebuild active/render color attribute references. */ + if (!MAIN_VERSION_ATLEAST(bmain, 302, 8)) { + LISTBASE_FOREACH (Brush *, br, &bmain->brushes) { + /* While vertex-colors were experimental the smear tool became corrupt due + * to bugs in the wm_toolsystem API (auto-creation of sculpt brushes + * was broken) so its values must be reset. */ + if (br->sculpt_tool == SCULPT_TOOL_SMEAR) { + br->alpha = 1.0f; + br->spacing = 5; + br->flag &= ~BRUSH_ALPHA_PRESSURE; + br->flag &= ~BRUSH_SPACE_ATTEN; + br->curve_preset = BRUSH_CURVE_SPHERE; + } + } + + LISTBASE_FOREACH (Mesh *, me, &bmain->meshes) { + for (int step = 0; step < 2; step++) { + CustomDataLayer *actlayer = NULL; + + int vact1, vact2; + + if (step) { + vact1 = CustomData_get_render_layer_index(&me->vdata, CD_PROP_COLOR); + vact2 = CustomData_get_render_layer_index(&me->ldata, CD_MLOOPCOL); + } + else { + vact1 = CustomData_get_active_layer_index(&me->vdata, CD_PROP_COLOR); + vact2 = CustomData_get_active_layer_index(&me->ldata, CD_MLOOPCOL); + } + + if (vact1 != -1) { + actlayer = me->vdata.layers + vact1; + } + else if (vact2 != -1) { + actlayer = me->ldata.layers + vact2; + } + + if (actlayer) { + if (step) { + BKE_id_attributes_render_color_set(&me->id, actlayer); + } + else { + BKE_id_attributes_active_color_set(&me->id, actlayer); + } + } + } + } + } + /** * Versioning code until next subversion bump goes here. * |