[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42684] branches/vgroup_modifiers/source/ blender/modifiers/intern: Minor fixes for weight preview.

Bastien Montagne montagne29 at wanadoo.fr
Sat Dec 17 13:09:40 CET 2011


Revision: 42684
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42684
Author:   mont29
Date:     2011-12-17 12:09:28 +0000 (Sat, 17 Dec 2011)
Log Message:
-----------
Minor fixes for weight preview.

Modified Paths:
--------------
    branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.c
    branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.h
    branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgedit.c
    branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgmix.c
    branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgproximity.c

Modified: branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.c
===================================================================
--- branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.c	2011-12-17 03:49:39 UTC (rev 42683)
+++ branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.c	2011-12-17 12:09:28 UTC (rev 42684)
@@ -265,7 +265,7 @@
  * If indices is not NULL, it must be a table of same length as weights, mapping to the real
  * vertex index (in case the weight table does not cover the whole vertices...).
  */
-void weightvg_set_weightcol(DerivedMesh *dm, int num, const int *indices, const float *weights)
+void weightvg_set_weightcol(DerivedMesh *dm, int num, const int *indices, float *weights)
 {
 	MFace *mface = dm->getFaceArray(dm);
 	int nfaces = dm->getNumFaces(dm);
@@ -292,6 +292,7 @@
 			while(j--) {
 				int idx = (j==0)?mface[i].v1: (j==1)?mface[i].v2: (j==2)?mface[i].v3: mface[i].v4;
 
+				CLAMP(w[idx], 0.0f, 1.0f);
 				weight_to_rgb(temp_color, w[idx]);
 				col[i*4+j].r = FTOCHAR(temp_color[2]);
 				col[i*4+j].g = FTOCHAR(temp_color[1]);

Modified: branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.h
===================================================================
--- branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.h	2011-12-17 03:49:39 UTC (rev 42683)
+++ branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvg_util.h	2011-12-17 12:09:28 UTC (rev 42684)
@@ -89,6 +89,6 @@
  * If indices is not NULL, it must be a table of same length as weights, mapping to the real
  * vertex index (in case the weight table does not cover the whole vertices...).
  */
-void weightvg_set_weightcol(DerivedMesh *dm, int num, const int *indices, const float *weights);
+void weightvg_set_weightcol(DerivedMesh *dm, int num, const int *indices, float *weights);
 
 #endif /* MOD_WEIGHTVG_UTIL_H */

Modified: branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgedit.c
===================================================================
--- branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgedit.c	2011-12-17 03:49:39 UTC (rev 42683)
+++ branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgedit.c	2011-12-17 12:09:28 UTC (rev 42684)
@@ -114,6 +114,10 @@
 	if(wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
 		dataMask |= CD_MASK_MTFACE;
 
+	/* Ask for weight MCOL if needed. */
+	if(wmd->common_flags & MOD_WVG_CFLAG_WEIGHT_PREVIEW)
+		dataMask |= CD_MASK_WEIGHT_MCOL;
+
 	return dataMask;
 }
 

Modified: branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgmix.c
===================================================================
--- branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgmix.c	2011-12-17 03:49:39 UTC (rev 42683)
+++ branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgmix.c	2011-12-17 12:09:28 UTC (rev 42684)
@@ -156,6 +156,10 @@
 	if(wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
 		dataMask |= CD_MASK_MTFACE;
 
+	/* Ask for weight MCOL if needed. */
+	if(wmd->common_flags & MOD_WVG_CFLAG_WEIGHT_PREVIEW)
+		dataMask |= CD_MASK_WEIGHT_MCOL;
+
 	return dataMask;
 }
 

Modified: branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgproximity.c
===================================================================
--- branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgproximity.c	2011-12-17 03:49:39 UTC (rev 42683)
+++ branches/vgroup_modifiers/source/blender/modifiers/intern/MOD_weightvgproximity.c	2011-12-17 12:09:28 UTC (rev 42684)
@@ -262,6 +262,10 @@
 	if(wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
 		dataMask |= CD_MASK_MTFACE;
 
+	/* Ask for weight MCOL if needed. */
+	if(wmd->common_flags & MOD_WVG_CFLAG_WEIGHT_PREVIEW)
+		dataMask |= CD_MASK_WEIGHT_MCOL;
+
 	return dataMask;
 }
 




More information about the Bf-blender-cvs mailing list