[Bf-blender-cvs] [a6c0ab8cb5] cloth-improvements: UI Cleanup: Add dedicated cloth shape panel
Luca Rood
noreply at git.blender.org
Sat Jan 7 05:10:05 CET 2017
Commit: a6c0ab8cb5c393ca07dda7b2406a9b43e188f57c
Author: Luca Rood
Date: Sat Jan 7 00:38:09 2017 -0200
Branches: cloth-improvements
https://developer.blender.org/rBa6c0ab8cb5c393ca07dda7b2406a9b43e188f57c
UI Cleanup: Add dedicated cloth shape panel
===================================================================
M release/scripts/startup/bl_ui/properties_physics_cloth.py
M source/blender/blenkernel/intern/cloth.c
M source/blender/makesdna/DNA_cloth_types.h
M source/blender/makesrna/intern/rna_cloth.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py
index 94c7197b97..e5ee33cdc4 100644
--- a/release/scripts/startup/bl_ui/properties_physics_cloth.py
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -146,16 +146,6 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel):
row.prop(cloth, "bending_plasticity", text="")
row.prop(cloth, "bending_yield_factor", text="")
- layout.separator()
-
- split = layout.split()
-
- col = split.column()
-
- col.label("Pinning:")
- col.prop_search(cloth, "vertex_group_mass", ob, "vertex_groups", text="")
- col.prop(cloth, "pin_stiffness", text="Stiffness")
-
# Disabled for now
"""
if cloth.vertex_group_mass:
@@ -167,18 +157,6 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel):
col.prop(cloth, "goal_friction", text="Friction")
"""
- col = split.column()
-
- col.prop(cloth, "use_dynamic_mesh", text="Dynamic Mesh")
-
- key = ob.data.shape_keys
-
- if key:
- sub = col.column()
- sub.active = not cloth.use_dynamic_mesh
- sub.label(text="Rest Shape Key:")
- sub.prop_search(cloth, "rest_shape_key", key, "key_blocks", text="")
-
class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, Panel):
bl_label = "Cloth Cache"
@@ -190,6 +168,51 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, Panel):
point_cache_ui(self, context, md.point_cache, cloth_panel_enabled(md), 'CLOTH')
+class PHYSICS_PT_cloth_shape(PhysicButtonsPanel, Panel):
+ bl_label = "Cloth Shape"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ md = context.cloth
+ ob = context.object
+ cloth = context.cloth.settings
+
+ layout.active = cloth_panel_enabled(md)
+
+ split = layout.split(percentage=0.3, align=True)
+
+ split.label("Pinning:")
+
+ split.prop_search(cloth, "vertex_group_mass", ob, "vertex_groups", text="")
+
+ sub = split.row(align=True)
+ sub.active = cloth.vertex_group_mass != ""
+ sub.prop(cloth, "pin_stiffness", text="Stiffness")
+
+ split = layout.split(percentage=0.3)
+ split.prop(cloth, "use_sewing_springs", text="Sewing:")
+
+ sub = split.column()
+ sub.active = cloth.use_sewing_springs
+ sub.prop(cloth, "sewing_force_max", text="Sewing Force")
+
+ row = layout.row()
+ row.prop(cloth, "shrinking", text="Shrinking")
+ row.prop(cloth, "rest_planarity_factor", text="Flattening")
+
+ layout.prop(cloth, "use_dynamic_mesh", text="Dynamic Mesh")
+
+ key = ob.data.shape_keys
+
+ if key:
+ sub = layout.column()
+ sub.active = not cloth.use_dynamic_mesh
+ sub.prop_search(cloth, "rest_shape_key", key, "key_blocks")
+
+
class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, Panel):
bl_label = "Cloth Collision"
bl_options = {'DEFAULT_CLOSED'}
@@ -277,40 +300,6 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, Panel):
row.prop(cloth, "bending_stiffness_max", text="Max")
-class PHYSICS_PT_cloth_sewing(PhysicButtonsPanel, Panel):
- bl_label = "Cloth Sewing Springs"
- bl_options = {'DEFAULT_CLOSED'}
- COMPAT_ENGINES = {'BLENDER_RENDER'}
-
- def draw_header(self, context):
- cloth = context.cloth.settings
-
- self.layout.active = cloth_panel_enabled(context.cloth)
- self.layout.prop(cloth, "use_sewing_springs", text="")
-
- def draw(self, context):
- layout = self.layout
-
- md = context.cloth
- ob = context.object
- cloth = context.cloth.settings
-
- layout.active = (cloth.use_sewing_springs and cloth_panel_enabled(md))
-
- layout.prop(cloth, "sewing_force_max", text="Sewing Force")
-
- split = layout.split()
-
- col = split.column(align=True)
- col.label(text="Shrinking:")
- col.prop_search(cloth, "vertex_group_shrink", ob, "vertex_groups", text="")
-
- col = split.column(align=True)
- col.label()
- col.prop(cloth, "shrink_min", text="Min")
- col.prop(cloth, "shrink_max", text="Max")
-
-
class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, Panel):
bl_label = "Cloth Field Weights"
bl_options = {'DEFAULT_CLOSED'}
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index d30ce9fce0..27addb1434 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -106,7 +106,8 @@ void cloth_init(ClothModifierData *clmd )
clmd->sim_parms->maxspringlen = 10;
clmd->sim_parms->vgroup_mass = 0;
clmd->sim_parms->vgroup_shrink = 0;
- clmd->sim_parms->shrink_min = 0.0f; /* min amount the fabric will shrink by 0.0 = no shrinking, 1.0 = shrink to nothing*/
+ clmd->sim_parms->shrink = 0.0f; /* min amount the fabric will shrink by 0.0 = no shrinking, 1.0 = shrink to nothing*/
+ clmd->sim_parms->max_shrink = 0.0f;
clmd->sim_parms->avg_spring_len = 0.0;
clmd->sim_parms->presets = 2; /* cotton as start setting */
clmd->sim_parms->timescale = 1.0f; /* speed factor, describes how fast cloth moves */
@@ -394,7 +395,7 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
cloth_apply_vgroup ( clmd, result );
if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_DYNAMIC_BASEMESH) ||
- (clmd->sim_parms->vgroup_shrink > 0) || (clmd->sim_parms->shrink_min > 0.0f))
+ (clmd->sim_parms->vgroup_shrink > 0) || (clmd->sim_parms->shrink > 0.0f))
{
cloth_update_spring_lengths ( clmd, result );
}
@@ -783,8 +784,8 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
static float cloth_shrink_factor(ClothModifierData *clmd, ClothVertex *verts, int i1, int i2)
{
/* linear interpolation between min and max shrink factor based on weight */
- float base = 1.0f - clmd->sim_parms->shrink_min;
- float delta = clmd->sim_parms->shrink_min - clmd->sim_parms->shrink_max;
+ float base = 1.0f - clmd->sim_parms->shrink;
+ float delta = clmd->sim_parms->shrink - clmd->sim_parms->max_shrink;
float k1 = base + delta * verts[i1].shrink_factor;
float k2 = base + delta * verts[i2].shrink_factor;
diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h
index a2213a67f2..c88c6a0883 100644
--- a/source/blender/makesdna/DNA_cloth_types.h
+++ b/source/blender/makesdna/DNA_cloth_types.h
@@ -80,8 +80,8 @@ typedef struct ClothSimSettings {
float density_strength; /* influence of hair density */
float collider_friction; /* friction with colliders */
float vel_damping; /* damp the velocity to speed up getting to the resting position */
- float shrink_min; /* min amount to shrink cloth by 0.0f (no shrink) - 1.0f (shrink to nothing) */
- float shrink_max; /* max amount to shrink cloth by 0.0f (no shrink) - 1.0f (shrink to nothing) */
+ float shrink; /* min amount to shrink cloth by 0.0f (no shrink) - 1.0f (shrink to nothing) */
+ float max_shrink; /* max amount to shrink cloth by 0.0f (no shrink) - 1.0f (shrink to nothing) */
float struct_plasticity; /* Factor of how much the rest length will change after reaching yield point (0-1) */
float struct_yield_fact; /* Factor of how much length has to change before plastic behavior kicks in (1-inf) */
float bend_plasticity; /* Factor of how much the rest angle will change after reaching yield point (0-1) */
diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c
index 26d144a7e3..e39a94a76c 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -540,14 +540,14 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Shrink Vertex Group", "Vertex Group for shrinking cloth");
RNA_def_property_update(prop, 0, "rna_cloth_update");
- prop = RNA_def_property(srna, "shrink_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "shrink_min");
+ prop = RNA_def_property(srna, "shrinking", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "shrink");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Shrink Factor Min", "Min amount to shrink cloth by");
+ RNA_def_property_ui_text(prop, "Shrink Factor", "Factor by which to shrink cloth");
RNA_def_property_update(prop, 0, "rna_cloth_update");
- prop = RNA_def_property(srna, "shrink_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "shrink_max");
+ prop = RNA_def_property(srna, "shrinking_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_shrink");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Shrink Factor Max", "Max amount to shrink cloth by");
RNA_def_property_update(prop, 0, "rna_cloth_update");
@@ -718,7 +718,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "ShapeKey");
RNA_def_property_pointer_funcs(prop, "rna_ClothSettings_rest_shape_key_get",
"rna_ClothSettings_rest_shape_key_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Rest Shape Key", "Shape key to use the rest spring lengths from");
+ RNA_def_property_ui_text(prop, "Rest Shape Key", "Shape key to use as rest shape");
RNA_def_property_update(prop, 0, "rna_cloth_update");
prop = RNA_def_property(srna, "use_dynamic_mesh", PROP_BOOLEAN, PROP_NONE);
More information about the Bf-blender-cvs
mailing list