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
This commit is contained in:
parent
1e375ab5a1
commit
70a9347705
Notes:
blender-bot
2023-02-14 08:45:12 +01:00
Referenced by issue #69737, Crash using the Elastic Deform brush and Compressibility
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue