diff options
author | Andrea Weikert <elubie@gmx.net> | 2007-10-02 13:11:50 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2007-10-02 13:11:50 +0400 |
commit | 565570058f00e4457bdcda9a5d7e89294c90b17d (patch) | |
tree | 0e3b49f58378507142e4e23184050687c6e15cbb /source/blender | |
parent | 27b239f89ccc03f3f199031ccdead07296e11998 (diff) |
== imagebrowser ==
- activated image browser for texture databrowse (texture buttons)
- activated image browser for brush texture databrowse (+small fix of callback function)
- activated image browser for image databrowse in UV/image editor
- fixed: filter didn't work with databrowse and append/link.
- filter buttons in header now don't appear when doing databrowse or append/link
- loading previews for textures added when linking/appending.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenloader/intern/readblenentry.c | 2 | ||||
-rw-r--r-- | source/blender/src/buttons_editing.c | 6 | ||||
-rw-r--r-- | source/blender/src/editimasel.c | 14 | ||||
-rw-r--r-- | source/blender/src/filelist.c | 13 | ||||
-rw-r--r-- | source/blender/src/header_image.c | 13 | ||||
-rw-r--r-- | source/blender/src/header_imasel.c | 47 | ||||
-rw-r--r-- | source/blender/src/headerbuttons.c | 8 | ||||
-rw-r--r-- | source/blender/src/interface_icons.c | 2 |
8 files changed, 76 insertions, 29 deletions
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index dfa06ebdeb8..ef287428a19 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -233,7 +233,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype) for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) { if (bhead->code==ofblocktype) { ID *id= (ID*) (bhead+1); - if (GS(id->name) == ID_MA) { + if ( (GS(id->name) == ID_MA) || (GS(id->name) == ID_TE)) { new_prv = MEM_callocN(sizeof(PreviewImage), "newpreview"); BLI_linklist_prepend(&previews, new_prv); looking = 1; diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index e7c96586732..8fdb9626603 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -5064,7 +5064,11 @@ void do_fpaintbuts(unsigned short event) if(G.buts->menunr==-2) { MTex *mtex= brush->mtex[brush->texact]; ID *id= (ID*)((mtex)? mtex->tex: NULL); - activate_databrowse(id, ID_TE, 0, B_BTEXBROWSE, &G.buts->menunr, do_global_buttons); + if(G.qual & LR_CTRLKEY) { + activate_databrowse_imasel(id, ID_TE, 0, B_BTEXBROWSE, &G.buts->menunr, do_fpaintbuts); + } else { + activate_databrowse(id, ID_TE, 0, B_BTEXBROWSE, &G.buts->menunr, do_fpaintbuts); + } break; } else if(G.buts->menunr < 0) break; diff --git a/source/blender/src/editimasel.c b/source/blender/src/editimasel.c index c2058bf96fd..ed5465e938f 100644 --- a/source/blender/src/editimasel.c +++ b/source/blender/src/editimasel.c @@ -619,7 +619,7 @@ static void do_imasel_buttons(short event, SpaceImaSel *simasel) simasel->file[0] = '\0'; simasel->scrollpos = 0; simasel->active_file = -1; - scrarea_queue_winredraw(curarea); + scrarea_queue_redraw(curarea); } simasel->active_file = -1; @@ -632,7 +632,7 @@ static void do_imasel_buttons(short event, SpaceImaSel *simasel) simasel->file[0] = '\0'; simasel->active_file = -1; simasel->scrollpos = 0; - scrarea_queue_winredraw(curarea); + scrarea_queue_redraw(curarea); } else if(event== B_FS_LOAD) { if(simasel->type) @@ -812,6 +812,7 @@ void winqreadimaselspace(ScrArea *sa, void *spacedata, BWinEvent *evt) char str[FILE_MAXDIR+FILE_MAXFILE+12]; short mval[2]; short do_draw = 0; + short do_headdraw = 0; int numfiles; struct direntry *file; float scrollstep = 0; @@ -931,6 +932,7 @@ void winqreadimaselspace(ScrArea *sa, void *spacedata, BWinEvent *evt) simasel->active_file = -1; simasel->scrollpos = 0; do_draw = 1; + do_headdraw = 1; } else if (file) @@ -972,7 +974,7 @@ void winqreadimaselspace(ScrArea *sa, void *spacedata, BWinEvent *evt) simasel->file[0] = '\0'; simasel->scrollpos = 0; simasel->active_file = -1; - scrarea_queue_winredraw(curarea); + do_headdraw = 1; } } } else { @@ -1054,6 +1056,7 @@ void winqreadimaselspace(ScrArea *sa, void *spacedata, BWinEvent *evt) simasel->file[0] = '\0'; simasel->active_file = -1; simasel->scrollpos = 0; + do_headdraw = 1; } do_draw = 1; break; @@ -1089,7 +1092,10 @@ void winqreadimaselspace(ScrArea *sa, void *spacedata, BWinEvent *evt) /* XXX, stupid patch, curarea can become undone * because of file loading... fixme zr */ - if(do_draw && curarea) scrarea_queue_winredraw(curarea); + if(curarea) { + if(do_draw) scrarea_queue_winredraw(curarea); + if(do_headdraw) scrarea_queue_headredraw(curarea); + } } diff --git a/source/blender/src/filelist.c b/source/blender/src/filelist.c index 23a5e73f7cd..54fab06f811 100644 --- a/source/blender/src/filelist.c +++ b/source/blender/src/filelist.c @@ -265,12 +265,18 @@ static int compare_extension(const void *a1, const void *a2) { void BIF_filelist_filter(FileList* filelist) { + char dir[FILE_MAX], group[GROUP_MAX]; int num_filtered = 0; int i, j; - + if (!filelist->filelist) return; + if ( ( (filelist->type == FILE_LOADLIB) && BIF_filelist_islibrary(filelist, dir, group)) + || (filelist->type == FILE_MAIN) ) { + filelist->filter = 0; + } + if (!filelist->filter) { if (filelist->fidx) { MEM_freeN(filelist->fidx); @@ -912,6 +918,9 @@ void BIF_filelist_from_library(struct FileList* filelist) BIF_filelist_sort(filelist, FILE_SORTALPHA); BLI_strncpy(G.sce, filename, sizeof(filename)); // prevent G.sce to change + + filelist->filter = 0; + BIF_filelist_filter(filelist); } void BIF_filelist_append_library(struct FileList *filelist, char *dir, char *file, short flag, int idcode) @@ -1066,6 +1075,8 @@ void BIF_filelist_from_main(struct FileList *filelist) qsort(firstlib, totlib, sizeof(struct direntry), compare_name); } } + filelist->filter = 0; + BIF_filelist_filter(filelist); } diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c index 86a53ba2b3d..be33e5e2a00 100644 --- a/source/blender/src/header_image.c +++ b/source/blender/src/header_image.c @@ -117,8 +117,13 @@ void do_image_buttons(unsigned short event) case B_SIMABROWSE: if(G.sima->imanr== -2) { - activate_databrowse((ID *)G.sima->image, ID_IM, 0, B_SIMABROWSE, + if(G.qual & LR_CTRLKEY) { + activate_databrowse_imasel((ID *)G.sima->image, ID_IM, 0, B_SIMABROWSE, &G.sima->imanr, do_image_buttons); + } else { + activate_databrowse((ID *)G.sima->image, ID_IM, 0, B_SIMABROWSE, + &G.sima->imanr, do_image_buttons); + } return; } if(G.sima->imanr < 0) break; @@ -308,7 +313,11 @@ void do_image_buttons(unsigned short event) if(G.sima->menunr==-2) { MTex *mtex= brush->mtex[brush->texact]; ID *id= (ID*)((mtex)? mtex->tex: NULL); - activate_databrowse(id, ID_TE, 0, B_SIMABTEXBROWSE, &G.sima->menunr, do_global_buttons); + if(G.qual & LR_CTRLKEY) { + activate_databrowse_imasel(id, ID_TE, 0, B_SIMABTEXBROWSE, &G.sima->menunr, do_image_buttons); + } else { + activate_databrowse(id, ID_TE, 0, B_SIMABTEXBROWSE, &G.sima->menunr, do_image_buttons); + } break; } else if(G.sima->menunr < 0) break; diff --git a/source/blender/src/header_imasel.c b/source/blender/src/header_imasel.c index 1897e5d82f6..1402e8c244e 100644 --- a/source/blender/src/header_imasel.c +++ b/source/blender/src/header_imasel.c @@ -44,7 +44,10 @@ #endif #include "BMF_Api.h" -#include "BIF_language.h" + +#include "BKE_global.h" +#include "BKE_main.h" +#include "BKE_utildefines.h" #include "DNA_ID.h" #include "DNA_screen_types.h" @@ -55,10 +58,9 @@ #include "BIF_gl.h" #include "BIF_imasel.h" #include "BIF_interface.h" +#include "BIF_language.h" #include "BIF_resources.h" #include "BIF_screen.h" -#include "BKE_global.h" -#include "BKE_main.h" #include "BSE_headerbuttons.h" #include "blendef.h" @@ -102,6 +104,9 @@ void imasel_buttons(void) uiBlock *block; short xco, xcotitle; char naam[256]; + char dir[FILE_MAXDIR], group[32]; + short type; + int do_filter = 0; simasel= curarea->spacedata.first; @@ -148,20 +153,28 @@ void imasel_buttons(void) uiDefIconButBitS(block, TOG, FILE_HIDE_DOT, B_RELOADIMASELDIR, ICON_GHOST,xco+=XIC,0,XIC,YIC, &simasel->flag, 0, 0, 0, 0, "Hides dot files"); uiBlockEndAlign(block); xco+=20; - - uiDefIconButBitS(block, TOG, FILE_FILTER, B_FILTERIMASELDIR, ICON_SORTBYEXT,xco+=XIC,0,XIC,YIC, &simasel->flag, 0, 0, 0, 0, "Filter files"); - if (simasel->flag & FILE_FILTER) { - xco+=4; - uiBlockBeginAlign(block); - uiDefIconButBitS(block, TOG, IMAGEFILE, B_FILTERIMASELDIR, ICON_IMAGE_COL,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show images"); - uiDefIconButBitS(block, TOG, BLENDERFILE, B_FILTERIMASELDIR, ICON_BLENDER,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show .blend files"); - uiDefIconButBitS(block, TOG, MOVIEFILE, B_FILTERIMASELDIR, ICON_SEQUENCE,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show movies"); - uiDefIconButBitS(block, TOG, PYSCRIPTFILE, B_FILTERIMASELDIR, ICON_PYTHON,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show python scripts"); - uiDefIconButBitS(block, TOG, FTFONTFILE, B_FILTERIMASELDIR, ICON_SYNTAX,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show fonts"); - uiDefIconButBitS(block, TOG, SOUNDFILE, B_FILTERIMASELDIR, ICON_SOUND,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show sound files"); - uiDefIconButBitS(block, TOG, TEXTFILE, B_FILTERIMASELDIR, ICON_TEXT,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show text files"); - uiDefIconButBitS(block, TOG, FOLDERFILE, B_FILTERIMASELDIR, ICON_FILESEL,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show folders"); - uiBlockEndAlign(block); + + type = simasel->type; + if (type == FILE_LOADLIB) { + do_filter = !BIF_filelist_islibrary(simasel->files, dir, group); + } else { + do_filter = (type != FILE_MAIN); + } + if ( do_filter ) { + uiDefIconButBitS(block, TOG, FILE_FILTER, B_FILTERIMASELDIR, ICON_SORTBYEXT,xco+=XIC,0,XIC,YIC, &simasel->flag, 0, 0, 0, 0, "Filter files"); + if (simasel->flag & FILE_FILTER) { + xco+=4; + uiBlockBeginAlign(block); + uiDefIconButBitS(block, TOG, IMAGEFILE, B_FILTERIMASELDIR, ICON_IMAGE_COL,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show images"); + uiDefIconButBitS(block, TOG, BLENDERFILE, B_FILTERIMASELDIR, ICON_BLENDER,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show .blend files"); + uiDefIconButBitS(block, TOG, MOVIEFILE, B_FILTERIMASELDIR, ICON_SEQUENCE,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show movies"); + uiDefIconButBitS(block, TOG, PYSCRIPTFILE, B_FILTERIMASELDIR, ICON_PYTHON,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show python scripts"); + uiDefIconButBitS(block, TOG, FTFONTFILE, B_FILTERIMASELDIR, ICON_SYNTAX,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show fonts"); + uiDefIconButBitS(block, TOG, SOUNDFILE, B_FILTERIMASELDIR, ICON_SOUND,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show sound files"); + uiDefIconButBitS(block, TOG, TEXTFILE, B_FILTERIMASELDIR, ICON_TEXT,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show text files"); + uiDefIconButBitS(block, TOG, FOLDERFILE, B_FILTERIMASELDIR, ICON_FILESEL,xco+=XIC,0,XIC,YIC, &simasel->filter, 0, 0, 0, 0, "Show folders"); + uiBlockEndAlign(block); + } } uiDefButBitS(block, TOG, FILE_STRINGCODE, 0, "Relative Paths", xco+=XIC+20,0,100,YIC, &simasel->flag, 0, 0, 0, 0, "Makes sure returned paths are relative to the current .blend file"); diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c index 617bef705df..f293d627f68 100644 --- a/source/blender/src/headerbuttons.c +++ b/source/blender/src/headerbuttons.c @@ -859,8 +859,12 @@ void do_global_buttons(unsigned short event) if(mtex) id= (ID *)mtex->tex; } } - - activate_databrowse(id, ID_TE, 0, B_TEXBROWSE, &G.buts->texnr, do_global_buttons); + if(G.qual & LR_CTRLKEY) { + activate_databrowse_imasel(id, ID_TE, 0, B_TEXBROWSE, &G.buts->texnr, do_global_buttons); + } + else { + activate_databrowse(id, ID_TE, 0, B_TEXBROWSE, &G.buts->texnr, do_global_buttons); + } return; } if(G.buts->texnr < 0) break; diff --git a/source/blender/src/interface_icons.c b/source/blender/src/interface_icons.c index 610ad09ca34..d93834d8d8a 100644 --- a/source/blender/src/interface_icons.c +++ b/source/blender/src/interface_icons.c @@ -1028,7 +1028,7 @@ static void icon_draw_mipmap(float x, float y, int icon_id, float aspect, int mi PreviewImage* pi = BKE_previewimg_get((ID*)icon->obj); if (pi) { - if (!nocreate && pi->changed[miplevel]) /* changed only ever set by dynamic icons */ + if (!nocreate && (pi->changed[miplevel] ||!pi->rect[miplevel])) /* changed only ever set by dynamic icons */ { waitcursor(1); /* create the preview rect if necessary */ |