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:
authorMartin Poirier <theeth@yahoo.com>2009-11-26 22:47:55 +0300
committerMartin Poirier <theeth@yahoo.com>2009-11-26 22:47:55 +0300
commit74715d00cc466ccb45ed525c12cfd1c7ed29243f (patch)
tree9c22674e455a5dfc2fdc13f3cb4a8e7a1ad572d2 /source/blender/editors/space_view3d/view3d_header.c
parent6ca1c913d3acee63a275259f9a708a1389c23b81 (diff)
First changes to implement the 2.5 snapping proposal (discussed back in May and recently on IRC).
http://wiki.blender.org/index.php/User:Theeth/Snapping The new widget isn't there yet, but the rest works, including: Increment (gears) is now a snap mode Ctrl click to toggle snap on or off (in transform and 3d view) Shift+Ctrl click to select snap mode (3d view only) Snap status (on/off) is persisted in tool settings, no need to always turn it back on when entering transform. It's still possible to have something resembling the old system by editing the transform modal keymap to snap on on ctrl press and snap off on key release.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_header.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c64
1 files changed, 33 insertions, 31 deletions
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 0ec151046d6..84e54abc20c 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -1693,10 +1693,11 @@ static char *snapmode_pup(void)
char *str = string;
str += sprintf(str, "%s", "Snap Element: %t");
- str += sprintf(str, "%s", "|Vertex%x0");
- str += sprintf(str, "%s", "|Edge%x1");
- str += sprintf(str, "%s", "|Face%x2");
- str += sprintf(str, "%s", "|Volume%x3");
+ str += sprintf(str, "%s", "|Increments%x0");
+ str += sprintf(str, "%s", "|Vertex%x1");
+ str += sprintf(str, "%s", "|Edge%x2");
+ str += sprintf(str, "%s", "|Face%x3");
+ str += sprintf(str, "%s", "|Volume%x4");
return string;
}
@@ -2172,36 +2173,37 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
}
/* Snap */
- if (BIF_snappingSupported(obedit)) {
- uiBlockBeginAlign(block);
+ uiBlockBeginAlign(block);
- if (ts->snap_flag & SCE_SNAP) {
- uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Snap with Ctrl during transform (Shift Tab)");
- xco+= XIC;
- if(v3d->modeselect == OB_MODE_OBJECT) {
- uiDefIconButBitS(block, TOG, SCE_SNAP_ROTATE, B_REDR, ICON_SNAP_NORMAL,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Align rotation with the snapping target");
- xco+= XIC;
- }
- if (ts->snap_mode == SCE_SNAP_MODE_VOLUME) {
- uiDefIconButBitS(block, TOG, SCE_SNAP_PEEL_OBJECT, B_REDR, ICON_SNAP_PEEL_OBJECT,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Consider objects as whole when finding volume center");
- xco+= XIC;
- }
- if (ts->snap_mode == SCE_SNAP_MODE_FACE) {
- uiDefIconButBitS(block, TOG, SCE_SNAP_PROJECT, B_REDR, ICON_RETOPO,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Project elements instead of snapping them");
- xco+= XIC;
- }
- uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SNAP_VERTEX, snapmode_pup(), xco,yco,XIC+10,YIC, &(ts->snap_mode), 0.0, 0.0, 0, 0, "Snapping mode");
- xco+= XIC + 10;
- uiDefButS(block, MENU, B_NOP, "Snap Mode%t|Closest%x0|Center%x1|Median%x2|Active%x3",xco,yco,70,YIC, &ts->snap_target, 0, 0, 0, 0, "Snap Target Mode");
- xco+= 70;
- } else {
- uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)");
- xco+= XIC;
- }
+ if (ts->snap_flag & SCE_SNAP) {
+ uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_ON,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Snap during transform (Ctrl)");
+ } else {
+ uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_OFF,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Snap during transform (Ctrl)");
+ }
+ xco+= XIC;
- uiBlockEndAlign(block);
- header_xco_step(ar, &xco, &yco, &maxco, 10);
+ if(v3d->modeselect == OB_MODE_OBJECT && ts->snap_mode != SCE_SNAP_MODE_INCREMENT) {
+ uiDefIconButBitS(block, TOG, SCE_SNAP_ROTATE, B_REDR, ICON_SNAP_NORMAL,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Align rotation with the snapping target");
+ xco+= XIC;
}
+ if (ts->snap_mode == SCE_SNAP_MODE_VOLUME) {
+ uiDefIconButBitS(block, TOG, SCE_SNAP_PEEL_OBJECT, B_REDR, ICON_SNAP_PEEL_OBJECT,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Consider objects as whole when finding volume center");
+ xco+= XIC;
+ }
+ if (ts->snap_mode == SCE_SNAP_MODE_FACE) {
+ uiDefIconButBitS(block, TOG, SCE_SNAP_PROJECT, B_REDR, ICON_RETOPO,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Project elements instead of snapping them");
+ xco+= XIC;
+ }
+ uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SNAP_INCREMENT, snapmode_pup(), xco,yco,XIC+10,YIC, &(ts->snap_mode), 0.0, 0.0, 0, 0, "Snapping mode");
+ xco+= XIC + 10;
+ if(ts->snap_mode != SCE_SNAP_MODE_INCREMENT) {
+ uiDefButS(block, MENU, B_NOP, "Snap Mode%t|Closest%x0|Center%x1|Median%x2|Active%x3",xco,yco,70,YIC, &ts->snap_target, 0, 0, 0, 0, "Snap Target Mode");
+ xco+= 70;
+ }
+
+ uiBlockEndAlign(block);
+ header_xco_step(ar, &xco, &yco, &maxco, 10);
+
/* selection modus */
if(obedit && (obedit->type == OB_MESH)) {