From 70a934770521b538b98b8a3e27739ae6a643ebfa Mon Sep 17 00:00:00 2001 From: Pablo Dobarro Date: Thu, 12 Sep 2019 03:54:12 +0200 Subject: 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 --- source/blender/blenloader/intern/versioning_280.c | 4 ++-- source/blender/editors/sculpt_paint/sculpt.c | 2 +- source/blender/makesdna/DNA_brush_types.h | 2 +- source/blender/makesrna/intern/rna_brush.c | 14 ++++++++------ 4 files changed, 12 insertions(+), 10 deletions(-) (limited to 'source') 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); -- cgit v1.2.3