Added colorpicker support for theme editor
authorTon Roosendaal <ton@blender.org>
Thu, 22 Jul 2004 13:40:17 +0000 (13:40 +0000)
committerTon Roosendaal <ton@blender.org>
Thu, 22 Jul 2004 13:40:17 +0000 (13:40 +0000)
source/blender/src/interface.c
source/blender/src/space.c

index 22b7189cc9248b0232d2c0d24face3301c0c5967..3e4f09a664027a40d01d4bc75763ad36949a93de 100644 (file)
@@ -2262,20 +2262,30 @@ static int ui_do_but_COL(uiBut *but)
 {
        uiBlock *block;
        ListBase listb={NULL, NULL};
-       float hsv[3], old[3];
+       float hsv[3], old[3], *poin= NULL, colstore[3];
        short event;
        
        // signal to prevent calling up color picker
-       if(but->a1 == -1 || but->pointype!=FLO) {
+       if(but->a1 == -1) {
                uibut_do_func(but);
                return but->retval;
        }
        
+       // enable char button too, use temporal colstore for color
+       if(but->pointype!=FLO) {
+               if(but->pointype==CHA) {
+                       ui_get_but_vectorf(but, colstore);
+                       poin= colstore;
+               }
+               else return but->retval;
+       }
+       else poin= (float *)but->poin;
+       
        block= uiNewBlock(&listb, "colorpicker", UI_EMBOSSP, UI_HELV, but->win);
        block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW;
        block->themecol= TH_BUT_NUM;
        
-       uiBlockPickerButtons(block, (float *)but->poin, hsv, old, 't');
+       uiBlockPickerButtons(block, poin, hsv, old, 't');
 
        /* and lets go */
        block->direction= UI_TOP;
@@ -2283,6 +2293,8 @@ static int ui_do_but_COL(uiBut *but)
        block->win= G.curscreen->mainwin;
        event= uiDoBlocks(&listb, 0);
        
+       if(but->pointype==CHA) ui_set_but_vectorf(but, colstore);
+       
        return but->retval;
 
 }
index 39cfe795426e8bd245ec44983962806db3575c7b..88ce12fa0cad15afb6e650d338021b463039f17d 100644 (file)
@@ -1981,7 +1981,7 @@ void info_user_themebuts(uiBlock *block, short y1, short y2, short y3)
                uiDefButC(block, NUMSLI, B_UPDATE_THEME,"B ",   465,y1,200,20,  col+2, 0.0, 255.0, B_THEMECOL, 0, "");
                uiBlockEndAlign(block);
 
-               uiDefButC(block, COL, B_THEMECOL, "",           675,y1,50,y3-y1+20, col, 0, 0, 0, 0, "");
+               uiDefButC(block, COL, B_UPDATE_THEME, "",               675,y1,50,y3-y1+20, col, 0, 0, 0, 0, "");
                                
                /* copy paste */
                uiBlockBeginAlign(block);