[Bf-blender-cvs] [70a93477052] master: Fix T69737: Crash using the Elastic Deform brush and Compressibility

Pablo Dobarro noreply at git.blender.org
Thu Sep 12 03:54:53 CEST 2019


Commit: 70a934770521b538b98b8a3e27739ae6a643ebfa
Author: Pablo Dobarro
Date:   Thu Sep 12 03:54:12 2019 +0200
Branches: master
https://developer.blender.org/rB70a934770521b538b98b8a3e27739ae6a643ebfa

Fix T69737: Crash using the Elastic Deform brush and Compressibility

Also renamed "compressibility" to "volume preservation"

Reviewed By: brecht

Maniphest Tasks: T69737

Differential Revision: https://developer.blender.org/D5757

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

M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/makesdna/DNA_brush_types.h
M	source/blender/makesrna/intern/rna_brush.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index ff3cbb08aab..ccd777f799c 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -422,7 +422,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
                 row = col.row()
                 row.prop(brush, "elastic_deform_type")
                 row = col.row()
-                row.prop(brush, "elastic_deform_compressibility", slider=True)
+                row.prop(brush, "elastic_deform_volume_preservation", slider=True)
 
             col.separator()
             row = col.row()
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index d06da062d49..2615c17ace5 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3836,8 +3836,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
 
     /* Elatic deform brush */
     for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
-      if (br->ob_mode & OB_MODE_SCULPT && br->elastic_deform_compressibility == 0.0f) {
-        br->elastic_deform_compressibility = 0.5f;
+      if (br->ob_mode & OB_MODE_SCULPT && br->elastic_deform_volume_preservation == 0.0f) {
+        br->elastic_deform_volume_preservation = 0.5f;
       }
     }
   }
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index df499c28125..afbe7e14794 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3345,7 +3345,7 @@ static void do_elastic_deform_brush_task_cb_ex(void *__restrict userdata,
   radius_scaled[2] = radius_scaled[1] * radius_e[2];
 
   float shear_modulus = 1.0f;
-  float poisson_ratio = brush->elastic_deform_compressibility;
+  float poisson_ratio = brush->elastic_deform_volume_preservation;
 
   float a = 1.0f / (4.0f * (float)M_PI * shear_modulus);
   float b = a / (4.0f * (1.0f - poisson_ratio));
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 450788dc81d..957f5b75974 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -322,7 +322,7 @@ typedef struct Brush {
   char _pad1[4];
 
   int elastic_deform_type;
-  float elastic_deform_compressibility;
+  float elastic_deform_volume_preservation;
 
   /* overlay */
   int texture_overlay_alpha;
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 182b9bc2e01..b5f4582d844 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -1837,12 +1837,14 @@ static void rna_def_brush(BlenderRNA *brna)
       prop, "Normal Weight", "How much grab will pull vertexes out of surface during a grab");
   RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-  prop = RNA_def_property(srna, "elastic_deform_compressibility", PROP_FLOAT, PROP_NONE);
-  RNA_def_property_float_sdna(prop, NULL, "elastic_deform_compressibility");
-  RNA_def_property_range(prop, 0.0f, 1.0f);
-  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01f, 3);
-  RNA_def_property_ui_text(
-      prop, "Compressibility", "Material compressibility when simulating the elasticity");
+  prop = RNA_def_property(srna, "elastic_deform_volume_preservation", PROP_FLOAT, PROP_NONE);
+  RNA_def_property_float_sdna(prop, NULL, "elastic_deform_volume_preservation");
+  RNA_def_property_range(prop, 0.0f, 0.9f);
+  RNA_def_property_ui_range(prop, 0.0f, 0.9f, 0.01f, 3);
+  RNA_def_property_ui_text(prop,
+                           "Volume Preservation",
+                           "Poisson ratio for elastic deformation. Higher values preserve volume "
+                           "more, but also lead to more bulging");
   RNA_def_property_update(prop, 0, "rna_Brush_update");
 
   prop = RNA_def_property(srna, "rake_factor", PROP_FLOAT, PROP_FACTOR);



More information about the Bf-blender-cvs mailing list