[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38376] branches/soc-2011-radish/source/ blender: Made a vertex selection keymap for weight paint so that the

Jason Hays jason_hays22 at mymail.eku.edu
Wed Jul 13 22:45:10 CEST 2011


Revision: 38376
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38376
Author:   jason_hays22
Date:     2011-07-13 20:45:09 +0000 (Wed, 13 Jul 2011)
Log Message:
-----------
Made a vertex selection keymap for weight paint so that the 
'A' key could override pose mode's select all (like face mask)
Minor note, changed the icon to the vertex selection icon, but it still doesn't force face mask to turn off.

Clipping is still not functional in wp.
And I'll need to hear how the backbuffer select is supposed to work for lasso select since the selection is arbitrary.

Modified Paths:
--------------
    branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_ops.c
    branches/soc-2011-radish/source/blender/editors/space_view3d/space_view3d.c
    branches/soc-2011-radish/source/blender/editors/space_view3d/view3d_header.c
    branches/soc-2011-radish/source/blender/editors/space_view3d/view3d_select.c
    branches/soc-2011-radish/source/blender/makesrna/intern/rna_mesh.c

Modified: branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_ops.c	2011-07-13 19:27:42 UTC (rev 38375)
+++ branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_ops.c	2011-07-13 20:45:09 UTC (rev 38376)
@@ -611,7 +611,13 @@
 	WM_keymap_verify_item(keymap, "PAINT_OT_weight_from_bones", WKEY, KM_PRESS, 0, 0);
 
 	// Jason
-	WM_keymap_add_item(keymap, "PAINT_OT_vert_select_all", QKEY, KM_PRESS, 0, 0);
+	/*Weight paint's Vertex Selection Mode */
+	keymap= WM_keymap_find(keyconf, "Weight Paint Vertex Selection", 0, 0);
+	keymap->poll= vert_paint_poll;
+	WM_keymap_add_item(keymap, "PAINT_OT_vert_select_all", AKEY, KM_PRESS, 0, 0);
+	WM_keymap_add_item(keymap, "VIEW3D_OT_select_border", BKEY, KM_PRESS, 0, 0);
+	WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
+	RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT|KM_CTRL, 0)->ptr, "deselect", 1);
 	WM_keymap_add_item(keymap, "VIEW3D_OT_select_circle", CKEY, KM_PRESS, 0, 0);
 
 	/* Image/Texture Paint mode */

Modified: branches/soc-2011-radish/source/blender/editors/space_view3d/space_view3d.c
===================================================================
--- branches/soc-2011-radish/source/blender/editors/space_view3d/space_view3d.c	2011-07-13 19:27:42 UTC (rev 38375)
+++ branches/soc-2011-radish/source/blender/editors/space_view3d/space_view3d.c	2011-07-13 20:45:09 UTC (rev 38376)
@@ -371,6 +371,10 @@
 	keymap= WM_keymap_find(wm->defaultconf, "Face Mask", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 	
+	/* Jason */
+	keymap= WM_keymap_find(wm->defaultconf, "Weight Paint Vertex Selection", 0, 0);
+	WM_event_add_keymap_handler(&ar->handlers, keymap);
+
 	/* pose is not modal, operator poll checks for this */
 	keymap= WM_keymap_find(wm->defaultconf, "Pose", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);

Modified: branches/soc-2011-radish/source/blender/editors/space_view3d/view3d_header.c
===================================================================
--- branches/soc-2011-radish/source/blender/editors/space_view3d/view3d_header.c	2011-07-13 19:27:42 UTC (rev 38375)
+++ branches/soc-2011-radish/source/blender/editors/space_view3d/view3d_header.c	2011-07-13 20:45:09 UTC (rev 38376)
@@ -495,10 +495,13 @@
 		/* Manipulators aren't used in weight paint mode */
 		
 		PointerRNA meshptr;
-
 		RNA_pointer_create(&ob->id, &RNA_Mesh, ob->data, &meshptr);
-		uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
-		uiItemR(layout, &meshptr, "wp_vert_sel", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);// Jason
+		//uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+		// Jason
+		row= uiLayoutRow(layout, 1);
+		// TODO: make it so at most one can be active.
+		uiItemR(row, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+		uiItemR(row, &meshptr, "wp_vert_sel", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
 	} else {
 		const char *str_menu;
 

Modified: branches/soc-2011-radish/source/blender/editors/space_view3d/view3d_select.c
===================================================================
--- branches/soc-2011-radish/source/blender/editors/space_view3d/view3d_select.c	2011-07-13 19:27:42 UTC (rev 38375)
+++ branches/soc-2011-radish/source/blender/editors/space_view3d/view3d_select.c	2011-07-13 20:45:09 UTC (rev 38376)
@@ -742,7 +742,30 @@
 		}
 	}
 }
+/* Jason */
+static void do_lasso_select_paintvert(ViewContext *vc, int mcords[][2], short moves, short extend, short select)
+{
+	Object *ob= vc->obact;
+	Mesh *me= ob?ob->data:NULL;
+	rcti rect;
 
+	if(me==NULL || me->totvert==0)
+		return;
+
+	if(extend==0 && select)
+		paintvert_deselect_all_visible(ob, SEL_DESELECT, FALSE); /* flush selection at the end */
+
+	em_vertoffs= me->totvert+1;	/* max index array */
+
+	lasso_select_boundbox(&rect, mcords, moves);
+	EM_mask_init_backbuf_border(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
+	
+	EM_backbuf_checkAndSelectTVerts(me, select);
+
+	EM_free_backbuf();
+
+	paintface_flush_flags(ob);
+}
 static void do_lasso_select_paintface(ViewContext *vc, int mcords[][2], short moves, short extend, short select)
 {
 	Object *ob= vc->obact;
@@ -805,6 +828,8 @@
 	if(vc->obedit==NULL) { /* Object Mode */
 		if(paint_facesel_test(ob))
 			do_lasso_select_paintface(vc, mcords, moves, extend, select);
+		else if(paint_vertsel_test(ob))
+			do_lasso_select_paintvert(vc, mcords, moves, extend, select);
 		else if(ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))
 			;
 		else if(ob && ob->mode & OB_MODE_PARTICLE_EDIT)

Modified: branches/soc-2011-radish/source/blender/makesrna/intern/rna_mesh.c
===================================================================
--- branches/soc-2011-radish/source/blender/makesrna/intern/rna_mesh.c	2011-07-13 19:27:42 UTC (rev 38375)
+++ branches/soc-2011-radish/source/blender/makesrna/intern/rna_mesh.c	2011-07-13 20:45:09 UTC (rev 38376)
@@ -2077,10 +2077,11 @@
 	RNA_def_property_ui_icon(prop, ICON_FACESEL_HLT, 0);
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
 
+	/* Jason */
 	prop= RNA_def_property(srna, "wp_vert_sel", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_VERT_SEL);
 	RNA_def_property_ui_text(prop, "Vertex Selection", "Vertex Selection for auto brushes");
-	RNA_def_property_ui_icon(prop, ICON_FACESEL_HLT, 0);
+	RNA_def_property_ui_icon(prop, ICON_VERTEXSEL, 0);
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
 
 	/* readonly editmesh info - use for extrude menu */




More information about the Bf-blender-cvs mailing list