Hide .file blocks in databrowse/pop menu.
This is mainly useful for scripts that generate/load datablocks for their own use and don't want to burry the user under an avalanche of datablocks he/she doesn't care about. This adds a user pref "Hide .data" which now acts as a default value when opening a new fileselector. It is also used when creating data select pop menus. The "ghost" button in a fileselect window is independant from the userpref. It can be turned on/off individually without affecting Note: When turning the option on/off, it sometimes take a couple of times before the pop menu registers it. Probably some caching thing. Will have to look at it. Default value is Off.
This commit is contained in:
@@ -70,6 +70,7 @@
|
|||||||
#include "DNA_group_types.h"
|
#include "DNA_group_types.h"
|
||||||
#include "DNA_armature_types.h"
|
#include "DNA_armature_types.h"
|
||||||
#include "DNA_action_types.h"
|
#include "DNA_action_types.h"
|
||||||
|
#include "DNA_userdef_types.h"
|
||||||
|
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_dynstr.h"
|
#include "BLI_dynstr.h"
|
||||||
@@ -560,6 +561,9 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor
|
|||||||
|
|
||||||
if (nr && id==link) *nr= i+1;
|
if (nr && id==link) *nr= i+1;
|
||||||
|
|
||||||
|
if (U.uiflag & USER_HIDE_DOT && id->name[2]=='.')
|
||||||
|
continue;
|
||||||
|
|
||||||
get_flags_for_id(id, buf);
|
get_flags_for_id(id, buf);
|
||||||
|
|
||||||
BLI_dynstr_append(pupds, buf);
|
BLI_dynstr_append(pupds, buf);
|
||||||
@@ -601,6 +605,9 @@ static void IPOnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, sho
|
|||||||
if (id==link)
|
if (id==link)
|
||||||
*nr= i+1;
|
*nr= i+1;
|
||||||
|
|
||||||
|
if (U.uiflag & USER_HIDE_DOT && id->name[2]=='.')
|
||||||
|
continue;
|
||||||
|
|
||||||
get_flags_for_id(id, buf);
|
get_flags_for_id(id, buf);
|
||||||
|
|
||||||
BLI_dynstr_append(pupds, buf);
|
BLI_dynstr_append(pupds, buf);
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ extern UserDef U; /* from usiblender.c !!!! */
|
|||||||
#define USER_LOCKAROUND 4096
|
#define USER_LOCKAROUND 4096
|
||||||
#define USER_GLOBALUNDO 8192
|
#define USER_GLOBALUNDO 8192
|
||||||
#define USER_ORBIT_SELECTION 16384
|
#define USER_ORBIT_SELECTION 16384
|
||||||
|
#define USER_HIDE_DOT 65536
|
||||||
|
|
||||||
/* transopts */
|
/* transopts */
|
||||||
|
|
||||||
|
|||||||
@@ -1097,7 +1097,6 @@ static void draw_filetext(SpaceFile *sfile)
|
|||||||
for(a= sfile->ofs; a<sfile->totfile; a++, files++) {
|
for(a= sfile->ofs; a<sfile->totfile; a++, files++) {
|
||||||
|
|
||||||
if( calc_filesel_line(sfile, a, &x, &y)==0 ) break;
|
if( calc_filesel_line(sfile, a, &x, &y)==0 ) break;
|
||||||
|
|
||||||
print_line(sfile, files, x, y);
|
print_line(sfile, files, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1275,6 +1274,9 @@ void activate_fileselect(int type, char *title, char *file, void (*func)(char *)
|
|||||||
if(BLI_convertstringcode(name, G.sce, G.scene->r.cfra)) sfile->flag |= FILE_STRINGCODE;
|
if(BLI_convertstringcode(name, G.sce, G.scene->r.cfra)) sfile->flag |= FILE_STRINGCODE;
|
||||||
else sfile->flag &= ~FILE_STRINGCODE;
|
else sfile->flag &= ~FILE_STRINGCODE;
|
||||||
|
|
||||||
|
if (U.uiflag & USER_HIDE_DOT)
|
||||||
|
sfile->flag |= FILE_HIDE_DOT;
|
||||||
|
|
||||||
if(type==FILE_MAIN) {
|
if(type==FILE_MAIN) {
|
||||||
char *groupname;
|
char *groupname;
|
||||||
|
|
||||||
@@ -2372,6 +2374,10 @@ void main_to_filelist(SpaceFile *sfile)
|
|||||||
struct direntry *files, *firstlib = NULL;
|
struct direntry *files, *firstlib = NULL;
|
||||||
ListBase *lb;
|
ListBase *lb;
|
||||||
int a, fake, idcode, len, ok, totlib, totbl;
|
int a, fake, idcode, len, ok, totlib, totbl;
|
||||||
|
short hide = 0;
|
||||||
|
|
||||||
|
if (sfile->flag & FILE_HIDE_DOT)
|
||||||
|
hide = 1;
|
||||||
|
|
||||||
if(sfile->dir[0]=='/') sfile->dir[0]= 0;
|
if(sfile->dir[0]=='/') sfile->dir[0]= 0;
|
||||||
|
|
||||||
@@ -2425,11 +2431,11 @@ void main_to_filelist(SpaceFile *sfile)
|
|||||||
id= lb->first;
|
id= lb->first;
|
||||||
sfile->totfile= 0;
|
sfile->totfile= 0;
|
||||||
while(id) {
|
while(id) {
|
||||||
|
|
||||||
if(sfile->returnfunc && idcode==ID_IP) {
|
if(sfile->returnfunc && idcode==ID_IP) {
|
||||||
if(sfile->ipotype== ((Ipo *)id)->blocktype) sfile->totfile++;
|
if(sfile->ipotype== ((Ipo *)id)->blocktype) sfile->totfile++;
|
||||||
}
|
}
|
||||||
else sfile->totfile++;
|
else if (hide==0 || id->name[2] != '.')
|
||||||
|
sfile->totfile++;
|
||||||
|
|
||||||
id= id->next;
|
id= id->next;
|
||||||
}
|
}
|
||||||
@@ -2463,6 +2469,7 @@ void main_to_filelist(SpaceFile *sfile)
|
|||||||
|
|
||||||
if(ok) {
|
if(ok) {
|
||||||
|
|
||||||
|
if (hide==0 || id->name[2] != '.') {
|
||||||
memset( files, 0 , sizeof(struct direntry));
|
memset( files, 0 , sizeof(struct direntry));
|
||||||
files->relname= BLI_strdup(id->name+2);
|
files->relname= BLI_strdup(id->name+2);
|
||||||
|
|
||||||
@@ -2491,6 +2498,7 @@ void main_to_filelist(SpaceFile *sfile)
|
|||||||
files++;
|
files++;
|
||||||
totbl++;
|
totbl++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
id= id->next;
|
id= id->next;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2850,17 +2850,21 @@ void drawinfospace(ScrArea *sa, void *spacedata)
|
|||||||
|
|
||||||
|
|
||||||
uiDefBut(block, LABEL,0,"System:",
|
uiDefBut(block, LABEL,0,"System:",
|
||||||
(xpos+edgsp+(4*midsp)+(4*mpref)),y3label,mpref,buth,
|
(xpos+edgsp+(4*midsp)+(4*mpref)),y4label,mpref,buth,
|
||||||
0, 0, 0, 0, 0, "");
|
0, 0, 0, 0, 0, "");
|
||||||
|
|
||||||
uiDefButBitI(block, TOG, USER_DISABLE_SOUND, B_SOUNDTOGGLE, "Disable Game Sound",
|
uiDefButBitI(block, TOG, USER_DISABLE_SOUND, B_SOUNDTOGGLE, "Disable Game Sound",
|
||||||
(xpos+edgsp+(4*mpref)+(4*midsp)),y2,mpref,buth,
|
(xpos+edgsp+(4*mpref)+(4*midsp)),y3,mpref,buth,
|
||||||
&(U.gameflags), 0, 0, 0, 0, "Disables sounds from being played in games");
|
&(U.gameflags), 0, 0, 0, 0, "Disables sounds from being played in games");
|
||||||
|
|
||||||
uiDefButBitI(block, TOG, USER_FILTERFILEEXTS, 0, "Filter File Extensions",
|
uiDefButBitI(block, TOG, USER_FILTERFILEEXTS, 0, "Filter File Extensions",
|
||||||
(xpos+edgsp+(4*mpref)+(4*midsp)),y1,mpref,buth,
|
(xpos+edgsp+(4*mpref)+(4*midsp)),y2,mpref,buth,
|
||||||
&(U.uiflag), 0, 0, 0, 0, "Display only files with extensions in the image select window");
|
&(U.uiflag), 0, 0, 0, 0, "Display only files with extensions in the image select window");
|
||||||
|
|
||||||
|
uiDefButBitI(block, TOG, USER_HIDE_DOT, 0, "Hide dot file/datablock",
|
||||||
|
(xpos+edgsp+(4*mpref)+(4*midsp)),y1,mpref,buth,
|
||||||
|
&(U.uiflag), 0, 0, 0, 0, "Hide files/datablocks that start with a dot(.*)");
|
||||||
|
|
||||||
|
|
||||||
uiDefBut(block, LABEL,0,"OpenGL:",
|
uiDefBut(block, LABEL,0,"OpenGL:",
|
||||||
(xpos+edgsp+(5*midsp)+(5*mpref)),y5label,mpref,buth,
|
(xpos+edgsp+(5*midsp)+(5*mpref)),y5label,mpref,buth,
|
||||||
|
|||||||
Reference in New Issue
Block a user