diff options
author | Ton Roosendaal <ton@blender.org> | 2003-10-27 19:13:45 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2003-10-27 19:13:45 +0300 |
commit | 5ca0051419b3f97d65db894308ae1b4255257c65 (patch) | |
tree | 49e21cda99f070d1d9c282373ac980da896a6321 | |
parent | c69636b288b15b5ed341b4e3d4834e84be428859 (diff) |
- fixed very very old but in TOG button (it didnt check the values
correctly for deciding whether its pressed or not
- added 'add new' buttons to material & texture menus
is done by std_lib buttons in headerbuttons.c, now only for this.
doing it for ipowindow, sound, etc. has some weird consequences, save
that for later
- verified usage of 'setting2' color for databuttons only
-rw-r--r-- | source/blender/src/buttons_editing.c | 6 | ||||
-rw-r--r-- | source/blender/src/buttons_shading.c | 13 | ||||
-rw-r--r-- | source/blender/src/header_ipo.c | 2 | ||||
-rw-r--r-- | source/blender/src/headerbuttons.c | 43 | ||||
-rw-r--r-- | source/blender/src/interface.c | 2 |
5 files changed, 44 insertions, 22 deletions
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index f0e92731a9b..77e0d4b9ed3 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -376,7 +376,7 @@ static void editing_panel_mesh_type(Object *ob, Mesh *me) uiDefButS(block, TOG|BIT|5, REDRAWVIEW3D, "Auto Smooth",10,178,130,17, &me->flag, 0, 0, 0, 0, "Treats all faces with angles less than Degr: as 'smooth' during render"); uiDefButS(block, NUM, B_DIFF, "Degr:", 10,156,130,17, &me->smoothresh, 1, 80, 0, 0, "Defines maximum angle between face normals that 'Auto Smooth' will operate on"); - uiBlockSetCol(block, TH_BUT_SETTING2); + uiBlockSetCol(block, TH_BUT_SETTING1); uiDefButS(block, TOG|BIT|7, B_MAKEDISP, "SubSurf", 10,124,130,17, &me->flag, 0, 0, 0, 0, "Treats the active object as a Catmull-Clark Subdivision Surface"); uiBlockSetCol(block, TH_AUTO); @@ -415,7 +415,7 @@ static void editing_panel_mesh_type(Object *ob, Mesh *me) if( (dl=ob->disp.first) && dl->mesh); else decim_faces= tottria; - uiBlockSetCol(block, TH_BUT_SETTING2); + uiBlockSetCol(block, TH_BUT_SETTING1); uiDefButI(block, NUMSLI,B_DECIM_FACES, "Decimator: ", 173,176,233,19, &decim_faces, 4.0, tottria, 10, 10, "Defines the number of triangular faces to decimate the active Mesh object to"); uiBlockSetCol(block, TH_AUTO); uiDefBut(block, BUT,B_DECIM_CANCEL, "Cancel", 290,156,116,18, 0, 0, 0, 0, 0, "Restores the Mesh to its original number of faces"); @@ -1954,7 +1954,7 @@ static void editing_panel_mesh_texface(void) uiDefButS(block, TOG|BIT|13, REDRAWVIEW3D, "Shadow", 720,120,60,19, &lasttface->mode, 0, 0, 0, 0, "Face is used for shadow"); uiDefButS(block, TOG|BIT|14, REDRAWVIEW3D, "Text", 780,120,60,19, &lasttface->mode, 0, 0, 0, 0, "Enable bitmap text on face"); - uiBlockSetCol(block, TH_BUT_SETTING2); + uiBlockSetCol(block, TH_BUT_SETTING1); uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque", 600,100,60,19, &lasttface->transp, 2.0, 0.0, 0, 0, "Render colour of textured face as colour"); uiDefButC(block, ROW, REDRAWVIEW3D, "Add", 660,100,60,19, &lasttface->transp, 2.0, 1.0, 0, 0, "Render face transparent and add colour of face"); uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha", 720,100,60,19, &lasttface->transp, 2.0, 2.0, 0, 0, "Render polygon transparent, depending on alpha channel of the texture"); diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index 1ba8bc241f7..8e304b9fd51 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -807,7 +807,7 @@ static void texture_panel_envmap(Tex *tex) MEM_freeN(strp); uiDefBut(block, BUT, B_LOADTEXIMA1, "Load Image", 10,115,130,20, 0, 0, 0, 0, 0, "Load image - file view"); - uiBlockSetCol(block, TH_BUT_SETTING2); + uiBlockSetCol(block, TH_BUT_SETTING1); uiDefBut(block, BUT, B_LOADTEXIMA, "", 140,115,20,20, 0, 0, 0, 0, 0, "Load image - thumb view"); uiBlockSetCol(block, TH_AUTO); @@ -1035,7 +1035,7 @@ static void texture_panel_texture(MTex *mtex, Material *ma, World *wrld, Lamp *l /* first do the browse but */ buttons_active_id(&id, &idfrom); - uiBlockSetCol(block, TH_BUT_SETTING1); + uiBlockSetCol(block, TH_BUT_SETTING2); if(ma) { std_libbuttons(block, 10, 180, 0, NULL, B_TEXBROWSE, id, idfrom, &(G.buts->texnr), B_TEXALONE, B_TEXLOCAL, B_TEXDELETE, B_AUTOTEXNAME, B_KEEPDATA); } @@ -1300,7 +1300,7 @@ static void radio_panel_tool(Radio *rad, int flag) if(uiNewPanel(curarea, block, "Radio Tool", "Radio", 320, 0, 318, 204)==0) return; uiAutoBlock(block, 10, 10, 300, 200, UI_BLOCK_ROWS); - if(flag & RAD_PHASE_PATCHES) uiBlockSetCol(block, TH_BUT_SETTING2); + if(flag & RAD_PHASE_PATCHES) uiBlockSetCol(block, TH_BUT_SETTING1); uiDefBut(block, BUT, B_RAD_COLLECT, "Collect Meshes", 0, 0, 10, 15, NULL, 0, 0, 0, 0, "Convert selected and visible meshes to patches"); if(flag & RAD_PHASE_PATCHES)uiBlockSetCol(block, TH_AUTO); @@ -1463,6 +1463,9 @@ static void world_panel_texture(World *wrld) uiBlockSetCol(block, TH_AUTO); uiDefBut(block, BUT, B_TEXCLEARWORLD, "Clear", 122, 140, 72, 19, 0, 0, 0, 0, 0, "Erase link to texture"); } + else + uiDefButS(block, TOG, B_WTEXBROWSE, "Add New" ,100, 160, 163, 19, &(G.buts->texnr), -1.0, 32767.0, 0, 0, "Add new data block"); + uiBlockSetCol(block, TH_AUTO); @@ -1719,6 +1722,8 @@ static void lamp_panel_texture(Object *ob, Lamp *la) uiBlockSetCol(block, TH_AUTO); uiDefBut(block, BUT, B_TEXCLEARLAMP, "Clear", 122, 140, 72, 19, 0, 0, 0, 0, 0, "Erase link to texture"); } + else + uiDefButS(block, TOG, B_WTEXBROWSE, "Add New" ,100, 160, 163, 19, &(G.buts->texnr), -1.0, 32767.0, 0, 0, "Add new data block"); /* TEXCO */ uiBlockSetCol(block, TH_AUTO); @@ -2107,6 +2112,8 @@ static void material_panel_texture(Material *ma) uiBlockSetCol(block, TH_AUTO); uiDefBut(block, BUT, B_TEXCLEAR, "Clear", 122, 130, 72, 20, 0, 0, 0, 0, 0, "Erase link to datablock"); } + else + uiDefButS(block, TOG, B_EXTEXBROWSE, "Add New" ,100, 150, 163, 20, &(G.buts->texnr), -1.0, 32767.0, 0, 0, "Add new data block"); // force no centering uiDefBut(block, LABEL, 0, " ", 250, 10, 25, 20, 0, 0, 0, 0, 0, ""); diff --git a/source/blender/src/header_ipo.c b/source/blender/src/header_ipo.c index 770b08b72de..dec2d6574a2 100644 --- a/source/blender/src/header_ipo.c +++ b/source/blender/src/header_ipo.c @@ -638,7 +638,7 @@ void ipo_buttons(void) curarea->butspacetype= SPACE_IPO; xco = 8; - uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D, windowtype_pup(), xco,0,XIC+8,YIC, &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu of available types."); + uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D, windowtype_pup(), xco,0,XIC+10,YIC, &(curarea->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu of available types."); xco+= XIC+10; test_editipo(); /* test if current editipo is OK, make_editipo sets v2d->cur */ diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c index ade2ced24f4..696e60aeb3d 100644 --- a/source/blender/src/headerbuttons.c +++ b/source/blender/src/headerbuttons.c @@ -242,7 +242,7 @@ int std_libbuttons(uiBlock *block, short xco, short yco, Object *ob; Ipo *ipo; uiBut *but; - int len, idwasnul=0, idtype, oldcol; + int len, idwasnul=0, idtype, oldcol, add_addbutton=0; char *str=NULL, str1[10]; oldcol= uiBlockGetCol(block); @@ -263,19 +263,26 @@ int std_libbuttons(uiBlock *block, short xco, short yco, id= G.main->sound.first; } else if(curarea->spacetype==SPACE_ACTION) { - id= G.main->action.first; + if(ob) id= G.main->action.first; } else if(curarea->spacetype==SPACE_NLA) { - id=NULL; + id= NULL; } else if(curarea->spacetype==SPACE_IPO) { id= G.main->ipo.first; + /* test for ipotype */ while(id) { ipo= (Ipo *)id; if(G.sipo->blocktype==ipo->blocktype) break; id= id->next; } + if(ob==NULL) { + if(G.sipo->blocktype!=ID_SEQ && G.sipo->blocktype!=ID_WO) { + id= NULL; + idwasnul= 0; + } + } } else if(curarea->spacetype==SPACE_BUTS) { if(browse==B_WORLDBROWSE) { @@ -287,6 +294,8 @@ int std_libbuttons(uiBlock *block, short xco, short yco, if(tab==TAB_SHADING_MAT) id= G.main->mat.first; else if(tab==TAB_SHADING_TEX) id= G.main->tex.first; + + add_addbutton= 1; } } } @@ -331,7 +340,6 @@ int std_libbuttons(uiBlock *block, short xco, short yco, uiClearButLock(); MEM_freeN(str); - xco+= XIC; } else if(curarea->spacetype==SPACE_BUTS) { if(G.buts->mainb==CONTEXT_SHADING) { @@ -351,8 +359,6 @@ int std_libbuttons(uiBlock *block, short xco, short yco, else if(curarea->spacetype==SPACE_SOUND) { uiDefButS(block, MENU, browse, "OPEN NEW %x 32766",xco,yco,XIC,YIC, menupoin, 0, 0, 0, 0, "Browses Datablock"); } - else if(curarea->spacetype==SPACE_NLA) { - } else if(curarea->spacetype==SPACE_ACTION) { uiSetButLock(G.scene->id.lib!=0, "Can't edit library data"); if(parid) uiSetButLock(parid->lib!=0, "Can't edit library data"); @@ -361,18 +367,22 @@ int std_libbuttons(uiBlock *block, short xco, short yco, uiClearButLock(); } else if(curarea->spacetype==SPACE_IPO) { - uiSetButLock(G.scene->id.lib!=0, "Can't edit library data"); - if(parid) uiSetButLock(parid->lib!=0, "Can't edit library data"); - - uiDefButS(block, MENU, browse, "ADD NEW %x 32767", xco,yco,XIC,YIC, menupoin, 0, 0, 0, 0, "Browses Datablock"); - uiClearButLock(); + if(idwasnul) { + uiSetButLock(G.scene->id.lib!=0, "Can't edit library data"); + if(parid) uiSetButLock(parid->lib!=0, "Can't edit library data"); + + uiDefButS(block, MENU, browse, "ADD NEW %x 32767", xco,yco,XIC,YIC, menupoin, 0, 0, 0, 0, "Browses Datablock"); + uiClearButLock(); + } } + + xco+= XIC; } uiBlockSetCol(block, oldcol); - if(id) { + if(id) { /* text button with name */ /* name */ if(id->us>1) uiBlockSetCol(block, TH_BUT_SETTING1); @@ -393,7 +403,7 @@ int std_libbuttons(uiBlock *block, short xco, short yco, else if(strcmp(str1, "SR:")==0) strcpy(str1, "SCR:"); if( GS(id->name)==ID_IP) len= 110; - else if(yco) len= 140; // comes from button panel + else if(yco) len= 140; // comes from button panel else len= 120; but= uiDefBut(block, TEX, B_IDNAME, str1,xco, yco, (short)len, YIC, id->name+2, 0.0, 19.0, 0, 0, "Displays current Datablock name. Click to change."); @@ -456,7 +466,12 @@ int std_libbuttons(uiBlock *block, short xco, short yco, xco+= XIC; } } - else xco+=XIC; + else if(add_addbutton) { /* "add new" button */ + uiBlockSetCol(block, oldcol); + uiDefButS(block, TOG, browse, "Add New" ,xco, yco, 110, YIC, menupoin, (float)*menupoin, 32767.0, 0, 0, "Add new data block"); + xco+= 110; + } + xco+=XIC; uiBlockSetCol(block, oldcol); diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index c515eec23fb..9ca8f58ce94 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -963,7 +963,7 @@ static void ui_is_but_sel(uiBut *but) case TOGR: case TOG3: case ICONTOG: - if(value!=0.0) push= 1; + if(value!=but->min) push= 1; break; case TOGN: if(value==0.0) push= 1; |