Commit: 0828fbfa38674ddf6f6bb173dd5ab75bd33998ec
Author: mattoverby
Date: Wed Aug 12 15:34:05 2020 -0500
Branches: soc-2020-soft-body
https://developer.blender.org/rB0828fbfa38674ddf6f6bb173dd5ab75bd33998ec
cleaned up ui params
===================================================================
M intern/softbody/admmpd_api.cpp
M release/scripts/startup/bl_ui/properties_physics_softbody.py
M source/blender/blenkernel/intern/softbody.c
M source/blender/makesdna/DNA_object_force_types.h
M source/blender/makesrna/intern/rna_object_force.c
===================================================================
diff --git a/intern/softbody/admmpd_api.cpp b/intern/softbody/admmpd_api.cpp
index 2da12e91c6b..a405526d5f5 100644
--- a/intern/softbody/admmpd_api.cpp
+++ b/intern/softbody/admmpd_api.cpp
@@ -316,7 +316,7 @@ int admmpd_mesh_needs_update(ADMMPDInterfaceData *iface,
Object *ob)
if (!mesh) { return 0; }
// Mode or topology change?
- int mode = ob->soft->admmpd_init_mode;
+ int mode = ob->soft->admmpd_mesh_mode;
int mesh_type = iface->idata->mesh->type();
if (mode != mesh_type) { return 1; }
if (!iface->idata->mesh->rest_facet_verts()) { return 1; }
@@ -335,7 +335,7 @@ int admmpd_update_mesh(ADMMPDInterfaceData *iface, Object
*ob, float (*vertexCos
if (!iface->idata)
iface->idata =
(ADMMPDInternalData*)MEM_callocN(sizeof(ADMMPDInternalData), "ADMMPD_idata");
- int mode = ob->soft->admmpd_init_mode;
+ int mode = ob->soft->admmpd_mesh_mode;
iface->idata->mesh.reset();
// Try to initialize the mesh
diff --git a/release/scripts/startup/bl_ui/properties_physics_softbody.py
b/release/scripts/startup/bl_ui/properties_physics_softbody.py
index acaea6869f7..65475b97666 100644
--- a/release/scripts/startup/bl_ui/properties_physics_softbody.py
+++ b/release/scripts/startup/bl_ui/properties_physics_softbody.py
@@ -58,7 +58,8 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel, Panel):
if softbody.solver_mode=='LEGACY':
layout.prop(softbody, "collision_collection")
-
+ elif softbody.solver_mode=='ADMMPD':
+ layout.prop(softbody, "admmpd_mesh_mode")
class PHYSICS_PT_softbody_object(PhysicButtonsPanel, Panel):
bl_label = "Object"
@@ -92,17 +93,18 @@ class PHYSICS_PT_softbody_object(PhysicButtonsPanel, Panel):
elif softbody.solver_mode=='ADMMPD':
col = flow.column()
- col.prop(softbody, "admmpd_init_mode")
- col.prop(softbody, "admmpd_material")
- col.prop(softbody, "admmpd_embed_res")
+
+ if softbody.admmpd_mesh_mode == 'EMBEDDED':
+ col.prop(softbody, "admmpd_material")
+
col.prop(softbody, "admmpd_youngs_exp")
col.prop(softbody, "admmpd_poisson")
col.prop(softbody, "admmpd_density_kgm3")
- if softbody.admmpd_init_mode == 'CLOTH':
- col.prop(softbody, "admmpd_strainlimit_min")
+ if softbody.admmpd_mesh_mode == 'CLOTH':
col.prop(softbody, "admmpd_strainlimit_max")
-
+ elif softbody.admmpd_mesh_mode == 'EMBEDDED':
+ col.prop(softbody, "admmpd_embed_res")
class PHYSICS_PT_softbody_simulation(PhysicButtonsPanel, Panel):
@@ -338,7 +340,7 @@ class
PHYSICS_PT_softbody_admmpdcollision(PhysicButtonsPanel, Panel):
def poll(cls, context):
md = context.soft_body
softbody = md.settings
- return (softbody.solver_mode=='ADMMPD')
+ return (softbody.solver_mode=='ADMMPD' and softbody.admmpd_mesh_mode
== 'EMBEDDED')
def draw(self, context):
layout = self.layout
diff --git a/source/blender/blenkernel/intern/softbody.c
b/source/blender/blenkernel/intern/softbody.c
index 7ec047b5593..9851c7162ee 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -3124,7 +3124,7 @@ SoftBody *sbNew(Scene *scene)
sb = MEM_callocN(sizeof(SoftBody), "softbody");
sb->solver_mode = SOLVER_MODE_ADMMPD;
- sb->admmpd_init_mode = 0; // embedded
+ sb->admmpd_mesh_mode = 0; // embedded
sb->admmpd_substeps = 1;
sb->admmpd_max_admm_iters = 20;
sb->admmpd_self_collision = 0;
@@ -3138,8 +3138,8 @@ SoftBody *sbNew(Scene *scene)
sb->admmpd_pk_exp = 4;
sb->admmpd_floor_z = -999;
sb->admmpd_gravity = -9.8;
- sb->admmpd_strainlimit_min = 0; // no compression limit
- sb->admmpd_strainlimit_max = 100; // 100x stretch limit
+ sb->admmpd_strainlimit_min = 0; // no compression
+ sb->admmpd_strainlimit_max = 100; // 100x stretch
sb->admmpd_maxthreads = -1;
sb->admmpd_loglevel = 1; // low
sb->admmpd_linsolver = 1; // PCG
diff --git a/source/blender/makesdna/DNA_object_force_types.h
b/source/blender/makesdna/DNA_object_force_types.h
index 6220f3aba29..163ab9c17a8 100644
--- a/source/blender/makesdna/DNA_object_force_types.h
+++ b/source/blender/makesdna/DNA_object_force_types.h
@@ -217,7 +217,7 @@ typedef struct SoftBody {
/* ADMM-PD settings */
int solver_mode; // 0=legacy, 1=admmpd
- int admmpd_init_mode; // 0=embedded, 1=tetgen
+ int admmpd_mesh_mode; // 0=embedded, 1=tetgen, 2=cloth
int admmpd_substeps; // break time step into smaller bits
int admmpd_max_admm_iters; // max solver iterations
int admmpd_self_collision; // 0 or 1
diff --git a/source/blender/makesrna/intern/rna_object_force.c
b/source/blender/makesrna/intern/rna_object_force.c
index eabbe37e791..0dc0b1857af 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -1850,8 +1850,8 @@ static void rna_def_softbody(BlenderRNA *brna)
/* ADMM-PD settings */
- prop = RNA_def_property(srna, "admmpd_init_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "admmpd_init_mode");
+ prop = RNA_def_property(srna, "admmpd_mesh_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "admmpd_mesh_mode");
RNA_def_property_enum_items(prop, admmpd_initmode_items);
RNA_def_property_ui_text(prop, "Mesh Mode", "ADMM-PD initialization mode");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@@ -1908,16 +1908,10 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_softbody_update");
- prop = RNA_def_property(srna, "admmpd_strainlimit_min", PROP_FLOAT,
PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "admmpd_strainlimit_min");
- RNA_def_property_range(prop, 0.0f, 1.f);
- RNA_def_property_ui_text(prop, "Min Strain Limit", "Limits compression:
higher reduces compression");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
prop = RNA_def_property(srna, "admmpd_strainlimit_max", PROP_FLOAT,
PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "admmpd_strainlimit_max");
RNA_def_property_range(prop, 1.0f, 100.f);
- RNA_def_property_ui_text(prop, "Max Strain Limit", "Limits stetch: lower
reduces stretching");
+ RNA_def_property_ui_text(prop, "Strain Limit", "Limits stetch: lower reduces
stretching");
RNA_def_property_update(prop, 0, "rna_softbody_update");
prop = RNA_def_property(srna, "admmpd_loglevel", PROP_ENUM, PROP_NONE);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs