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:
authorCampbell Barton <ideasman42@gmail.com>2006-01-25 01:07:41 +0300
committerCampbell Barton <ideasman42@gmail.com>2006-01-25 01:07:41 +0300
commit7bb69869e09a82a6906fc8a3f7b48779dcc4fe09 (patch)
treef79f0d6f507e098dd9eda15690f3973b1ca70bc1 /source/blender/src
parentf0dae325c30b53bbd1c46bd39be91749aa6712ff (diff)
Made numbuts use non linear rate of change when dragging.
The further you drag the bigger the number gets (like gimp/photoshop brush size slider) Works for ranges: float buttons bigger then 11 and int buttons bigger then 129.
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/interface.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index 7ebaf09e60f..d51859b34f8 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -1987,7 +1987,7 @@ static int ui_do_but_NUM(uiBut *but)
{
double value;
float deler, fstart, f, tempf;
- int lvalue, temp; /* , firsttime=1; */
+ int lvalue, temp, orig_x; /* , firsttime=1; */
short retval=0, qual, sx, mval[2], pos=0;
but->flag |= UI_SELECT;
@@ -1998,6 +1998,7 @@ static int ui_do_but_NUM(uiBut *but)
value= ui_get_but_val(but);
sx= mval[0];
+ orig_x = sx; /* Store so we can scale the rate of change by the dist the mouse is from its original xlocation */
fstart= (value - but->min)/(but->max-but->min);
f= fstart;
@@ -2013,21 +2014,30 @@ static int ui_do_but_NUM(uiBut *but)
while (get_mbut() & L_MOUSE) {
qual= get_qual();
+ uiGetMouse(mywinget(), mval);
+
deler= 500;
if( but->pointype!=FLO ) {
if( (but->max-but->min)<100 ) deler= 200.0;
if( (but->max-but->min)<25 ) deler= 50.0;
-
}
+
if(qual & LR_SHIFTKEY) deler*= 10.0;
if(qual & LR_ALTKEY) deler*= 20.0;
-
- uiGetMouse(mywinget(), mval);
if(mval[0] != sx) {
-
- f+= ((float)(mval[0]-sx))/deler;
+ if( but->pointype==FLO && but->max-but->min > 11) {
+ /* non linear change in mouse input- good for high precicsion */
+ f+= (((float)(mval[0]-sx))/deler) * (fabs(orig_x-mval[0])*0.002);
+ } else if ( but->pointype!=FLO && but->max-but->min > 129) { /* only scale large int buttons */
+ /* non linear change in mouse input- good for high precicsionm ints need less fine tuning */
+ f+= (((float)(mval[0]-sx))/deler) * (fabs(orig_x-mval[0])*0.004);
+ } else {
+ /*no scaling */
+ f+= ((float)(mval[0]-sx))/deler ;
+ }
+
if(f>1.0) f= 1.0;
if(f<0.0) f= 0.0;
sx= mval[0];