Ipo Handle vertex have own color and size (Venom request).
authorDiego Borghetti <bdiego@gmail.com>
Tue, 19 Aug 2008 14:39:11 +0000 (14:39 +0000)
committerDiego Borghetti <bdiego@gmail.com>
Tue, 19 Aug 2008 14:39:11 +0000 (14:39 +0000)
Now the vertex of the ipo handle have own color and
size, can be change from Theme -> Ipo Curve Editor:
Handle Vertex - (Default Color)
Handle Vertex Select - (Selected Color)
Handle Size - (Point size, for vertex)

Add subverion so by default the handler have the same
settings that the ipo vertex options.

source/blender/blenkernel/BKE_blender.h
source/blender/include/BIF_resources.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/src/drawipo.c
source/blender/src/resources.c
source/blender/src/space.c
source/blender/src/usiblender.c

index e1eb6718a3069e9d535c7b3f75ce97fe17b06555..e403fc33e068289008df363de47ddaa714b67a43 100644 (file)
@@ -41,7 +41,7 @@ struct ListBase;
 struct MemFile;
 
 #define BLENDER_VERSION                        247
-#define BLENDER_SUBVERSION             0
+#define BLENDER_SUBVERSION             1
 
 #define BLENDER_MINVERSION             245
 #define BLENDER_MINSUBVERSION  15
index df514190270acb8b7d95e9aac3ecb5fec1be0f62..0d27804dd1a6d574b5e8c93a5181151facd76a93 100644 (file)
@@ -524,6 +524,10 @@ enum {
        
        TH_EDGE_SHARP,
        TH_EDITMESH_ACTIVE,
+
+       TH_HANDLE_VERTEX,
+       TH_HANDLE_VERTEX_SELECT,
+       TH_HANDLE_VERTEX_SIZE,
 };
 /* XXX WARNING: previous is saved in file, so do not change order! */
 
index cd1c047dac9a24e8b87510ea2ebe759174b6d488..856324695a9bb9cef32f825fb53ca2e06b86a011 100644 (file)
@@ -101,6 +101,11 @@ typedef struct ThemeSpace {
        char movie[4], image[4], scene[4], audio[4];            // for sequence editor
        char effect[4], plugin[4], transition[4], meta[4];
        char editmesh_active[4]; 
+
+       char handle_vertex[4];
+       char handle_vertex_select[4];
+       char handle_vertex_size;
+       char hpad[7];
 } ThemeSpace;
 
 
index 0e7476bbe8223b04cbd7fddcf00409ae5ead09d3..71854570c8c0c3ab325303e73de0d13ba8ba188b 100644 (file)
@@ -1212,16 +1212,9 @@ static void draw_ipovertices(int sel)
                                        /*}*/
                                } else { /* normal non bit curves */
                                        if(ei->flag & IPO_EDIT) {
-                                               if(ei->icu->ipo==IPO_BEZ) {
-                                                       /* Draw the editmode hendels for a bezier curve */
-                                                       if( (bezt->f1 & SELECT) == sel)/* && G.v2d->cur.xmin < bezt->vec[0][0] < G.v2d->cur.xmax)*/
-                                                               bglVertex3fv(bezt->vec[0]);
-                                                       
-                                                       if( (bezt->f3 & SELECT) == sel)/* && G.v2d->cur.xmin < bezt->vec[2][0] < G.v2d->cur.xmax)*/
-                                                               bglVertex3fv(bezt->vec[2]);
-                                                       
-                                               }
-                                               
+                                               /* Only the vertex of the line, the
+                                                * handler are draw below.
+                                                */
                                                if( (bezt->f2 & SELECT) == sel) /* && G.v2d->cur.xmin < bezt->vec[1][0] < G.v2d->cur.xmax)*/
                                                        bglVertex3fv(bezt->vec[1]);
                                                
@@ -1237,6 +1230,45 @@ static void draw_ipovertices(int sel)
                                bezt++;
                        }
                        bglEnd();
+
+                       if (ei->flag & IPO_EDIT) {
+                               /* Now draw the two vertex of the handler,
+                                * need split it because we can't call glPointSize
+                                * in the middle of a glBegin/glEnd also the
+                                * bug comment before.
+                                */
+                               a= ei->icu->totvert;
+                               bezt= ei->icu->bezt;
+
+                               glPointSize(BIF_GetThemeValuef(TH_HANDLE_VERTEX_SIZE));
+
+                               if(sel) BIF_ThemeColor(TH_HANDLE_VERTEX_SELECT);
+                               else BIF_ThemeColor(TH_HANDLE_VERTEX);
+
+                               bglBegin(GL_POINTS);
+
+                               while(a--) {
+                                       if (ei->disptype!=IPO_DISPBITS) {
+                                               if(ei->flag & IPO_EDIT) {
+                                                       if(ei->icu->ipo==IPO_BEZ) {
+                                                               /* Draw the editmode hendels for a bezier curve */
+                                                               if( (bezt->f1 & SELECT) == sel)/* && G.v2d->cur.xmin < bezt->vec[0][0] < G.v2d->cur.xmax)*/
+                                                                       bglVertex3fv(bezt->vec[0]);
+                                                       
+                                                               if( (bezt->f3 & SELECT) == sel)/* && G.v2d->cur.xmin < bezt->vec[2][0] < G.v2d->cur.xmax)*/
+                                                                       bglVertex3fv(bezt->vec[2]);
+                                                       }
+                                               }
+                                       }
+                                       bezt++;
+                               }
+                               bglEnd();
+
+                               /* The color are always reset (see the while)
+                                * but the point size not so we reset now.
+                                */
+                               glPointSize(BIF_GetThemeValuef(TH_VERTEX_SIZE));
+                       }
                }
        }
        
