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:
authorBastien Montagne <montagne29@wanadoo.fr>2011-09-08 11:36:59 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2011-09-08 11:36:59 +0400
commit1f0bb0e0353687c17738608d884077dc6779638d (patch)
tree0f9f0a4fc3726adb87590b2572b58e3b2180da3f
parent3dccd96ac705011ac396a3eb1d3b07a18ef485a7 (diff)
Vertex Weight Proximity: minor updates and fixes.
*Updated UI code (replaced “row columns” by splits ;) ). *Clamped global influence to [0.0, 1.0] range! *Added/edited some tooltips for Proximity. *Proximity distance mapping can now be reversed by entering Lowest Dist > Highest Dist. *Moved mapping before masking in Proximity, much more sensible this way!
-rw-r--r--release/scripts/startup/bl_ui/properties_data_modifier.py19
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c16
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.c28
3 files changed, 40 insertions, 23 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 348ca554e63..c80823b0803 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -740,20 +740,21 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
@staticmethod
def vertex_weight_mask(layout, ob, md):
layout.label(text="Influence/Mask Options:")
- split = layout.split()
- col1 = split.column()
- col2 = split.column()
+ row = layout.row()
- col1.label(text="Global Influence:")
- col2.prop(md, "mask_constant", text="")
+ split = layout.split(percentage=0.4)
+ split.label(text="Global Influence:")
+ split.prop(md, "mask_constant", text="")
if not md.mask_texture:
- col1.label(text="Vertex Group Mask:")
- col2.prop_search(md, "mask_vertex_group", ob, "vertex_groups", text="")
+ split = layout.split(percentage=0.4)
+ split.label(text="Vertex Group Mask:")
+ split.prop_search(md, "mask_vertex_group", ob, "vertex_groups", text="")
if not md.mask_vertex_group:
- col1.label(text="Texture Mask:")
- col2.template_ID(md, "mask_texture", new="texture.new")
+ split = layout.split(percentage=0.4)
+ split.label(text="Texture Mask:")
+ split.template_ID(md, "mask_texture", new="texture.new")
if md.mask_texture:
split = layout.split()
col = split.column()
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 2e8e8520dbf..d5c7002e07f 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -2510,7 +2510,7 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *brna, StructRNA *srna)
prop= RNA_def_property(srna, "mask_constant", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -1.0, 1.0, 10, 0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 0);
RNA_def_property_ui_text(prop, "Influence", "Global influence of current modifications on vgroup.");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -2707,9 +2707,9 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem proximity_geometry_items[] = {
- {MOD_WVG_PROXIMITY_GEOM_VERTS, "VERTEX", ICON_VERTEXSEL, "Vertex", ""},
- {MOD_WVG_PROXIMITY_GEOM_EDGES, "EDGE", ICON_EDGESEL, "Edge", ""},
- {MOD_WVG_PROXIMITY_GEOM_FACES, "FACE", ICON_FACESEL, "Face", ""},
+ {MOD_WVG_PROXIMITY_GEOM_VERTS, "VERTEX", ICON_VERTEXSEL, "Vertex", "Compute distance to nearest vertex."},
+ {MOD_WVG_PROXIMITY_GEOM_EDGES, "EDGE", ICON_EDGESEL, "Edge", "Compute distance to nearest edge."},
+ {MOD_WVG_PROXIMITY_GEOM_FACES, "FACE", ICON_FACESEL, "Face", "Compute distance to nearest face."},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem weightvg_proximity_falloff_type_items[] = {
@@ -2748,7 +2748,9 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "proximity_flags");
RNA_def_property_enum_items(prop, proximity_geometry_items);
RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */
- RNA_def_property_ui_text(prop, "Proximity Geometry", "Use shortest distance to target object's geometry as weight");
+ RNA_def_property_ui_text(prop, "Proximity Geometry",
+ "Use the shortest computed distance to target object's geometry "
+ "as weight.");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -2760,13 +2762,13 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
prop= RNA_def_property(srna, "min_dist", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, 0);
- RNA_def_property_ui_text(prop, "Lowest Dist", "Distance mapping to weight 0.0.");
+ RNA_def_property_ui_text(prop, "Lowest Dist", "Distance mapping to weight 0.0 (or weight 1.0 if above Highest Dist).");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "max_dist", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, 0);
- RNA_def_property_ui_text(prop, "Highest Dist", "Distance mapping to weight 1.0.");
+ RNA_def_property_ui_text(prop, "Highest Dist", "Distance mapping to weight 1.0 (or weight 0.0 if below Lowest Dist).");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 561a021ce0c..0dbf8a91d21 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -199,10 +199,24 @@ void do_map(float *weights, const int nidx, const float min_d, const float max_d
{
const float range_inv= 1.0f / (max_d - min_d); /* invert since multiplication is faster */
unsigned int i= nidx;
- while (i-- > 0) {
- if (weights[i] >= max_d) weights[i]= 1.0f; /* most likely case first */
- else if(weights[i] <= min_d) weights[i]= 0.0f;
- else weights[i]= (weights[i] - min_d) * range_inv;
+ if(max_d == min_d) {
+ while (i-- > 0) {
+ weights[i] = (weights[i] >= max_d) ? 1.0f : 0.0f; /* "Step" behavior... */
+ }
+ }
+ else if(max_d > min_d) {
+ while (i-- > 0) {
+ if (weights[i] >= max_d) weights[i]= 1.0f; /* most likely case first */
+ else if(weights[i] <= min_d) weights[i]= 0.0f;
+ else weights[i]= (weights[i] - min_d) * range_inv;
+ }
+ }
+ else {
+ while (i-- > 0) {
+ if (weights[i] <= max_d) weights[i]= 1.0f; /* most likely case first */
+ else if(weights[i] >= min_d) weights[i]= 0.0f;
+ else weights[i]= (weights[i] - min_d) * range_inv;
+ }
}
if(!ELEM(mode, MOD_WVG_MAPPING_NONE, MOD_WVG_MAPPING_CURVE)) {
@@ -495,14 +509,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
}
}
+ /* Map distances to weights. */
+ do_map(new_w, numIdx, wmd->min_dist, wmd->max_dist, wmd->falloff_type);
+
/* Do masking. */
weightvg_do_mask(numIdx, indices, org_w, new_w, ob, ret, wmd->mask_constant,
wmd->mask_defgrp_name, wmd->mask_texture, wmd->mask_tex_use_channel,
wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
- /* Map distances to weights. */
- do_map(org_w, numIdx, wmd->min_dist, wmd->max_dist, wmd->falloff_type);
-
/* Update vgroup. Note we never add nor remove vertices from vgroup here. */
weightvg_update_vg(dvert, defgrp_idx, numIdx, indices, org_w, 0, 0.0f, 0, 0.0f);