Grease Pencil - Stroke Sensitivity:
authorJoshua Leung <aligorith@gmail.com>
Thu, 18 Sep 2008 11:49:57 +0000 (11:49 +0000)
committerJoshua Leung <aligorith@gmail.com>
Thu, 18 Sep 2008 11:49:57 +0000 (11:49 +0000)
Sensitivity to mouse movement when drawing can now be customised in the User Prefs, under 'Edit Methods'.

source/blender/makesdna/DNA_userdef_types.h
source/blender/src/gpencil.c
source/blender/src/space.c
source/blender/src/usiblender.c

index 2474161da07f72803e1f629242e7b07683aeb3d9..5d36d5ca973b7c05cb182cbe9a17ce1d592eb914 100644 (file)
@@ -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];
index c7540bc4a1f25c11b99784c253f2e12dbc3a18f2..e51636b6748b8348e145eb089092788033e9cd52 100644 (file)
@@ -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
 
 /* ------ */
 
index 140ec59e360511b7da639f594433abd3cd455934..fb86620201bc0c9646a7efbf53d640a449cbdbf4 100644 (file)
@@ -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 */
 
index aa49065320b099ec11687f8effe2cbaa91131faa..88cdc558f2bb6fc660f35c193427263cd99a86f5 100644 (file)
@@ -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!) */