[Bf-blender-cvs] [fdfa2045ecd] temp_bmesh_multires: Add a paranoia check

Joseph Eagar noreply at git.blender.org
Fri Apr 2 22:56:00 CEST 2021


Commit: fdfa2045ecd071789a6f2489e4f4272b856711cb
Author: Joseph Eagar
Date:   Fri Apr 2 13:55:48 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rBfdfa2045ecd071789a6f2489e4f4272b856711cb

Add a paranoia check

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

M	source/blender/blenkernel/intern/brush.c

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

diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index ae9a9ca6731..5ec26825b54 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -2592,9 +2592,28 @@ void BKE_brush_get_dyntopo(Brush *brush, Sculpt *sd, DynTopoSettings *out)
 {
   *out = brush->dyntopo;
 
+  // detect unconverted file data
+  if (!out->inherit && !out->detail_range) {
+    //reload default dyntopo settings
+    Brush brush2 = *brush;
+
+    //don't copy heap allocd data
+    brush2.curve = NULL;
+    brush2.icon_imbuf = NULL;
+    brush2.gpencil_settings = NULL;
+    brush2.gradient = NULL;
+    brush2.preview = NULL;
+
+    BKE_brush_sculpt_reset(&brush2);
+
+    brush->dyntopo = *out = brush2.dyntopo;
+
+    brush_free_data((ID*)&brush2);
+  }
+
   int inherit = out->inherit;
 
-  if (out->inherit & DYNTOPO_INHERIT_ALL) {
+  if (inherit & DYNTOPO_INHERIT_ALL) {
     inherit = 0x7FFFFFF;
   }



More information about the Bf-blender-cvs mailing list