From ada9ca9687cb70d02d1a6afebbb865d2080ddf1b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 30 Jan 2010 01:25:02 +0000 Subject: [PATCH] [#20487] Small bug in 3d window's header in edit mode. [#20713] vertex, edge and face toggling acts like shift select (in 2.49) with or without shift pressed revert own changes from 26035 - python buttons were toggles so clicking on 1 didnt disable the others. - for some reason the layout engine wasnt working right here and made the buttons skilly in localview. --- release/scripts/ui/space_view3d.py | 4 ++++ source/blender/editors/space_view3d/view3d_header.c | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index f727ec22823..943b07d6af6 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -56,11 +56,15 @@ class VIEW3D_HT_header(bpy.types.Header): row.template_header_3D() + # do in C for now since these buttons cant be both toggle AND exclusive. + ''' if obj and obj.mode == 'EDIT' and obj.type == 'MESH': row_sub = row.row(align=True) row_sub.prop(toolsettings, "mesh_selection_mode", text="", index=0, icon='VERTEXSEL') row_sub.prop(toolsettings, "mesh_selection_mode", text="", index=1, icon='EDGESEL') row_sub.prop(toolsettings, "mesh_selection_mode", text="", index=2, icon='FACESEL') + ''' + # Particle edit if obj and obj.mode == 'PARTICLE_EDIT': diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 3ef6166bc7c..bf774442812 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -533,4 +533,17 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) /* Scene lock */ uiItemR(layout, "", 0, &v3dptr, "lock_camera_and_layers", UI_ITEM_R_ICON_ONLY); } + + /* selection modus, dont use python for this since it cant do the toggle buttons with shift+click as well as clicking to set one. */ + if(obedit && (obedit->type == OB_MESH)) { + EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); + + row= uiLayoutRow(layout, 1); + block= uiLayoutGetBlock(row); + uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode"); + uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Edge select mode"); + uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Face select mode"); + + BKE_mesh_end_editmesh(obedit->data, em); + } }