[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38605] branches/soc-2011-salad: Merged Radish Branch 38158-38582

Jason Hays jason_hays22 at mymail.eku.edu
Fri Jul 22 15:56:57 CEST 2011


Revision: 38605
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38605
Author:   jason_hays22
Date:     2011-07-22 13:56:56 +0000 (Fri, 22 Jul 2011)
Log Message:
-----------
Merged Radish Branch 38158-38582

Modified Paths:
--------------
    branches/soc-2011-salad/release/scripts/startup/bl_ui/properties_data_mesh.py
    branches/soc-2011-salad/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    branches/soc-2011-salad/source/blender/blenkernel/BKE_paint.h
    branches/soc-2011-salad/source/blender/blenkernel/intern/DerivedMesh.c
    branches/soc-2011-salad/source/blender/blenkernel/intern/cdderivedmesh.c
    branches/soc-2011-salad/source/blender/blenkernel/intern/paint.c
    branches/soc-2011-salad/source/blender/editors/armature/meshlaplacian.c
    branches/soc-2011-salad/source/blender/editors/include/ED_mesh.h
    branches/soc-2011-salad/source/blender/editors/mesh/editmesh.c
    branches/soc-2011-salad/source/blender/editors/object/object_vgroup.c
    branches/soc-2011-salad/source/blender/editors/sculpt_paint/paint_image.c
    branches/soc-2011-salad/source/blender/editors/sculpt_paint/paint_intern.h
    branches/soc-2011-salad/source/blender/editors/sculpt_paint/paint_ops.c
    branches/soc-2011-salad/source/blender/editors/sculpt_paint/paint_utils.c
    branches/soc-2011-salad/source/blender/editors/sculpt_paint/paint_vertex.c
    branches/soc-2011-salad/source/blender/editors/space_view3d/drawmesh.c
    branches/soc-2011-salad/source/blender/editors/space_view3d/drawobject.c
    branches/soc-2011-salad/source/blender/editors/space_view3d/space_view3d.c
    branches/soc-2011-salad/source/blender/editors/space_view3d/view3d_header.c
    branches/soc-2011-salad/source/blender/editors/space_view3d/view3d_select.c
    branches/soc-2011-salad/source/blender/makesdna/DNA_mesh_types.h
    branches/soc-2011-salad/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2011-salad/source/blender/makesrna/intern/rna_mesh.c
    branches/soc-2011-salad/source/blender/makesrna/intern/rna_scene.c

Modified: branches/soc-2011-salad/release/scripts/startup/bl_ui/properties_data_mesh.py
===================================================================
--- branches/soc-2011-salad/release/scripts/startup/bl_ui/properties_data_mesh.py	2011-07-22 13:52:31 UTC (rev 38604)
+++ branches/soc-2011-salad/release/scripts/startup/bl_ui/properties_data_mesh.py	2011-07-22 13:56:56 UTC (rev 38605)
@@ -158,6 +158,7 @@
             row = layout.row()
             row.prop(group, "name")
         #Jason was here
+        # add buttons to make it faster to lock/unlock vgroups
         if ob.mode == 'WEIGHT_PAINT' and len(ob.vertex_groups) > 0:
             row = layout.row()
             sub = row.row(align=True)

Modified: branches/soc-2011-salad/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2011-salad/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2011-07-22 13:52:31 UTC (rev 38604)
+++ branches/soc-2011-salad/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2011-07-22 13:56:56 UTC (rev 38605)
@@ -677,7 +677,6 @@
             layout.prop(context.tool_settings, "use_auto_normalize", text="Auto Normalize")
             # Jason was here
             layout.prop(context.tool_settings, "use_multipaint", text="Multi-Paint")
-            layout.prop(context.tool_settings, "use_wp_vert_sel", text="Select Vertices")
 
             col = layout.column()
 

Modified: branches/soc-2011-salad/source/blender/blenkernel/BKE_paint.h
===================================================================
--- branches/soc-2011-salad/source/blender/blenkernel/BKE_paint.h	2011-07-22 13:52:31 UTC (rev 38604)
+++ branches/soc-2011-salad/source/blender/blenkernel/BKE_paint.h	2011-07-22 13:56:56 UTC (rev 38605)
@@ -64,8 +64,9 @@
  * Texture paint could be removed since selected faces are not used
  * however hiding faces is useful */
 int paint_facesel_test(struct Object *ob);
+/* Jason */
+int paint_vertsel_test(struct Object *ob);
 
-
 void paint_refresh_mask_display(struct Object *ob);
 float paint_mask_from_gridelem(struct DMGridData *elem, struct GridKey *gridkey,
 			       struct CustomData *vdata);