index f47f14a605cb32c300699b4a900d95bdff9bfeaf..acd14aae7a58daacf758ccfd8a75b15af96d818f 100644 (file)
@@ -313,7 +313,15 @@ char *BIF_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
                                cp= ts->transition; break;
                        case TH_SEQ_META:
                                cp= ts->meta; break;
-                               
+                       case TH_HANDLE_VERTEX:
+                               cp= ts->handle_vertex;
+                               break;
+                       case TH_HANDLE_VERTEX_SELECT:
+                               cp= ts->handle_vertex_select;
+                               break;
+                       case TH_HANDLE_VERTEX_SIZE:
+                               cp= &ts->handle_vertex_size;
+                               break;
                        }
 
                }
@@ -493,6 +501,10 @@ void BIF_InitTheme(void)
        SETCOL(btheme->tipo.hilite, 0x60, 0xc0, 0x40, 255); 
        btheme->tipo.vertex_size= 3;
 
+       SETCOL(btheme->tipo.handle_vertex, 0xff, 0x70, 0xff, 255);
+       SETCOL(btheme->tipo.handle_vertex_select, 0xff, 0xff, 0x70, 255);
+       btheme->tipo.handle_vertex_size= 3;
+
        /* space file */
        /* to have something initialized */
        btheme->tfile= btheme->tv3d;
@@ -684,7 +696,10 @@ char *BIF_ThemeColorsPup(int spacetype)
                        str += sprintf(str, "Vertex %%x%d|", TH_VERTEX);
                        str += sprintf(str, "Vertex Selected %%x%d|", TH_VERTEX_SELECT);
                        str += sprintf(str, "Vertex Size %%x%d|", TH_VERTEX_SIZE);
-                       str += sprintf(str, "Current Frame %%x%d", TH_CFRAME);
+                       str += sprintf(str, "Current Frame %%x%d|", TH_CFRAME);
+                       str += sprintf(str, "Handle Vertex %%x%d|", TH_HANDLE_VERTEX);
+                       str += sprintf(str, "Handle Vertex Selected %%x%d|", TH_HANDLE_VERTEX_SELECT);
+                       str += sprintf(str, "Handle Vertex Size %%x%d", TH_HANDLE_VERTEX_SIZE);
                        break;
                case SPACE_FILE:
                        str += sprintf(str, "Selected file %%x%d", TH_HILITE);
index fb055216f7f3c973160630df5c346fdbba432d98..8787cf9efc44e90e357028e0c25027a0772046a5 100644 (file)
@@ -3492,6 +3492,9 @@ static void info_user_themebuts(uiBlock *block, short y1, short y2, short y3, sh
                uiButSetFunc(but, set_userdef_iconfile_cb, &iconfileindex, NULL);
                                                                        
        }
+       else if(th_curcol==TH_HANDLE_VERTEX_SIZE) {
+               uiDefButC(block, NUMSLI, B_UPDATE_THEME,"Handle size ", 465,y3,200,20, col, 1.0, 10.0, 0, 0, "");
+       }
        else {
                uiBlockBeginAlign(block);
                if ELEM9(th_curcol, TH_PANEL, TH_LAMP, TH_FACE, TH_FACE_SELECT, TH_EDITMESH_ACTIVE, TH_MENU_BACK, TH_MENU_HILITE, TH_MENU_ITEM, TH_NODE) {
index 92e49ab29fad28b6afaf2749aea4dc73acc6ce6e..15c2664a9d898e4532cc94f7c187a49d14a56264 100644 (file)
@@ -477,7 +477,15 @@ 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)) {
+               bTheme *btheme;
+               for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+                       SETCOL(btheme->tipo.handle_vertex, 0xff, 0x70, 0xff, 255);
+                       SETCOL(btheme->tipo.handle_vertex_select, 0xff, 0xff, 0x70, 255);
+                       btheme->tipo.handle_vertex_size= 3;
+               }
+       }
+
        /* GL Texture Garbage Collection (variable abused above!) */
        if (U.textimeout == 0) {
                U.texcollectrate = 60;