Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Hays <jason_hays22@mymail.eku.edu>2011-07-12 23:06:06 +0400
committerJason Hays <jason_hays22@mymail.eku.edu>2011-07-12 23:06:06 +0400
commit9a808e7b8cef56befc0e54b254571b41afe242e3 (patch)
tree76a3b3733b1d016ac785eddf1e7f268f8dbe46f3
parent30412f85aaa3916e656aac5b236c147dfd67501f (diff)
Lots of incomplete changes:
Weight Paint Vertex Select tweaked to act like edit mode's select and Circle select was added, but clipping is not working properly for either. Select all was added too, but to the Q key until I look into overriding A's select all bones. The select vertices checkbox was moved to the header, but it does not force face select mask to turn off yet--and it doesn't have the correct icon. There will definitely be an update tomorrow to fix the problems with all or most of the issues.
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py1
-rw-r--r--source/blender/blenkernel/BKE_paint.h3
-rw-r--r--source/blender/blenkernel/intern/paint.c6
-rw-r--r--source/blender/editors/include/ED_mesh.h1
-rw-r--r--source/blender/editors/mesh/editmesh.c59
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c1
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h3
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c7
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c24
-rw-r--r--source/blender/editors/space_view3d/drawobject.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c49
-rw-r--r--source/blender/makesdna/DNA_mesh_types.h2
-rw-r--r--source/blender/makesdna/DNA_scene_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c5
-rw-r--r--source/blender/makesrna/intern/rna_scene.c6
17 files changed, 149 insertions, 30 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 5dd7c30cf9a..7b015206f0d 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -641,7 +641,6 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
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()
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index ef16129e1e7..cee97e7631f 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -59,7 +59,8 @@ void paint_brush_set(struct Paint *paint, struct Brush *br);
* 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);
/* Session data (mode-specific) */
typedef struct SculptSession {
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 5be492d1108..fa6ecb09f48 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -93,7 +93,11 @@ int paint_facesel_test(Object *ob)
{
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;
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index cdad34a9d42..8005032f0a5 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -124,6 +124,7 @@ int EM_vertColorCheck(struct EditMesh *em);
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 */
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
index feaa1899059..73ceb0fb3d7 100644
--- a/source/blender/editors/mesh/editmesh.c
+++ b/source/blender/editors/mesh/editmesh.c
@@ -1992,4 +1992,63 @@ void paintvert_flush_flags(Object *ob)
mv->flag= mv_orig->flag;
}
}
+}
+/* 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);
+ }
} \ No newline at end of file
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index 741cfd7078c..a1a6e88fa0c 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -328,6 +328,7 @@ int EM_init_backbuf_circle(ViewContext *vc, short xs, short ys, short rads)
/* method in use for face selecting too */
if(vc->obedit==NULL) {
if(paint_facesel_test(vc->obact));
+ else if(paint_vertsel_test(vc->obact));// Jason, vertex selecting
else return 0;
}
else if(vc->v3d->drawtype<OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT)==0) return 0;
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index cae5c14aa97..5f38bdcf4af 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -5414,7 +5414,11 @@ int facemask_paint_poll(bContext *C)
{
return paint_facesel_test(CTX_data_active_object(C));
}
-
+// Jason
+int vert_paint_poll(bContext *C)
+{
+ return paint_vertsel_test(CTX_data_active_object(C));
+}
/* use project paint to re-apply an image */
static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
{
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index 5a0ee19d6c9..9894469fa82 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -121,6 +121,9 @@ void PAINT_OT_face_select_all(struct wmOperatorType *ot);
void PAINT_OT_face_select_inverse(struct wmOperatorType *ot);
void PAINT_OT_face_select_hide(struct wmOperatorType *ot);
void PAINT_OT_face_select_reveal(struct wmOperatorType *ot);
+/* Jason */
+void PAINT_OT_vert_select_all(struct wmOperatorType *ot);
+int vert_paint_poll(struct bContext *C);
int facemask_paint_poll(struct bContext *C);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 69af50415cc..ad339b07eb7 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -373,6 +373,9 @@ void ED_operatortypes_paint(void)
WM_operatortype_append(PAINT_OT_weight_sample);
WM_operatortype_append(PAINT_OT_weight_sample_group);
+ /* Jason, vertex selection */
+ WM_operatortype_append(PAINT_OT_vert_select_all);
+
/* vertex */
WM_operatortype_append(PAINT_OT_vertex_paint_toggle);
WM_operatortype_append(PAINT_OT_vertex_paint);
@@ -607,6 +610,10 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
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);
+ WM_keymap_add_item(keymap, "VIEW3D_OT_select_circle", CKEY, KM_PRESS, 0, 0);
+
/* Image/Texture Paint mode */
keymap= WM_keymap_find(keyconf, "Image Paint", 0, 0);
keymap->poll= image_texture_paint_poll;
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 09f5c32bea0..18f59536092 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -358,6 +358,30 @@ void PAINT_OT_face_select_all(wmOperatorType *ot)
WM_operator_properties_select_all(ot);
}
+/* Jason */
+static int vert_select_all_exec(bContext *C, wmOperator *op)
+{
+ Object *ob= CTX_data_active_object(C);
+ paintvert_deselect_all_visible(ob, RNA_enum_get(op->ptr, "action"), TRUE);
+ ED_region_tag_redraw(CTX_wm_region(C));
+ return OPERATOR_FINISHED;
+}
+
+/* Jason */
+void PAINT_OT_vert_select_all(wmOperatorType *ot)
+{
+ ot->name= "Vertex Selection";
+ ot->description= "Change selection for all vertices";
+ ot->idname= "PAINT_OT_vert_select_all";
+
+ ot->exec= vert_select_all_exec;
+ ot->poll= vert_paint_poll;
+
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ WM_operator_properties_select_all(ot);
+}
+
static int face_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_active_object(C);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 22233b895cb..d7b6511aff9 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -2777,7 +2777,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
GPU_disable_material();
// Jason
- if(scene->toolsettings->wp_vert_sel) {
+ if(paint_vertsel_test(ob)) {
glColor3f(0.0f, 0.0f, 0.0f);
glPointSize(2.0f);
dm->drawEdges(dm, (dt==OB_WIRE || totface==0), me->drawflag);
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 75c8d5cae73..dea46b2e7c3 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -498,6 +498,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
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
} else {
const char *str_menu;
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 19aa8ab1886..be2ec3a39c8 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -247,7 +247,7 @@ static int view3d_selectable_data(bContext *C)
if (ob->mode & OB_MODE_SCULPT) {
return 0;
}
- if (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT) && !paint_facesel_test(ob)) {
+ if (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT) && !paint_facesel_test(ob) && !paint_vertsel_test(ob)) {//Jason
return 0;
}
}
@@ -1895,9 +1895,10 @@ int mouse_wp_select(bContext *C, const int mval[2], short extend, Object *obact,
if(extend) {
mv->flag ^= 1;
} else {
+ paintvert_deselect_all_visible(obact, SEL_DESELECT, FALSE);
mv->flag |= 1;
}
- paintvert_flush_flags(vc->obact);
+ paintvert_flush_flags(obact);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obact->data);
MEM_freeN(vc);
@@ -1943,7 +1944,7 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
else if(obact && paint_facesel_test(obact))
retval = paintface_mouse_select(C, obact, event->mval, extend);
/*Jason*/
- else if (scene->toolsettings->wp_vert_sel && obact && obact->mode & OB_MODE_WEIGHT_PAINT && (me = (Mesh*)(obact->data))) {//Jason
+ else if (paint_vertsel_test(obact) && (me = (Mesh*)(obact->data))) {
retval = mouse_wp_select(C, event->mval, extend, obact, me);
} else {
retval = mouse_select(C, event->mval, extend, center, enumerate);
@@ -1991,6 +1992,18 @@ static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y
eve->f = data->select?(eve->f|1):(eve->f&~1);
}
}
+/* Jason */
+static void mesh_obmode_circle_doSelectVert(void *userData, MVert *mv, int x, int y, int index)
+{
+ struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData;
+ int mx = x - data->mval[0], my = y - data->mval[1];
+ float r = sqrt(mx*mx + my*my);
+ mv = mv+index;
+ if (r<=data->radius) {
+ mv->flag = data->select?(mv->flag|1):(mv->flag&~1);
+ }
+}
+
static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index))
{
struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData;
@@ -2075,14 +2088,19 @@ static void paint_vertsel_circle_select(ViewContext *vc, int select, const int m
{
Object *ob= vc->obact;
Mesh *me = ob?ob->data:NULL;
- int bbsel;
+ struct {ViewContext *vc; short select; int mval[2]; float radius; } data = {NULL};
if (me) {
- em_vertoffs= me->totvert+1; /* max index array */
+ ED_view3d_init_mats_rv3d(ob, vc->rv3d);
+ data.radius = rad;
+ data.vc = vc;
+ data.select = select;
+ data.mval[0]= mval[0];
+ data.mval[1]= mval[1];
- bbsel= EM_init_backbuf_circle(vc, mval[0], mval[1], (short)(rad+1.0f));
- EM_backbuf_checkAndSelectTVerts(me, select==LEFTMOUSE);
- EM_free_backbuf();
+ mesh_obmode_foreachScreenVert(vc, mesh_obmode_circle_doSelectVert, &data, 1);
+
+ paintvert_flush_flags(ob);
}
}
@@ -2340,8 +2358,8 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
int select;
select= (gesture_mode==GESTURE_MODAL_SELECT);
-
- if( CTX_data_edit_object(C) || paint_facesel_test(obact) ||
+ // Jason
+ if( CTX_data_edit_object(C) || paint_facesel_test(obact) || paint_vertsel_test(obact) ||
(obact && (obact->mode & (OB_MODE_PARTICLE_EDIT|OB_MODE_POSE))) )
{
ViewContext vc;
@@ -2358,12 +2376,11 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obact->data);
}
else if(paint_facesel_test(obact)) {
- /* Jason */
- if(scene->toolsettings->wp_vert_sel) {
- paint_vertsel_circle_select(&vc, select, mval, (float)radius);
- } else {
- paint_facesel_circle_select(&vc, select, mval, (float)radius);
- }
+ paint_facesel_circle_select(&vc, select, mval, (float)radius);
+ WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obact->data);
+ }/* Jason */
+ else if(paint_vertsel_test(obact)) {
+ paint_vertsel_circle_select(&vc, select, mval, (float)radius);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obact->data);
}
else if(obact->mode & OB_MODE_POSE)
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index 6ad60ac2df9..bbd21a89f0a 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -125,7 +125,7 @@ typedef struct TFace {
#define ME_EDIT_PAINT_MASK (1 << 3)
#define ME_EDIT_MIRROR_TOPO (1 << 4)
-
+#define ME_EDIT_VERT_SEL (1 << 5)// Jason
/* me->flag */
/* #define ME_ISDONE 1 */
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index debe51bf795..251329a04f6 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -724,13 +724,12 @@ typedef struct ToolSettings {
short snap_flag, snap_target;
short proportional, prop_mode;
char proportional_objects; /* proportional edit, object mode */
- char pad[3];
+ char pad[7];
int auto_normalize; /*auto normalizing mode in wpaint*/
//Jason
int multipaint; /* paint multiple bones in wpaint */
- int wp_vert_sel; /* selectable vertices in wpaint */
short sculpt_paint_settings; /* user preferences for sculpt and paint */
short pad1;
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 80c98e8c428..c976dc82be9 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -2077,6 +2077,11 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_FACESEL_HLT, 0);
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+ 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_update(prop, 0, "rna_Mesh_update_draw");
/* readonly editmesh info - use for extrude menu */
prop= RNA_def_property(srna, "total_vert_sel", PROP_INT, PROP_UNSIGNED);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 3c19ea00eca..11a1c3a023d 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1097,12 +1097,6 @@ static void rna_def_tool_settings(BlenderRNA *brna)
"weight painting");
RNA_def_property_update(prop, 0, "rna_update_active_object");
- prop = RNA_def_property(srna, "use_wp_vert_sel", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "wp_vert_sel", 1);
- RNA_def_property_ui_text(prop, "WPaint Vertex Selection",
- "Allow vertices to be selected in Weight Paint Mode ");
- RNA_def_property_update(prop, 0, "rna_update_active_object");
-
prop= RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "vpaint");
RNA_def_property_ui_text(prop, "Vertex Paint", "");