[Bf-blender-cvs] [134eccf5bf2] sculpt-dev: Merge branch 'master' into sculpt-dev

Joseph Eagar noreply at git.blender.org
Tue Dec 21 17:35:07 CET 2021


Commit: 134eccf5bf2d30639bd9d0953de569d6d518a059
Author: Joseph Eagar
Date:   Mon Dec 20 14:37:48 2021 -0500
Branches: sculpt-dev
https://developer.blender.org/rB134eccf5bf2d30639bd9d0953de569d6d518a059

Merge branch 'master' into sculpt-dev

===================================================================



===================================================================

diff --cc source/blender/blenloader/intern/versioning_300.c
index 141daa2f023,6b22d2f97e9..4a64180c9de
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@@ -2571,518 -2503,4 +2571,534 @@@ void blo_do_versions_300(FileData *fd, 
      }
      FOREACH_NODETREE_END;
    }
 +
 +  if (!MAIN_VERSION_ATLEAST(bmain, 300, 24)) {
 +    LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
 +      // load old brush settings into channels
 +      if (brush->channels) {
 +        BKE_brush_channelset_free(brush->channels);
 +        brush->channels = NULL;
 +      }
 +
 +      BKE_brush_builtin_create(brush, brush->sculpt_tool);
 +      BKE_brush_channelset_compat_load(brush->channels, brush, true);
 +    }
 +  }
 +
 +  if (!MAIN_VERSION_ATLEAST(bmain, 300, 32)) {
 +    LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
 +      BKE_brush_channelset_ui_init(brush, brush->sculpt_tool);
 +
 +      if (ELEM(brush->sculpt_tool, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_STRIPS) && brush->channels) {
 +        BRUSHSET_SET_BOOL(brush->channels, autosmooth_use_spacing, true);
 +        BRUSHSET_SET_FLOAT(brush->channels, autosmooth_spacing, 7.0f);
 +
 +        BRUSHSET_LOOKUP(brush->channels, radius)->mappings[BRUSH_MAPPING_PRESSURE].flag =
 +            BRUSH_MAPPING_ENABLED;
 +        BRUSHSET_LOOKUP(brush->channels, strength)->mappings[BRUSH_MAPPING_PRESSURE].flag =
 +            BRUSH_MAPPING_ENABLED;
 +
 +        if (brush->sculpt_tool == SCULPT_TOOL_CLAY_STRIPS) {
 +          if (BRUSHSET_GET_FLOAT(brush->channels, tip_roundness, NULL) == 0.0f) {
 +            BRUSHSET_SET_FLOAT(brush->channels, tip_roundness, 0.18f);
 +          }
 +
 +          BRUSHSET_LOOKUP(brush->channels, tip_roundness)->flag |= BRUSH_CHANNEL_SHOW_IN_WORKSPACE;
 +          BRUSHSET_SET_BOOL(brush->channels, use_space_attenuation, false);
 +        }
 +
 +        BRUSHSET_LOOKUP(brush->channels, plane_offset)->flag |= BRUSH_CHANNEL_SHOW_IN_WORKSPACE;
 +
 +        void reset_clay_mappings(BrushChannelSet * chset, bool strips);
 +        reset_clay_mappings(brush->channels, brush->sculpt_tool == SCULPT_TOOL_CLAY_STRIPS);
 +      }
 +    }
 +  }
 +
 +  if (!MAIN_VERSION_ATLEAST(bmain, 300, 33)) {
 +    LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
 +      if (brush->channels && brush->sculpt_tool == SCULPT_TOOL_SMOOTH) {
 +        BRUSHSET_SET_BOOL(brush->channels, dyntopo_disabled, true);
 +        BKE_brush_channelset_ui_init(brush, brush->sculpt_tool);
 +      }
 +    }
 +  }
 +
 +  if (!MAIN_VERSION_ATLEAST(bmain, 300, 34)) {
 +    LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
 +      if (brush->channels && brush->sculpt_tool == SCULPT_TOOL_SMEAR) {
 +        BRUSHSET_SET_BOOL(brush->channels, use_space_attenuation, false);
 +        BKE_brush_channelset_ui_init(brush, brush->sculpt_tool);
 +      }
 +    }
 +  }
 +
 +  if (!MAIN_VERSION_ATLEAST(bmain, 300, 35)) {
 +    LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
 +      BKE_brush_channelset_ui_init(brush, brush->sculpt_tool);
 +    }
 +  }
 +
 +  if (!MAIN_VERSION_ATLEAST(bmain, 300, 27)) {
 +    LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
 +      if (brush->channels) {
 +        BKE_brush_channelset_ui_init(brush, brush->sculpt_tool);
 +      }
 +    }
 +  }
 +
 +  if (!MAIN_VERSION_ATLEAST(bmain, 300, 36)) {
 +    LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
 +      if (brush->channels && brush->sculpt_tool == SCULPT_TOOL_CLOTH) {
 +        BKE_brush_channelset_ui_init(brush, brush->sculpt_tool);
 +      }
 +      else if (brush->channels &&
 +               ELEM(brush->sculpt_plane, SCULPT_TOOL_PAINT, SCULPT_TOOL_SMEAR)) {
 +        BKE_brush_channelset_ui_init(brush, brush->sculpt_tool);
 +        BRUSHSET_SET_BOOL(brush->channels, dyntopo_disabled, true);
 +      }
 +    }
 +  }
 +
 +  if (!MAIN_VERSION_ATLEAST(bmain, 300, 37)) {
 +    LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
 +      if (!brush->channels) {
 +        continue;
 +      }
 +
 +      BrushChannel *ch;
 +      ch = BRUSHSET_LOOKUP(brush->channels, hue_offset);
 +
 +      if (ch) {
 +        BKE_brush_mapping_reset(ch, brush->sculpt_tool, BRUSH_MAPPING_PRESSURE);
 +      }
 +
 +      LISTBASE_FOREACH (BrushChannel *, ch, &brush->channels->channels) {
 +        if (!ch->mappings[BRUSH_MAPPING_RANDOM].factor) {
 +          ch->mappings[BRUSH_MAPPING_RANDOM].factor = 1.0f;
 +        }
 +
 +        for (int i = 0; i < BRUSH_MAPPING_MAX; i++) {
 +          if (ch->mappings[i].blendmode == MA_RAMP_BLEND) {
 +            ch->mappings[i].blendmode = MA_RAMP_MULT;
 +          }
 +
 +          if (ch->mappings[i].min == ch->mappings[i].max) {
 +            ch->mappings[i].min = 0.0f;
 +            ch->mappings[i].max = 1.0f;
 +          }
 +        }
 +      }
 +    }
 +  }
 +
 +  if (!MAIN_VERSION_ATLEAST(bmain, 300, 38)) {
 +    LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
 +      if (!scene->toolsettings || !scene->toolsettings->sculpt ||
 +          !scene->toolsettings->sculpt->channels) {
 +        continue;
 +      }
 +
 +      Sculpt *sd = scene->toolsettings->sculpt;
 +
 +      LISTBASE_FOREACH (BrushChannel *, ch, &sd->channels->channels) {
 +        if (!ch->mappings[BRUSH_MAPPING_RANDOM].factor) {
 +          ch->mappings[BRUSH_MAPPING_RANDOM].factor = 1.0f;
 +        }
 +
 +        for (int i = 0; i < BRUSH_MAPPING_MAX; i++) {
 +          if (ch->mappings[i].premultiply == 0.0f) {
 +            ch->mappings[i].premultiply = 1.0f;
 +          }
 +
 +          if (ch->mappings[i].blendmode == MA_RAMP_BLEND) {
 +            ch->mappings[i].blendmode = MA_RAMP_MULT;
 +          }
 +
 +          ch->mappings[i].func_cutoff = 0.5f;
 +
 +          if (ch->mappings[i].min == ch->mappings[i].max) {
 +            ch->mappings[i].min = 0.0f;
 +            ch->mappings[i].max = 1.0f;
 +          }
 +        }
 +
 +        BrushMapping *mp = ch->mappings + BRUSH_MAPPING_STROKE_T;
 +
 +        mp->max = 1.0f;
 +        mp->factor = 1.0f;
 +        mp->blendmode = MA_RAMP_MULT;
 +        mp->mapfunc = BRUSH_MAPFUNC_COS;
 +      }
 +    }
 +
 +    LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
 +      if (!brush->channels) {
 +        continue;
 +      }
 +
 +      if (brush->sculpt_tool == SCULPT_TOOL_PAINT) {
 +        BRUSHSET_SET_BOOL(brush->channels, use_space_attenuation, false);
 +      }
 +
 +      LISTBASE_FOREACH (BrushChannel *, ch, &brush->channels->channels) {
 +        for (int i = 0; i < BRUSH_MAPPING_MAX; i++) {
 +          ch->mappings[i].premultiply = 1.0f;
 +        }
 +
 +        BrushMapping *mp = ch->mappings + BRUSH_MAPPING_STROKE_T;
 +
 +        mp->func_cutoff = 0.5f;
 +        mp->blendmode = MA_RAMP_MULT;
 +        mp->max = 1.0f;
 +        mp->mapfunc = BRUSH_MAPFUNC_COS;
 +        mp->factor = 1.0f;
 +      }
 +    }
 +  }
 +
 +  if (!MAIN_VERSION_ATLEAST(bmain, 300, 39)) {
 +    LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
 +      if (!scene->toolsettings || !scene->toolsettings->sculpt ||
 +          !scene->toolsettings->sculpt->channels) {
 +        continue;
 +      }
 +
 +      Sculpt *sd = scene->toolsettings->sculpt;
 +      BKE_brush_check_toolsettings(sd);
 +
 +      BKE_brush_mapping_inherit_all(BRUSHSET_LOOKUP(sd->channels, smooth_strength_factor));
 +      BKE_brush_mapping_inherit_all(BRUSHSET_LOOKUP(sd->channels, smooth_strength_projection));
 +    }
 +
 +    LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
 +      if (!brush->channels) {
 +        continue;
 +      }
 +
 +      BrushChannel *ch;
 +      if ((ch = BRUSHSET_LOOKUP(brush->channels, smooth_strength_factor))) {
 +        BKE_brush_mapping_inherit_all(ch);
 +      }
 +      if ((ch = BRUSHSET_LOOKUP(brush->channels, smooth_strength_projection))) {
 +        BKE_brush_mapping_inherit_all(ch);
 +      }
 +    }
 +
 +    if (!MAIN_VERSION_ATLEAST(bmain, 300, 39)) {
 +      LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
 +        if (brush->channels && brush->sculpt_tool == SCULPT_TOOL_SLIDE_RELAX) {
 +          BKE_brush_channelset_ui_init(brush, SCULPT_TOOL_SLIDE_RELAX);
 +        }
 +      }
 +
 +      if (!DNA_struct_elem_find(
 +              fd->filesdna, "View3DOverlay", "float", "sculpt_mode_face_sets_moire_scale")) {
 +        for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
 +          LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
 +            LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
 +              if (sl->spacetype == SPACE_VIEW3D) {
 +                View3D *v3d = (View3D *)sl;
 +                v3d->overlay.sculpt_mode_face_sets_moire_scale = 0.45f;
 +              }
 +            }
 +          }
 +        }
 +      }
 +    }
 +  }
 +
 +  /* patch brush channel show in header flags */
 +  if (!MAIN_VERSION_ATLEAST(bmain, 300, 40)) {
 +    LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
 +      if (!brush->channels) {
 +        continue;
 +      }
 +
 +      /* copy brush channels*/
 +      BrushChannelSet *chset = BKE_brush_channelset_copy(brush->channels);
 +      Brush temp = *brush;
 +      temp.channels = chset;
 +
 +      BKE_brush_channelset_ui_init(&temp, temp.sculpt_tool);
 +
 +      LISTBASE_FOREACH (BrushChannel *, ch1, &brush->channels->channels) {
 +        BrushChannel *ch2 = BKE_brush_channelset_lookup(chset, ch1->idname);
 +
 +        if (!ch2) {
 +          printf("failed to find brush channel %s\n", ch1->idname);
 +          continue;
 +        }
 +
 +        ch1->flag |= ch2->flag &
 +                     (BRUSH_CHANNEL_SHOW_IN_HEADER | BRUSH_CHANNEL_SHOW_IN_CONTEXT_MENU);
 +      }
 +
 +      BKE_brush_channelset_free(chset);
 +    }
 +  }
 +
 +  if (!MAIN_VERSION_ATLEAST(bmain, 301, 2)) {
 +    LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
 +      if (!brush->channels) {
 +        continue;
 +      }
 +
 +      BrushChannelSet *chset = brush->channels;
 +      BrushChannel *ch;
 +
 +      for (int i = 0; i < 2; i++) {
 +        ch = i ? BRUSHSET_LOOKUP(chset, smooth_strength_projection) :
 +                 BRUSHSET_LOOKUP(chset, smooth_strength_factor);
 +
 +        for (int i = 0; i < BRUSH_MAPPING_MAX; i++) {
 +          ch->mappings[i].in

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list