[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39920] branches/vgroup_modifiers/source/ blender: correct float -> double promotion warnings

Campbell Barton ideasman42 at gmail.com
Mon Sep 5 07:43:01 CEST 2011


Revision: 39920
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39920
Author:   campbellbarton
Date:     2011-09-05 05:43:01 +0000 (Mon, 05 Sep 2011)
Log Message:
-----------
correct float -> double promotion warnings

Modified Paths:
--------------
    branches/vgroup_modifiers/source/blender/makesrna/intern/rna_modifier.c
    branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.c
    branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgmix.c

Modified: branches/vgroup_modifiers/source/blender/makesrna/intern/rna_modifier.c
===================================================================
--- branches/vgroup_modifiers/source/blender/makesrna/intern/rna_modifier.c	2011-09-05 05:42:49 UTC (rev 39919)
+++ branches/vgroup_modifiers/source/blender/makesrna/intern/rna_modifier.c	2011-09-05 05:43:01 UTC (rev 39920)
@@ -2584,13 +2584,13 @@
 
 	prop= RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_ADD2VG);
-	RNA_def_property_ui_text(prop, "Add to VG", "Add vertices with weight over threshold "
+	RNA_def_property_ui_text(prop, "Group Add", "Add vertices with weight over threshold "
 	                                            "to vgroup.");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
 	prop= RNA_def_property(srna, "use_remove", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_REMFVG);
-	RNA_def_property_ui_text(prop, "Rem from VG", "Remove vertices with weight below threshold "
+	RNA_def_property_ui_text(prop, "Group Remove", "Remove vertices with weight below threshold "
 	                                              "from vgroup.");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 

Modified: branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.c
===================================================================
--- branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.c	2011-09-05 05:42:49 UTC (rev 39919)
+++ branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.c	2011-09-05 05:43:01 UTC (rev 39920)
@@ -69,7 +69,7 @@
 	int i;
 
 	/* If influence factor is null, nothing to do! */
-	if (fact == 0.0) return;
+	if (fact == 0.0f) return;
 
 	/* If we want to mask vgroup weights from a texture. */
 	if (texture) {
@@ -105,34 +105,34 @@
 			/* Get the good channel value… */
 			switch(tex_use_channel) {
 			case MOD_WVG_MASK_TEX_USE_INT:
-				org_w[i] = (new_w[i] * texres.tin * fact) + (org_w[i] * (1.0 - (texres.tin*fact)));
+				org_w[i] = (new_w[i] * texres.tin * fact) + (org_w[i] * (1.0f - (texres.tin*fact)));
 				break;
 			case MOD_WVG_MASK_TEX_USE_RED:
-				org_w[i] = (new_w[i] * texres.tr * fact) + (org_w[i] * (1.0 - (texres.tr*fact)));
+				org_w[i] = (new_w[i] * texres.tr * fact) + (org_w[i] * (1.0f - (texres.tr*fact)));
 				break;
 			case MOD_WVG_MASK_TEX_USE_GREEN:
-				org_w[i] = (new_w[i] * texres.tg * fact) + (org_w[i] * (1.0 - (texres.tg*fact)));
+				org_w[i] = (new_w[i] * texres.tg * fact) + (org_w[i] * (1.0f - (texres.tg*fact)));
 				break;
 			case MOD_WVG_MASK_TEX_USE_BLUE:
-				org_w[i] = (new_w[i] * texres.tb * fact) + (org_w[i] * (1.0 - (texres.tb*fact)));
+				org_w[i] = (new_w[i] * texres.tb * fact) + (org_w[i] * (1.0f - (texres.tb*fact)));
 				break;
 			case MOD_WVG_MASK_TEX_USE_HUE:
 				rgb_to_hsv(texres.tr, texres.tg, texres.tb, &h, &s, &v);
-				org_w[i] = (new_w[i] * h * fact) + (org_w[i] * (1.0 - (h*fact)));
+				org_w[i] = (new_w[i] * h * fact) + (org_w[i] * (1.0f - (h*fact)));
 				break;
 			case MOD_WVG_MASK_TEX_USE_SAT:
 				rgb_to_hsv(texres.tr, texres.tg, texres.tb, &h, &s, &v);
-				org_w[i] = (new_w[i] * s * fact) + (org_w[i] * (1.0 - (s*fact)));
+				org_w[i] = (new_w[i] * s * fact) + (org_w[i] * (1.0f - (s*fact)));
 				break;
 			case MOD_WVG_MASK_TEX_USE_VAL:
 				rgb_to_hsv(texres.tr, texres.tg, texres.tb, &h, &s, &v);
-				org_w[i] = (new_w[i] * v * fact) + (org_w[i] * (1.0 - (v*fact)));
+				org_w[i] = (new_w[i] * v * fact) + (org_w[i] * (1.0f - (v*fact)));
 				break;
 			case MOD_WVG_MASK_TEX_USE_ALPHA:
-				org_w[i] = (new_w[i] * texres.ta * fact) + (org_w[i] * (1.0 - (texres.ta*fact)));
+				org_w[i] = (new_w[i] * texres.ta * fact) + (org_w[i] * (1.0f - (texres.ta*fact)));
 				break;
 			default:
-				org_w[i] = (new_w[i] * texres.tin * fact) + (org_w[i] * (1.0 - (texres.tin*fact)));
+				org_w[i] = (new_w[i] * texres.tin * fact) + (org_w[i] * (1.0f - (texres.tin*fact)));
 				break;
 			}
 		}
@@ -164,7 +164,7 @@
 	else {
 		/* Default "influence" behavior. */
 		/* For each weight (vertex), make the mix between org and new weights. */
-		const float ifact= 1.0-fact;
+		const float ifact= 1.0f - fact;
 		for (i = 0; i < num; i++) {
 			org_w[i] = (new_w[i] * fact) + (org_w[i] * ifact);
 		}
@@ -189,7 +189,7 @@
 		MDeformWeight *newdw;
 
 		/* Never allow weights out of [0.0, 1.0] range. */
-		CLAMP(w, 0.0, 1.0);
+		CLAMP(w, 0.0f, 1.0f);
 
 		/* Let's first check to see if this vert is already in the weight group – if so
 		 * let's update it, or remove it if needed.

Modified: branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgmix.c
===================================================================
--- branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgmix.c	2011-09-05 05:42:49 UTC (rev 39919)
+++ branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgmix.c	2011-09-05 05:43:01 UTC (rev 39920)
@@ -98,16 +98,16 @@
 		return (weight * weight2);
 	else if (mix_mode == MOD_WVG_MIX_DIV) {
 		/* Avoid dividing by zero (or really small values). */
-		if (weight2 < 0.0 && weight2 > -MOD_WVG_ZEROFLOOR)
+		if (weight2 < 0.0f && weight2 > -MOD_WVG_ZEROFLOOR)
 			weight2 = -MOD_WVG_ZEROFLOOR;
-		else if (weight2 >= 0.0 && weight2 < MOD_WVG_ZEROFLOOR)
+		else if (weight2 >= 0.0f && weight2 < MOD_WVG_ZEROFLOOR)
 			weight2 = MOD_WVG_ZEROFLOOR;
 		return (weight / weight2);
 	}
 	else if (mix_mode == MOD_WVG_MIX_DIF)
 		return (weight < weight2 ? weight2 - weight : weight - weight2);
 	else if (mix_mode == MOD_WVG_MIX_AVG)
-		return (weight + weight2) / 2.0;
+		return (weight + weight2) * 0.5f;
 	else return weight2;
 }
 




More information about the Bf-blender-cvs mailing list