From 08d54e71eaf7624dec3bb473dfa941faa04b85af Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Wed, 13 Feb 2008 13:26:46 +0000 Subject: [PATCH] * "Drag Immediately" transform user preference. It's already supported within transform, was previously known as 'tweak mode' and for some odd reason was a compile time option. This brings it to a user preference (in 'Edit Methods' section). Basically it means that you don't need the extra click at the end to confirm a drag-move transform, if you're already dragged, you can just let go of the mouse rather than needing to click again. It's a lot more comfortable when you're used to using other applications as well as blender, and much more sensible for tablets. This started life as patch #7144 by Ed Britton, but this implementation has been changed considerably. --- source/blender/makesdna/DNA_userdef_types.h | 1 + source/blender/src/editaction.c | 9 ++++--- source/blender/src/editipo.c | 5 ++-- source/blender/src/editnla.c | 8 +++--- source/blender/src/editobject.c | 11 +++----- source/blender/src/space.c | 30 +++++++++++++-------- 6 files changed, 37 insertions(+), 27 deletions(-) diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index b22966e61d8..9d0c44d87c9 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -236,6 +236,7 @@ extern UserDef U; /* from usiblender.c !!!! */ #define USER_ADD_EDITMODE (1 << 18) #define USER_ADD_VIEWALIGNED (1 << 19) #define USER_RELPATHS (1 << 20) +#define USER_DRAGIMMEDIATE (1 << 21) /* viewzom */ #define USER_ZOOM_CONT 0 diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 9cb2982f422..0737a285ef3 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -1125,6 +1125,7 @@ void transform_action_keys (int mode, int dummy) { void *data; short datatype; + short context = (U.flag & USER_DRAGIMMEDIATE)?CTX_TWEAK:CTX_NONE; /* determine what type of data we are operating on */ data = get_action_context(&datatype); @@ -1133,25 +1134,25 @@ void transform_action_keys (int mode, int dummy) switch (mode) { case 'g': { - initTransform(TFM_TIME_TRANSLATE, CTX_NONE); + initTransform(TFM_TIME_TRANSLATE, context); Transform(); } break; case 's': { - initTransform(TFM_TIME_SCALE, CTX_NONE); + initTransform(TFM_TIME_SCALE, context); Transform(); } break; case 't': { - initTransform(TFM_TIME_SLIDE, CTX_NONE); + initTransform(TFM_TIME_SLIDE, context); Transform(); } break; case 'e': { - initTransform(TFM_TIME_EXTEND, CTX_NONE); + initTransform(TFM_TIME_EXTEND, context); Transform(); } break; diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c index af762c037d9..dab2a0398b7 100644 --- a/source/blender/src/editipo.c +++ b/source/blender/src/editipo.c @@ -5316,6 +5316,7 @@ void remake_ipo_transdata (TransInfo *t) void transform_ipo (int mode) { short tmode; + short context = (U.flag & USER_DRAGIMMEDIATE)?CTX_TWEAK:CTX_NONE; /* data-validation */ if (G.sipo->ipo && G.sipo->ipo->id.lib) return; @@ -5341,12 +5342,12 @@ void transform_ipo (int mode) get_status_editipo(); if (totipo_vertsel) { /* we're probably in editmode, so only selected verts - transform system */ - initTransform(tmode, CTX_NONE); + initTransform(tmode, context); Transform(); } else if (totipo_edit==0 && totipo_sel!=0) { /* we're not in editmode, so entire curves get moved - transform system*/ - initTransform(tmode, CTX_NONE); + initTransform(tmode, context); Transform(); } else { diff --git a/source/blender/src/editnla.c b/source/blender/src/editnla.c index 44e3cf739a4..0fc8baae154 100644 --- a/source/blender/src/editnla.c +++ b/source/blender/src/editnla.c @@ -1010,22 +1010,24 @@ static void recalc_all_ipos(void) void transform_nlachannel_keys(int mode, int dummy) { + short context = (U.flag & USER_DRAGIMMEDIATE)?CTX_TWEAK:CTX_NONE; + switch (mode) { case 'g': { - initTransform(TFM_TIME_TRANSLATE, CTX_NONE); + initTransform(TFM_TIME_TRANSLATE, context); Transform(); } break; case 's': { - initTransform(TFM_TIME_SCALE, CTX_NONE); + initTransform(TFM_TIME_SCALE, context); Transform(); } break; case 'e': { - initTransform(TFM_TIME_EXTEND, CTX_NONE); + initTransform(TFM_TIME_EXTEND, context); Transform(); } break; diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 2040d8aedf6..e6edb472fc3 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -4063,6 +4063,7 @@ void std_rmouse_transform(void (*xf_func)(int, int)) short xo, yo; short timer=0; short mousebut; + short context = (U.flag & USER_DRAGIMMEDIATE)?CTX_TWEAK:CTX_NONE; /* check for left mouse select/right mouse select */ @@ -4076,20 +4077,16 @@ void std_rmouse_transform(void (*xf_func)(int, int)) getmouseco_areawin(mval); xo= mval[0]; yo= mval[1]; - + while(get_mbut() & mousebut) { getmouseco_areawin(mval); if(abs(mval[0]-xo)+abs(mval[1]-yo) > 10) { if(curarea->spacetype==SPACE_VIEW3D) { -#ifdef TWEAK_MODE - initTransform(TFM_TRANSLATION, CTX_TWEAK); -#else - initTransform(TFM_TRANSLATION, CTX_NONE); -#endif + initTransform(TFM_TRANSLATION, context); Transform(); } else if(curarea->spacetype==SPACE_IMAGE) { - initTransform(TFM_TRANSLATION, CTX_NONE); + initTransform(TFM_TRANSLATION, context); Transform(); } else if(xf_func) diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 6bd773e7359..e4f4d24ed23 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -3454,33 +3454,37 @@ void drawinfospace(ScrArea *sa, void *spacedata) else if (U.userpref == 0) { /* view & controls */ uiDefBut(block, LABEL,0,"Display:", - xpos,y6label,spref,buth, + xpos,y7label,spref,buth, 0, 0, 0, 0, 0, ""); uiBlockBeginAlign(block); uiDefButBitI(block, TOG, USER_TOOLTIPS, 0, "Tool Tips", - (xpos+edgsp),y5,spref,buth, + (xpos+edgsp),y6,spref,buth, &(U.flag), 0, 0, 0, 0, "Display tooltips (help tags) over buttons"); uiDefButBitI(block, TOG, USER_DRAWVIEWINFO, B_DRAWINFO, "Object Info", - (xpos+edgsp),y4,spref,buth, + (xpos+edgsp),y5,spref,buth, &(U.uiflag), 0, 0, 0, 0, "Display active object name and frame number in the 3D View"); uiDefButBitI(block, TOG, USER_SCENEGLOBAL, 0, "Global Scene", - (xpos+edgsp),y3,spref,buth, + (xpos+edgsp),y4,spref,buth, &(U.flag), 0, 0, 0, 0, "Forces the current Scene to be displayed in all Screens"); #ifndef __APPLE__ uiDefButBitS(block, TOG, 1, 0, "Large Cursors", - (xpos+edgsp),y2,spref,buth, + (xpos+edgsp),y3,spref,buth, &(U.curssize), 0, 0, 0, 0, "Use large mouse cursors when available"); #else U.curssize=0; /*Small Cursor always for OS X for now */ #endif uiDefButBitI(block, TOG, USER_SHOW_VIEWPORTNAME, B_DRAWINFO, "View Name", - (xpos+edgsp),y1,spref,buth, + (xpos+edgsp),y2,spref,buth, &(U.uiflag), 0, 0, 0, 0, "Show the name of the view's direction in each 3D View"); + uiDefButBitI(block, TOG, USER_SHOW_FPS, B_DRAWINFO, "Playback FPS", + (xpos+edgsp),y1,spref,buth, + &(U.uiflag), 0, 0, 0, 0, + "Show the frames per second screen refresh rate, while animation is played back"); uiBlockEndAlign(block); uiDefBut(block, LABEL,0,"Menus:", @@ -3622,15 +3626,11 @@ void drawinfospace(ScrArea *sa, void *spacedata) 0, 0, 0, 0, 0, ""); } - uiDefButBitI(block, TOG, USER_SHOW_FPS, B_DRAWINFO, "Display FPS in View", - (xpos+edgsp+(3*mpref)+(4*midsp)),y2,mpref,buth, - &(U.uiflag), 0, 0, 0, 0, - "Display the number of frames per secons being drawn"); - /* illegal combo... */ if (U.flag & USER_LMOUSESELECT) U.flag &= ~USER_TWOBUTTONMOUSE; + uiBlockBeginAlign(block); uiDefButBitI(block, TOG, USER_TWOBUTTONMOUSE, B_DRAWINFO, "Emulate 3 Button Mouse", (xpos+edgsp+(3*mpref)+(4*midsp)),y3,mpref,buth, &(U.flag), 0, 0, 0, 0, @@ -3741,6 +3741,14 @@ void drawinfospace(ScrArea *sa, void *spacedata) uiBlockEndAlign(block); + uiDefBut(block, LABEL,0,"Transform:", + (xpos+(2*edgsp)+mpref),y5label, mpref,buth, + 0, 0, 0, 0, 0, ""); + uiDefButBitI(block, TOG, USER_DRAGIMMEDIATE, B_DRAWINFO, "Drag Immediately", + (xpos+edgsp+mpref+midsp),y4,mpref,buth, + &(U.flag), 0, 0, 0, 0, "Moving things with a mouse drag doesn't require a click to confirm (Best for tablet users)"); + uiBlockEndAlign(block); + uiDefBut(block, LABEL,0,"Undo:", (xpos+(2*edgsp)+mpref),y3label, mpref,buth, 0, 0, 0, 0, 0, "");