[Bf-blender-cvs] [645aee08354] sculpt-dev: Fix small crash in last commit and a few typos

Joseph Eagar noreply at git.blender.org
Mon Sep 20 12:34:41 CEST 2021


Commit: 645aee083543670cf3bab1766b689a6113b81fc8
Author: Joseph Eagar
Date:   Mon Sep 20 03:34:13 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB645aee083543670cf3bab1766b689a6113b81fc8

Fix small crash in last commit and a few typos

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

M	source/blender/blenkernel/intern/brush.c
M	source/blender/blenkernel/intern/brush_engine.c
M	source/blender/editors/sculpt_paint/sculpt.c

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

diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 11269cd97ca..d0dc92ddd6c 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -2492,6 +2492,10 @@ void BKE_brush_size_set(Scene *scene, Brush *brush, int size, bool use_brush_cha
 
 int BKE_brush_size_get(const Scene *scene, const Brush *brush, bool use_brush_channel)
 {
+  if (!scene->toolsettings->sculpt || !scene->toolsettings->sculpt->channels || !brush->channels) {
+    use_brush_channel = false;
+  }
+
   if (use_brush_channel) {
     if (scene->toolsettings->sculpt) {
       return (int)BKE_brush_channelset_get_final_float(
diff --git a/source/blender/blenkernel/intern/brush_engine.c b/source/blender/blenkernel/intern/brush_engine.c
index df09d2942a2..550751cad83 100644
--- a/source/blender/blenkernel/intern/brush_engine.c
+++ b/source/blender/blenkernel/intern/brush_engine.c
@@ -1069,7 +1069,7 @@ ATTR_NO_OPT void BKE_builtin_commandlist_create(Brush *brush,
   float autosmooth_scale = BKE_brush_channelset_get_float(
       chset, "autosmooth_radius_scale", mapdata);
   float autosmooth_projection = BKE_brush_channelset_get_float(
-      chset, "topology_rake_projection", NULL);
+      chset, "autosmooth_projection", NULL);
 
   float autosmooth_spacing;
 
@@ -1109,7 +1109,7 @@ ATTR_NO_OPT void BKE_builtin_commandlist_create(Brush *brush,
 
   if (topology_rake > 0.0f) {
     cmd = BKE_brush_command_init(BKE_brush_commandlist_add(cl, brush->channels, true),
-                                 SCULPT_TOOL_SMOOTH);
+                                 SCULPT_TOOL_TOPOLOGY_RAKE);
 
     float_set_uninherit(cmd->params, "strength", topology_rake);
     float_set_uninherit(cmd->params, "radius", radius * topology_rake_scale);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 14cd7b6df2d..53a8c6d678c 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -11267,6 +11267,15 @@ void sculpt_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerR
     BKE_brush_channelset_free(ss->cache->channels_final);
   }
 
+  if (!brush->channels) {
+    // eek!
+    printf("had to create brush->channels for brush '%s'!", brush->id.name + 2);
+
+    brush->channels = BKE_brush_channelset_create();
+    BKE_brush_builtin_patch(brush, brush->sculpt_tool);
+    BKE_brush_channelset_compat_load(brush->channels, brush, true);
+  }
+
   if (brush->channels && sd->channels) {
     ss->cache->channels_final = BKE_brush_channelset_create();
     BKE_brush_channelset_merge(ss->cache->channels_final, brush->channels, sd->channels);



More information about the Bf-blender-cvs mailing list