Modified: branches/soc-2011-salad/source/blender/blenkernel/intern/DerivedMesh.c
===================================================================
--- branches/soc-2011-salad/source/blender/blenkernel/intern/DerivedMesh.c	2011-07-22 13:52:31 UTC (rev 38604)
+++ branches/soc-2011-salad/source/blender/blenkernel/intern/DerivedMesh.c	2011-07-22 13:56:56 UTC (rev 38605)
@@ -1608,13 +1608,15 @@
 static void calc_weightpaint_vert_color(Object *ob, ColorBand *coba, int vert, unsigned char *col, char *dg_flags, int selected, int unselected, int multipaint, int auto_normalize)
 {
 	Mesh *me = ob->data;
-	float colf[4], input = 0.0f, unsel_sum = 0.0f;// Jason
+	float colf[4], input = 0.0f;// Jason
 	int i;
 	char make_black = FALSE;
 	char was_a_nonzero = FALSE;
 	if (me->dvert) {
 		for (i=0; i<me->dvert[vert].totweight; i++) {
 			// Jason was here
+			// in multipaint, get the average if auto normalize is inactive
+			// get the sum if it is active
 			if(multipaint && selected > 1) {
 				if(dg_flags[me->dvert[vert].dw[i].def_nr]) {
 					if(me->dvert[vert].dw[i].weight) {
@@ -1622,23 +1624,18 @@
 						was_a_nonzero = TRUE;
 					}
 				}
-				// TODO unselected non-bone groups should not be involved in this sum
-				else if(auto_normalize) {
-					unsel_sum+=me->dvert[vert].dw[i].weight;
-				}
 			} else if (me->dvert[vert].dw[i].def_nr==ob->actdef-1) {
 				input+=me->dvert[vert].dw[i].weight;
 			}
 		}
 		
 		// Jason was here
+		// make it black if the selected groups have no weight on a vertex
 		if(!make_black && multipaint && selected > 1) {
-			/*if(input == 1.0f && auto_normalize && !unsel_sum) {
-				make_black = TRUE;
-			} else */
 			if(!was_a_nonzero) {
 				make_black = TRUE;
 			} else if (!auto_normalize){
+				// get the average
 				input /= selected;
 			}
 
@@ -2337,7 +2334,7 @@
 static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask)
 {
 	Object *obact = scene->basact?scene->basact->object:NULL;
-	int editing = paint_facesel_test(ob);
+	int editing = paint_facesel_test(ob) || paint_vertsel_test(ob);// Jason: paint_vertsel_test
 	/* weight paint and face select need original indicies because of selection buffer drawing */
 	int needMapping = (ob==obact) && (editing || (ob->mode & OB_MODE_WEIGHT_PAINT));
 

Modified: branches/soc-2011-salad/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- branches/soc-2011-salad/source/blender/blenkernel/intern/cdderivedmesh.c	2011-07-22 13:52:31 UTC (rev 38604)
+++ branches/soc-2011-salad/source/blender/blenkernel/intern/cdderivedmesh.c	2011-07-22 13:56:56 UTC (rev 38605)
@@ -291,14 +291,23 @@
 	MVert *mv = cddm->mvert;
 	int i;
 	if( GPU_buffer_legacy(dm) ) {
+		char prev_sel= 0; /* always invalid */;
+
 		glBegin(GL_POINTS);
 		for(i = 0; i < dm->numVertData; i++, mv++) {
-			if((mv->flag & 1)) {//TODO define selected
-				glColor3f(1.0f, 1.0f, 0.0f);
-			}else {
-				glColor3f(0.0f, 0.0f, 0.0f);
-			}
 			if(!(mv->flag & ME_HIDE)) {
+				const char sel= mv->flag & 1;
+				if(prev_sel != sel) {
+					prev_sel= sel;
+
+					// TODO define selected color
+					if(sel) {
+						glColor3f(1.0f, 1.0f, 0.0f);
+					}else {
+						glColor3f(0.0f, 0.0f, 0.0f);
+					}
+				}
+
 				glVertex3fv(mv->co);
 			}
 		}

Modified: branches/soc-2011-salad/source/blender/blenkernel/intern/paint.c
===================================================================
--- branches/soc-2011-salad/source/blender/blenkernel/intern/paint.c	2011-07-22 13:52:31 UTC (rev 38604)
+++ branches/soc-2011-salad/source/blender/blenkernel/intern/paint.c	2011-07-22 13:56:56 UTC (rev 38605)
@@ -104,7 +104,11 @@
 {
 	return (ob && ob->type==OB_MESH && ob->data && (((Mesh *)ob->data)->editflag & ME_EDIT_PAINT_MASK) && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)));
 }
-
+/* Jason */
+int paint_vertsel_test(Object *ob)
+{
+	return (ob && ob->type==OB_MESH && ob->data && (((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) && (ob->mode & OB_MODE_WEIGHT_PAINT));
+}
 void paint_init(Paint *p, const char col[3])
 {
 	Brush *brush;

Modified: branches/soc-2011-salad/source/blender/editors/armature/meshlaplacian.c
===================================================================
--- branches/soc-2011-salad/source/blender/editors/armature/meshlaplacian.c	2011-07-22 13:52:31 UTC (rev 38604)
+++ branches/soc-2011-salad/source/blender/editors/armature/meshlaplacian.c	2011-07-22 13:56:56 UTC (rev 38605)
@@ -657,22 +657,26 @@
 	int *vertsflipped = NULL, *mask= NULL;
 	int a, totface, j, bbone, firstsegment, lastsegment;
 
+	// Jason
+	MVert *mv = me->mvert;
+	int selectedVerts;
+
 	*err_str= NULL;
 
 	/* count triangles and create mask */
-	if(me->editflag & ME_EDIT_PAINT_MASK)
+	if((me->editflag & ME_EDIT_PAINT_MASK) || (selectedVerts=(me->editflag & ME_EDIT_VERT_SEL)))
 		mask= MEM_callocN(sizeof(int)*me->totvert, "heat_bone_weighting mask");
 
 	for(totface=0, a=0, mface=me->mface; a<me->totface; a++, mface++) {
 		totface++;
 		if(mface->v4) totface++;
-
-		if(mask && (mface->flag & ME_FACE_SEL)) {
-			mask[mface->v1]= 1;
-			mask[mface->v2]= 1;
-			mask[mface->v3]= 1;
+		// Jason (added selectedVerts content for vertex mask, they used to just equal 1)
+		if(mask && ((mface->flag & ME_FACE_SEL) || selectedVerts)) {
+			mask[mface->v1]= selectedVerts ? ((mv+mface->v1)->flag & 1): 1;
+			mask[mface->v2]= selectedVerts ? ((mv+mface->v2)->flag & 1): 1;
+			mask[mface->v3]= selectedVerts ? ((mv+mface->v3)->flag & 1): 1;
 			if(mface->v4)
-				mask[mface->v4]= 1;
+				mask[mface->v4]= selectedVerts ? ((mv+mface->v4)->flag & 1): 1;
 		}
 	}
 

Modified: branches/soc-2011-salad/source/blender/editors/include/ED_mesh.h
===================================================================
--- branches/soc-2011-salad/source/blender/editors/include/ED_mesh.h	2011-07-22 13:52:31 UTC (rev 38604)
+++ branches/soc-2011-salad/source/blender/editors/include/ED_mesh.h	2011-07-22 13:56:56 UTC (rev 38605)
@@ -125,6 +125,7 @@
 void		undo_push_mesh(struct bContext *C, const char *name);
 /* Jason */
 void		paintvert_flush_flags(struct Object *ob);
+void		paintvert_deselect_all_visible(struct Object *ob, int action, short flush_flags);
 
 /* editmesh_lib.c */
 

Modified: branches/soc-2011-salad/source/blender/editors/mesh/editmesh.c
===================================================================
--- branches/soc-2011-salad/source/blender/editors/mesh/editmesh.c	2011-07-22 13:52:31 UTC (rev 38604)
+++ branches/soc-2011-salad/source/blender/editors/mesh/editmesh.c	2011-07-22 13:56:56 UTC (rev 38605)
@@ -1993,3 +1993,62 @@
 		}
 	}
 }
+/* Jason note: caller needs to run paintvert_flush_flags(ob) after this */
+void paintvert_deselect_all_visible(Object *ob, int action, short flush_flags)
+{
+	Mesh *me;
+	MVert *mvert;
+	int a;
+
+	me= get_mesh(ob);
+	if(me==NULL) return;
+	
+	if(action == SEL_INVERT) {
+		mvert= me->mvert;
+		a= me->totvert;
+		while(a--) {
+			if((mvert->flag & ME_HIDE) == 0) {
+				mvert->flag ^= SELECT;
+			}
+			mvert++;
+		}
+	}
+	else {
+		if (action == SEL_TOGGLE) {
+			action = SEL_SELECT;
+
+			mvert= me->mvert;
+			a= me->totvert;
+			while(a--) {
+				if((mvert->flag & ME_HIDE) == 0 && mvert->flag & SELECT) {
+					action = SEL_DESELECT;
+					break;
+				}
+				mvert++;
+			}
+		}
+
+		mvert= me->mvert;
+		a= me->totvert;
+		while(a--) {
+			if((mvert->flag & ME_HIDE) == 0) {
+				switch (action) {
+				case SEL_SELECT:
+					mvert->flag |= SELECT;
+					break;
+				case SEL_DESELECT:
+					mvert->flag &= ~SELECT;
+					break;
+				case SEL_INVERT:
+					mvert->flag ^= SELECT;
+					break;
+				}
+			}
+			mvert++;
+		}
+	}
+
+	if(flush_flags) {
+		paintvert_flush_flags(ob);
+	}
+}

Modified: branches/soc-2011-salad/source/blender/editors/object/object_vgroup.c
===================================================================
--- branches/soc-2011-salad/source/blender/editors/object/object_vgroup.c	2011-07-22 13:52:31 UTC (rev 38604)
+++ branches/soc-2011-salad/source/blender/editors/object/object_vgroup.c	2011-07-22 13:56:56 UTC (rev 38605)
@@ -701,6 +701,10 @@
 	MDeformWeight *dw;
 	MDeformVert *dvert, **dvert_array=NULL;
 	int i, def_nr, dvert_tot=0;
+	// Jason
+	Mesh *me = ob->data;
+	MVert *mv = me->mvert;

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list