diff options
Diffstat (limited to 'source/blender/src/header_view3d.c')
-rw-r--r-- | source/blender/src/header_view3d.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index 359d5e9850a..f787994ca9b 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -1703,16 +1703,13 @@ static void do_view3d_transformmenu(void *arg, int event) G.vd->flag2 |= V3D_TRANSFORM_SNAP; break; case 17: - G.vd->flag2 &= ~V3D_SNAP_TARGET; - G.vd->flag2 |= V3D_SNAP_TARGET_CLOSEST; + G.vd->snap_target = V3D_SNAP_TARGET_CLOSEST; break; case 18: - G.vd->flag2 &= ~V3D_SNAP_TARGET; - G.vd->flag2 |= V3D_SNAP_TARGET_CENTER; + G.vd->snap_target = V3D_SNAP_TARGET_CENTER; break; case 19: - G.vd->flag2 &= ~V3D_SNAP_TARGET; - G.vd->flag2 |= V3D_SNAP_TARGET_MEDIAN; + G.vd->snap_target = V3D_SNAP_TARGET_MEDIAN; break; } allqueue(REDRAWVIEW3D, 0); @@ -1782,7 +1779,7 @@ static uiBlock *view3d_transformmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - switch(G.vd->flag2 & V3D_SNAP_TARGET) + switch(G.vd->snap_target) { case V3D_SNAP_TARGET_CLOSEST: uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap Closest", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, ""); @@ -5102,6 +5099,27 @@ void view3d_buttons(void) xco+= 10; } + /* Snap */ + if(G.obedit && (G.obedit->type == OB_MESH)) { // Only Mesh for now + uiBlockBeginAlign(block); + + if (G.vd->flag2 & V3D_TRANSFORM_SNAP) + { + uiDefIconButBitS(block, TOG, V3D_TRANSFORM_SNAP, B_REDR, ICON_SNAP_GEO,xco,0,XIC,YIC, &G.vd->flag2, 0, 0, 0, 0, "Use Snapping or Gears (Shift Tab)"); + xco+= XIC; + uiDefButS(block, MENU, B_NOP, "Mode%t|Closest%x0|Center%x1|Median%x2",xco,0,70,YIC, &G.vd->snap_target, 0, 0, 0, 0, "Snap Target Mode"); + xco+= 70; + } + else + { + uiDefIconButBitS(block, TOG, V3D_TRANSFORM_SNAP, B_REDR, ICON_SNAP_GEAR,xco,0,XIC,YIC, &G.vd->flag2, 0, 0, 0, 0, "Use Snapping or Gears (Shift Tab)"); + xco+= XIC; + } + + uiBlockEndAlign(block); + xco+= 10; + } + /* selection modus */ if(G.obedit && (G.obedit->type == OB_MESH)) { uiBlockBeginAlign(block); |