From 423b05390434c310c0f0e59ef62fce79287c581b Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 18 Sep 2008 11:49:57 +0000 Subject: [PATCH] Grease Pencil - Stroke Sensitivity: Sensitivity to mouse movement when drawing can now be customised in the User Prefs, under 'Edit Methods'. --- source/blender/makesdna/DNA_userdef_types.h | 3 ++- source/blender/src/gpencil.c | 7 ++++--- source/blender/src/space.c | 13 +++++++++++++ source/blender/src/usiblender.c | 10 ++++++++-- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 2474161da07..5d36d5ca973 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -188,7 +188,8 @@ typedef struct UserDef { char fontname[256]; // FILE_MAXDIR+FILE length struct ListBase themes; short undosteps; - short undomemory, pad[3]; + short undomemory; + short gp_manhattendist, gp_euclideandist, pad; short curssize; short tb_leftmouse, tb_rightmouse; struct SolidLight light[3]; diff --git a/source/blender/src/gpencil.c b/source/blender/src/gpencil.c index c7540bc4a1f..e51636b6748 100644 --- a/source/blender/src/gpencil.c +++ b/source/blender/src/gpencil.c @@ -992,11 +992,12 @@ void gpencil_convert_menu (void) #define GP_STROKE_BUFFER_MAX 5000 /* Hardcoded sensitivity thresholds... */ -// TODO: one day, these might be added to the UI if it is necessary /* minimum number of pixels mouse should move before new point created */ -#define MIN_MANHATTEN_PX 3 +//#define MIN_MANHATTEN_PX 3 +#define MIN_MANHATTEN_PX U.gp_manhattendist /* minimum length of new segment before new point can be added */ -#define MIN_EUCLIDEAN_PX 20 +//#define MIN_EUCLIDEAN_PX 20 +#define MIN_EUCLIDEAN_PX U.gp_euclideandist /* ------ */ diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 140ec59e360..fb86620201b 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -4055,6 +4055,19 @@ void drawinfospace(ScrArea *sa, void *spacedata) (xpos+edgsp+(8*midsp)+(3*mpref)+(5*spref)),y1,(spref+edgsp),buth, &(U.dupflag), 0, 0, 0, 0, "Causes ipo data to be duplicated with Shift+D"); uiBlockEndAlign(block); + + uiDefBut(block, LABEL,0,"Grease Pencil:", + (xpos+(2*edgsp)+(3*midsp)+(3*mpref)+spref),y6label,mpref,buth, + 0, 0, 0, 0, 0, ""); + + uiBlockBeginAlign(block); + uiDefButS(block, NUM, 0, "Manhatten Dist:", + (xpos+(4*midsp)+(3*mpref)+mpref),y5,mpref,buth, + &(U.gp_manhattendist), 0, 100, 0, 0, "Pixels moved by mouse per axis when drawing stroke"); + uiDefButS(block, NUM, 0, "Euclidean Dist:", + (xpos+(5*midsp)+(3*mpref)+(2*mpref)),y5,mpref,buth, + &(U.gp_euclideandist), 0, 100, 0, 0, "Distance moved by mouse when drawing stroke (in pixels) to include"); + uiBlockEndAlign(block); } else if(U.userpref == 2) { /* language & colors */ diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index aa49065320b..88cdc558f2b 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -480,9 +480,11 @@ static void init_userdef_file(void) if ((G.main->versionfile < 245) || (G.main->versionfile == 245 && G.main->subversionfile < 16)) { U.flag |= USER_ADD_VIEWALIGNED|USER_ADD_EDITMODE; } - if ((G.main->versionfile < 247) || (G.main->versionfile == 247 && G.main->subversionfile < 1)) { + if ((G.main->versionfile < 247) || (G.main->versionfile == 247 && G.main->subversionfile <= 2)) { bTheme *btheme; - for(btheme= U.themes.first; btheme; btheme= btheme->next) { + + /* adjust themes */ + for (btheme= U.themes.first; btheme; btheme= btheme->next) { char *col; /* IPO Editor: Handles/Vertices */ @@ -499,6 +501,10 @@ static void init_userdef_file(void) col = btheme->tv3d.vertex_select; SETCOL(btheme->tseq.vertex_select, col[0], col[1], col[2], 255); } + + /* define grease-pencil distances */ + U.gp_manhattendist= 3; + U.gp_euclideandist= 20; } /* GL Texture Garbage Collection (variable abused above!) */