Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-08-14 10:43:58 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-08-14 10:43:58 +0400
commit0b23d378fbac8e76d4885c3485a4dbf158aab136 (patch)
tree57fd8f999c5cfd7aed0979a886ae0d43ec977a5a
parent5e968e36c5e0a18c38b064761a4b96dc282cde69 (diff)
fix [#28225] Solidify Modifier creates wrong results when vertex group is attached
infact this is not really a bug, irrespective zero vertex group weights gave overlapping geometry which isn't useful, add an option to set the thickness factor for zero weighted verts.
-rw-r--r--release/scripts/startup/bl_ui/properties_data_mesh.py2
-rw-r--r--release/scripts/startup/bl_ui/properties_data_modifier.py2
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c7
-rw-r--r--source/blender/modifiers/intern/MOD_solidify.c26
5 files changed, 29 insertions, 12 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py
index 75df7dad5f2..896b76c59f6 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -73,7 +73,7 @@ class DATA_PT_context_mesh(MeshButtonsPanel, Panel):
ob = context.object
mesh = context.mesh
space = context.space_data
-
+ layout.prop(context.scene.tool_settings, "mesh_select_mode", index=0, text="Vertex")
if ob:
layout.template_ID(ob, "data")
elif mesh:
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index e4bbd7d7d7d..179921c3c85 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -577,13 +577,13 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
sub = col.column()
sub.active = bool(md.vertex_group)
sub.prop(md, "invert_vertex_group", text="Invert")
+ sub.prop(md, "thickness_vertex_group", text="Factor")
col.prop(md, "use_even_offset")
col.prop(md, "use_quality_normals")
col.prop(md, "use_rim")
sub = col.column()
- sub.label()
row = sub.split(align=True, percentage=0.4)
row.prop(md, "material_offset", text="")
row = row.row()
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 3787675f339..053f3b38168 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -712,16 +712,16 @@ typedef struct ShapeKeyModifierData {
typedef struct SolidifyModifierData {
ModifierData modifier;
- char defgrp_name[32]; /* name of vertex group to use */
+ char defgrp_name[32]; /* name of vertex group to use */
float offset; /* new surface offset level*/
float offset_fac; /* midpoint of the offset */
+ float offset_fac_vg; /* factor for the minimum weight to use when vgroups are used, avoids 0.0 weights giving duplicate geometry */
float crease_inner;
float crease_outer;
float crease_rim;
int flag;
short mat_ofs;
short mat_ofs_rim;
- int pad;
} SolidifyModifierData;
#define MOD_SOLIDIFY_RIM (1<<0)
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index ba655915fb6..5c5391b0bba 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -2265,6 +2265,13 @@ static void rna_def_modifier_solidify(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Thickness", "Thickness of the shell");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ prop= RNA_def_property(srna, "thickness_vertex_group", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "offset_fac_vg");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Vertex Group Factor", "Thickness factor to use for zero vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "offset_fac");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 0b1fac06e14..afe6da8b38a 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -232,8 +232,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
float (*vert_nors)[3]= NULL;
- float const ofs_orig= - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
- float const ofs_new= smd->offset - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
+ const float ofs_orig= - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
+ const float ofs_new= smd->offset - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
+ const float offset_fac_vg= smd->offset_fac_vg;
+ const float offset_fac_vg_inv= 1.0f - smd->offset_fac_vg;
/* weights */
MDeformVert *dvert, *dv= NULL;
@@ -391,8 +393,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
dv= dvert;
for(i=0; i<numVerts; i++, mv++) {
if(dv) {
- if(defgrp_invert) scalar_short_vgroup = scalar_short * (1.0f - defvert_find_weight(dv, defgrp_index));
- else scalar_short_vgroup = scalar_short * defvert_find_weight(dv, defgrp_index);
+ if(defgrp_invert) scalar_short_vgroup = 1.0f - defvert_find_weight(dv, defgrp_index);
+ else scalar_short_vgroup = defvert_find_weight(dv, defgrp_index);
+ scalar_short_vgroup= (offset_fac_vg + (scalar_short_vgroup * offset_fac_vg_inv)) * scalar_short;
dv++;
}
VECADDFAC(mv->co, mv->co, mv->no, scalar_short_vgroup);
@@ -405,8 +408,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
dv= dvert;
for(i=0; i<numVerts; i++, mv++) {
if(dv) {
- if(defgrp_invert) scalar_short_vgroup = scalar_short * (1.0f - defvert_find_weight(dv, defgrp_index));
- else scalar_short_vgroup = scalar_short * defvert_find_weight(dv, defgrp_index);
+ if(defgrp_invert) scalar_short_vgroup = 1.0f - defvert_find_weight(dv, defgrp_index);
+ else scalar_short_vgroup = defvert_find_weight(dv, defgrp_index);
+ scalar_short_vgroup= (offset_fac_vg + (scalar_short_vgroup * offset_fac_vg_inv)) * scalar_short;
dv++;
}
VECADDFAC(mv->co, mv->co, mv->no, scalar_short_vgroup);
@@ -466,15 +470,21 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* vertex group support */
if(dvert) {
+ float scalar;
+
dv= dvert;
if(defgrp_invert) {
for(i=0; i<numVerts; i++, dv++) {
- vert_angles[i] *= (1.0f - defvert_find_weight(dv, defgrp_index));
+ scalar= 1.0f - defvert_find_weight(dv, defgrp_index);
+ scalar= offset_fac_vg + (scalar * offset_fac_vg_inv);
+ vert_angles[i] *= scalar;
}
}
else {
for(i=0; i<numVerts; i++, dv++) {
- vert_angles[i] *= defvert_find_weight(dv, defgrp_index);
+ scalar= defvert_find_weight(dv, defgrp_index);
+ scalar= offset_fac_vg + (scalar * offset_fac_vg_inv);
+ vert_angles[i] *= scalar;
}
}
}