diff options
author | Ton Roosendaal <ton@blender.org> | 2006-11-16 23:55:11 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-11-16 23:55:11 +0300 |
commit | 7686e2cc5c1fba8ed8c2a9b4fc2698fb10e12f9f (patch) | |
tree | 1632b4f14a0e1c92674f9e3f302d1803e1ed606c /source | |
parent | 8f2ad64f3de00116dfb85d6b7675ade03b4fabf2 (diff) |
New stuff:
- Weight paint options now also show in Nkey panel
- added uiNewPanelTitle() in interface API to rename panels. In use now
for the Nkey panel title.
(Note: original name is identifier, do not change that)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/include/BIF_interface.h | 5 | ||||
-rw-r--r-- | source/blender/include/butspace.h | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_screen_types.h | 1 | ||||
-rw-r--r-- | source/blender/src/buttons_editing.c | 109 | ||||
-rw-r--r-- | source/blender/src/drawview.c | 6 | ||||
-rw-r--r-- | source/blender/src/interface_panel.c | 23 |
6 files changed, 85 insertions, 60 deletions
diff --git a/source/blender/include/BIF_interface.h b/source/blender/include/BIF_interface.h index 0f263096792..0e944857409 100644 --- a/source/blender/include/BIF_interface.h +++ b/source/blender/include/BIF_interface.h @@ -306,8 +306,9 @@ extern void uiMatchPanel_view2d(struct ScrArea *sa); extern void uiDrawBlocksPanels(struct ScrArea *sa, int re_align); extern void uiNewPanelHeight(struct uiBlock *block, int sizey); -void uiPanelPush(uiBlock *block); -void uiPanelPop(uiBlock *block); +extern void uiNewPanelTitle(struct uiBlock *block, char *str); +extern void uiPanelPush(struct uiBlock *block); +extern void uiPanelPop(struct uiBlock *block); extern uiBlock *uiFindOpenPanelBlockName(ListBase *lb, char *name); extern int uiAlignPanelStep(struct ScrArea *sa, float fac); extern void uiPanelControl(int); diff --git a/source/blender/include/butspace.h b/source/blender/include/butspace.h index 53779f4f3d5..9c37e4ab4b5 100644 --- a/source/blender/include/butspace.h +++ b/source/blender/include/butspace.h @@ -99,6 +99,7 @@ extern void do_fpaintbuts(unsigned short event); extern void do_cambuts(unsigned short event); extern void do_armbuts(unsigned short event); extern void do_uvcalculationbuts(unsigned short event); +extern void weight_paint_buttons(struct uiBlock *); extern char *get_vertexgroup_menustr(struct Object *ob); // used in object buttons diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 7aab508c473..cf3c2eaa168 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -83,6 +83,7 @@ typedef unsigned short dna_ushort_fix; typedef struct Panel { /* the part from uiBlock that needs saved in file */ struct Panel *next, *prev; char panelname[64], tabname[64]; /* defined as UI_MAX_NAME_STR */ + char drawname[64]; /* panelname is identifier for restoring location */ short ofsx, ofsy, sizex, sizey; short flag, active; /* active= used currently by a uiBlock */ short control; diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index ce6ff2d56f8..31ce191cf77 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -4449,6 +4449,62 @@ void do_fpaintbuts(unsigned short event) /* -------------------- MODE: vpaint ------------------- */ +void weight_paint_buttons(uiBlock *block) +{ + extern VPaint Gwp; /* from vpaint */ + Object *ob; + ob= OBACT; + + if(ob==NULL) return; + + uiBlockBeginAlign(block); + uiDefButF(block, NUMSLI, REDRAWVIEW3D, "Weight:",10,160,225,19, &editbutvweight, 0, 1, 10, 0, "Sets the current vertex group's bone deformation strength"); + + uiDefBut(block, BUT, B_WEIGHT0_0 , "0", 10,140,45,19, 0, 0, 0, 0, 0, ""); + uiDefBut(block, BUT, B_WEIGHT1_4 , "1/4", 55,140,45,19, 0, 0, 0, 0, 0, ""); + uiDefBut(block, BUT, B_WEIGHT1_2 , "1/2", 100,140,45,19, 0, 0, 0, 0, 0, ""); + uiDefBut(block, BUT, B_WEIGHT3_4 , "3/4", 145,140,45,19, 0, 0, 0, 0, 0, ""); + uiDefBut(block, BUT, B_WEIGHT1_0 , "1", 190,140,45,19, 0, 0, 0, 0, 0, ""); + + uiDefButF(block, NUMSLI, B_NOP, "Opacity ", 10,120,225,19, &Gwp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush"); + + uiDefBut(block, BUT, B_OPA1_8 , "1/8", 10,100,45,19, 0, 0, 0, 0, 0, ""); + uiDefBut(block, BUT, B_OPA1_4 , "1/4", 55,100,45,19, 0, 0, 0, 0, 0, ""); + uiDefBut(block, BUT, B_OPA1_2 , "1/2", 100,100,45,19, 0, 0, 0, 0, 0, ""); + uiDefBut(block, BUT, B_OPA3_4 , "3/4", 145,100,45,19, 0, 0, 0, 0, 0, ""); + uiDefBut(block, BUT, B_OPA1_0 , "1", 190,100,45,19, 0, 0, 0, 0, 0, ""); + + uiDefButF(block, NUMSLI, B_NOP, "Size ", 10,80,225,19, &Gwp.size, 2.0, 64.0, 0, 0, "The size of the brush"); + + uiBlockBeginAlign(block); + uiDefButS(block, ROW, B_DIFF, "Mix", 250,160,60,17, &Gwp.mode, 1.0, 0.0, 0, 0, "Mix the vertex colors"); + uiDefButS(block, ROW, B_DIFF, "Add", 250,142,60,17, &Gwp.mode, 1.0, 1.0, 0, 0, "Add the vertex colors"); + uiDefButS(block, ROW, B_DIFF, "Sub", 250,124,60,17, &Gwp.mode, 1.0, 2.0, 0, 0, "Subtract from the vertex color"); + uiDefButS(block, ROW, B_DIFF, "Mul", 250,106,60,17, &Gwp.mode, 1.0, 3.0, 0, 0, "Multiply the vertex color"); + uiDefButS(block, ROW, B_DIFF, "Filter", 250, 88,60,17, &Gwp.mode, 1.0, 4.0, 0, 0, "Mix the colors with an alpha factor"); + uiDefButS(block, ROW, B_DIFF, "Lighter", 250, 70,60,17, &Gwp.mode, 1.0, 5.0, 0, 0, "Paint over darker areas only"); + uiDefButS(block, ROW, B_DIFF, "Darker", 250, 52,60,17, &Gwp.mode, 1.0, 6.0, 0, 0, "Paint over lighter areas only"); + uiBlockEndAlign(block); + + uiDefButBitS(block, TOG, VP_SPRAY, 0, "Spray", 160,55,75,19, &Gwp.flag, 0, 0, 0, 0, "Keep applying paint effect while holding mouse"); + + uiBlockBeginAlign(block); + uiDefButBitS(block, TOG, VP_AREA, 0, "All Faces", 10,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Paint on all faces inside brush (otherwise only on face under mouse cursor)"); + uiDefButBitS(block, TOG, VP_SOFT, 0, "Vertex Dist", 85,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Use distances to vertices (instead of all vertices of face)"); + uiDefButBitS(block, TOGN, VP_HARD, 0, "Soft", 160,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Use a soft brush"); + uiDefButBitS(block, TOG, VP_NORMALS, 0, "Normals", 235,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Applies the vertex normal before painting"); + + if(ob){ + uiBlockBeginAlign(block); + uiDefButBitS(block, TOG, VP_ONLYVGROUP, 0, "Vgroup", 10,0,75,19, &Gwp.flag, 0, 0, 0, 0, "Only paint on verteces in the selected vertex group."); + uiDefButBitS(block, TOG, VP_MIRROR_X, REDRAWVIEW3D, "X-Mirror", 85,0,75,19, &Gwp.flag, 0, 0, 0, 0, "Mirrored Paint, applying on mirrored Weight Group name"); + uiDefButBitC(block, TOG, OB_DRAWWIRE, REDRAWVIEW3D, "Wire", 160,0,75,19, &ob->dtx, 0, 0, 0, 0, "Displays the active object's wireframe in shaded drawing modes"); + uiDefBut(block, BUT, B_CLR_WPAINT, "Clear", 235,0,75,19, NULL, 0, 0, 0, 0, "Removes reference to this deform group from all vertices"); + uiBlockEndAlign(block); + + } +} + static void editing_panel_mesh_paint(void) { uiBlock *block; @@ -4458,58 +4514,7 @@ static void editing_panel_mesh_paint(void) if(G.f & G_WEIGHTPAINT) { - extern VPaint Gwp; /* from vpaint */ - Object *ob; - ob= OBACT; - - if(ob==NULL) return; - - uiBlockBeginAlign(block); - uiDefButF(block, NUMSLI, REDRAWVIEW3D, "Weight:",10,160,225,19, &editbutvweight, 0, 1, 10, 0, "Sets the current vertex group's bone deformation strength"); - - uiDefBut(block, BUT, B_WEIGHT0_0 , "0", 10,140,45,19, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT, B_WEIGHT1_4 , "1/4", 55,140,45,19, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT, B_WEIGHT1_2 , "1/2", 100,140,45,19, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT, B_WEIGHT3_4 , "3/4", 145,140,45,19, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT, B_WEIGHT1_0 , "1", 190,140,45,19, 0, 0, 0, 0, 0, ""); - - uiDefButF(block, NUMSLI, B_NOP, "Opacity ", 10,120,225,19, &Gwp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush"); - - uiDefBut(block, BUT, B_OPA1_8 , "1/8", 10,100,45,19, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT, B_OPA1_4 , "1/4", 55,100,45,19, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT, B_OPA1_2 , "1/2", 100,100,45,19, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT, B_OPA3_4 , "3/4", 145,100,45,19, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT, B_OPA1_0 , "1", 190,100,45,19, 0, 0, 0, 0, 0, ""); - - uiDefButF(block, NUMSLI, B_NOP, "Size ", 10,80,225,19, &Gwp.size, 2.0, 64.0, 0, 0, "The size of the brush"); - - uiBlockBeginAlign(block); - uiDefButS(block, ROW, B_DIFF, "Mix", 250,160,60,17, &Gwp.mode, 1.0, 0.0, 0, 0, "Mix the vertex colors"); - uiDefButS(block, ROW, B_DIFF, "Add", 250,142,60,17, &Gwp.mode, 1.0, 1.0, 0, 0, "Add the vertex colors"); - uiDefButS(block, ROW, B_DIFF, "Sub", 250,124,60,17, &Gwp.mode, 1.0, 2.0, 0, 0, "Subtract from the vertex color"); - uiDefButS(block, ROW, B_DIFF, "Mul", 250,106,60,17, &Gwp.mode, 1.0, 3.0, 0, 0, "Multiply the vertex color"); - uiDefButS(block, ROW, B_DIFF, "Filter", 250, 88,60,17, &Gwp.mode, 1.0, 4.0, 0, 0, "Mix the colors with an alpha factor"); - uiDefButS(block, ROW, B_DIFF, "Lighter", 250, 70,60,17, &Gwp.mode, 1.0, 5.0, 0, 0, "Paint over darker areas only"); - uiDefButS(block, ROW, B_DIFF, "Darker", 250, 52,60,17, &Gwp.mode, 1.0, 6.0, 0, 0, "Paint over lighter areas only"); - uiBlockEndAlign(block); - - uiDefButBitS(block, TOG, VP_SPRAY, 0, "Spray", 160,55,75,19, &Gwp.flag, 0, 0, 0, 0, "Keep applying paint effect while holding mouse"); - - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, VP_AREA, 0, "All Faces", 10,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Paint on all faces inside brush (otherwise only on face under mouse cursor)"); - uiDefButBitS(block, TOG, VP_SOFT, 0, "Vertex Dist", 85,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Use distances to vertices (instead of all vertices of face)"); - uiDefButBitS(block, TOGN, VP_HARD, 0, "Soft", 160,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Use a soft brush"); - uiDefButBitS(block, TOG, VP_NORMALS, 0, "Normals", 235,30,75,19, &Gwp.flag, 0, 0, 0, 0, "Applies the vertex normal before painting"); - - if(ob){ - uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, VP_ONLYVGROUP, 0, "Vgroup", 10,0,75,19, &Gwp.flag, 0, 0, 0, 0, "Only paint on verteces in the selected vertex group."); - uiDefButBitS(block, TOG, VP_MIRROR_X, REDRAWVIEW3D, "X-Mirror", 85,0,75,19, &Gwp.flag, 0, 0, 0, 0, "Mirrored Paint, applying on mirrored Weight Group name"); - uiDefButBitC(block, TOG, OB_DRAWWIRE, REDRAWVIEW3D, "Wire", 160,0,75,19, &ob->dtx, 0, 0, 0, 0, "Displays the active object's wireframe in shaded drawing modes"); - uiDefBut(block, BUT, B_CLR_WPAINT, "Clear", 235,0,75,19, NULL, 0, 0, 0, 0, "Removes reference to this deform group from all vertices"); - uiBlockEndAlign(block); - - } + weight_paint_buttons(block); } else if(G.f & G_VERTEXPAINT) { extern VPaint Gvp; /* from vpaint */ diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index 46c7beeedcc..ae332c07b1b 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -2284,11 +2284,17 @@ static void view3d_panel_object(short cntrl) // VIEW3D_HANDLER_OBJECT if(G.f & G_VERTEXPAINT) rgb= &Gvp.r; else if(settings->imapaint.brush) rgb= settings->imapaint.brush->rgb; + uiNewPanelTitle(block, "Paint Properties"); if (rgb) /* 'f' is for floating panel */ uiBlockPickerButtons(block, rgb, hsv, old, hexcol, 'f', REDRAWBUTSEDIT); } + else if(G.f & G_WEIGHTPAINT) { + uiNewPanelTitle(block, "Weight Paint Properties"); + weight_paint_buttons(block); + } else if(G.f & G_SCULPTMODE) { + uiNewPanelTitle(block, "Sculpt Properties"); sculptmode_draw_interface_tools(block,10,150); sculptmode_draw_interface_textures(block,220,150); } else { diff --git a/source/blender/src/interface_panel.c b/source/blender/src/interface_panel.c index 36dca12ee67..1acdc470919 100644 --- a/source/blender/src/interface_panel.c +++ b/source/blender/src/interface_panel.c @@ -525,6 +525,7 @@ int uiNewPanel(ScrArea *sa, uiBlock *block, char *panelname, char *tabname, int block->handler= pnl_handler; pa->active= 1; pa->control= pnl_control; + pa->drawname[0]= 0; /* global control over this feature; UI_PNL_TO_MOUSE only called for hotkey panels */ if(U.uiflag & USER_PANELPINNED); @@ -576,6 +577,12 @@ void uiNewPanelHeight(uiBlock *block, int sizey) } } +void uiNewPanelTitle(uiBlock *block, char *str) +{ + if(block->panel) + BLI_strncpy(block->panel->drawname, str, UI_MAX_NAME_STR); +} + static int panel_has_tabs(Panel *panel) { Panel *pa= curarea->panels.first; @@ -851,6 +858,7 @@ static void ui_draw_panel_header(uiBlock *block) Panel *pa, *panel= block->panel; float width; int a, nr= 1, pnl_icons; + char *panelname= panel->drawname[0]?panel->drawname:panel->panelname; char *str; /* count */ @@ -875,7 +883,7 @@ static void ui_draw_panel_header(uiBlock *block) /* draw text label */ BIF_ThemeColor(TH_TEXT_HI); ui_rasterpos_safe(4.0f+block->minx+pnl_icons, block->maxy+5.0f, block->aspect); - BIF_DrawString(block->curfont, block->panel->panelname, (U.transopts & USER_TR_BUTTONS)); + BIF_DrawString(block->curfont, panelname, (U.transopts & USER_TR_BUTTONS)); return; } @@ -888,6 +896,8 @@ static void ui_draw_panel_header(uiBlock *block) width= (panel->sizex - 3 - pnl_icons - PNL_ICON)/nr; pa= curarea->panels.first; while(pa) { + panelname= pa->drawname[0]?pa->drawname:pa->panelname; + if(pa->active==0); else if(pa==panel) { /* active tab */ @@ -900,7 +910,7 @@ static void ui_draw_panel_header(uiBlock *block) /* draw the active text label */ BIF_ThemeColor(TH_TEXT); ui_rasterpos_safe(16+pnl_icons+a*width, panel->sizey+4, block->aspect); - str= ui_block_cut_str(block, pa->panelname, (short)(width-10)); + str= ui_block_cut_str(block, panelname, (short)(width-10)); BIF_DrawString(block->curfont, str, (U.transopts & USER_TR_BUTTONS)); a++; @@ -914,7 +924,7 @@ static void ui_draw_panel_header(uiBlock *block) /* draw an inactive tab label */ BIF_ThemeColorShade(TH_TEXT_HI, -40); ui_rasterpos_safe(16+pnl_icons+a*width, panel->sizey+4, block->aspect); - str= ui_block_cut_str(block, pa->panelname, (short)(width-10)); + str= ui_block_cut_str(block, panelname, (short)(width-10)); BIF_DrawString(block->curfont, str, (U.transopts & USER_TR_BUTTONS)); a++; @@ -959,6 +969,7 @@ void ui_draw_panel(uiBlock *block) { Panel *panel= block->panel; int ofsx; + char *panelname= panel->drawname[0]?panel->drawname:panel->panelname; if(panel->paneltab) return; @@ -976,7 +987,7 @@ void ui_draw_panel(uiBlock *block) if(panel->control & UI_PNL_CLOSE) ofsx+= PNL_ICON; BIF_ThemeColor(TH_TEXT_HI); ui_rasterpos_safe(4+block->minx+ofsx, block->maxy+5, block->aspect); - BIF_DrawString(block->curfont, panel->panelname, (U.transopts & USER_TR_BUTTONS)); + BIF_DrawString(block->curfont, panelname, (U.transopts & USER_TR_BUTTONS)); /* border */ if(panel->flag & PNL_SELECT) { @@ -1009,10 +1020,10 @@ void ui_draw_panel(uiBlock *block) /* title, only the initial character for now */ BIF_ThemeColor(TH_TEXT_HI); str[1]= 0; - end= strlen(panel->panelname); + end= strlen(panelname); ofs= 20; for(a=0; a<end; a++) { - str[0]= panel->panelname[a]; + str[0]= panelname[a]; if( isupper(str[0]) ) { ui_rasterpos_safe(block->minx+5, block->maxy-ofs, block->aspect); BIF_DrawString(block->curfont, str, 0); |