[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40032] trunk/blender: Vertex Weight Proximity: minor updates and fixes.
Bastien Montagne
montagne29 at wanadoo.fr
Thu Sep 8 09:37:00 CEST 2011
Revision: 40032
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40032
Author: mont29
Date: 2011-09-08 07:36:59 +0000 (Thu, 08 Sep 2011)
Log Message:
-----------
Vertex Weight Proximity: minor updates and fixes.
*Updated UI code (replaced ?\226?\128?\156row columns?\226?\128?\157 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!
Modified Paths:
--------------
trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py
trunk/blender/source/blender/makesrna/intern/rna_modifier.c
trunk/blender/source/blender/modifiers/intern/MOD_weightvgproximity.c
Modified: trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py 2011-09-08 07:23:01 UTC (rev 40031)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py 2011-09-08 07:36:59 UTC (rev 40032)
@@ -740,20 +740,21 @@
@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()
Modified: trunk/blender/source/blender/makesrna/intern/rna_modifier.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_modifier.c 2011-09-08 07:23:01 UTC (rev 40031)
+++ trunk/blender/source/blender/makesrna/intern/rna_modifier.c 2011-09-08 07:36:59 UTC (rev 40032)
@@ -2510,7 +2510,7 @@
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 @@
{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 @@
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 @@
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);
Modified: trunk/blender/source/blender/modifiers/intern/MOD_weightvgproximity.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_weightvgproximity.c 2011-09-08 07:23:01 UTC (rev 40031)
+++ trunk/blender/source/blender/modifiers/intern/MOD_weightvgproximity.c 2011-09-08 07:36:59 UTC (rev 40032)
@@ -199,11 +199,25 @@
{
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)) {
weightvg_do_map(nidx, weights, mode, NULL);
@@ -495,14 +509,14 @@
}
}
+ /* 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);
More information about the Bf-blender-cvs
mailing list