Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiao Xiangquan <xiaoxiangquan@gmail.com>2011-09-01 19:08:32 +0400
committerXiao Xiangquan <xiaoxiangquan@gmail.com>2011-09-01 19:08:32 +0400
commit981f7fcd0d315abb425bf34dd37f7cd4d9e8d55e (patch)
tree70800c93ec1a12579c32874e2a72eaf3290eba8e /source/blender/editors/space_file
parent5b91a783cf0ec132398a2767d3419d675e5126b5 (diff)
parent2365c64014b3e067bb212b2061f1d14c1f944090 (diff)
merge with trunk r39834
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r--source/blender/editors/space_file/SConscript2
-rw-r--r--source/blender/editors/space_file/file_ops.c57
-rw-r--r--source/blender/editors/space_file/filelist.c25
-rw-r--r--source/blender/editors/space_file/fsmenu.c2
4 files changed, 40 insertions, 46 deletions
diff --git a/source/blender/editors/space_file/SConscript b/source/blender/editors/space_file/SConscript
index 7c55b40e816..ad96840f7b9 100644
--- a/source/blender/editors/space_file/SConscript
+++ b/source/blender/editors/space_file/SConscript
@@ -19,7 +19,7 @@ if env['WITH_BF_OPENEXR']:
if env['WITH_BF_TIFF']:
defs.append('WITH_TIFF')
-if env['OURPLATFORM'] == 'linux2':
+if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index ff63dde7673..f8a5e4ca1ac 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -623,25 +623,31 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
}
/* some ops have multiple files to select */
+ /* this is called on operators check() so clear collections first since
+ * they may be already set. */
{
PointerRNA itemptr;
+ PropertyRNA *prop_files= RNA_struct_find_property(op->ptr, "files");
+ PropertyRNA *prop_dirs= RNA_struct_find_property(op->ptr, "dirs");
int i, numfiles = filelist_numfiles(sfile->files);
- if(RNA_struct_find_property(op->ptr, "files")) {
+ if(prop_files) {
+ RNA_property_collection_clear(op->ptr, prop_files);
for (i=0; i<numfiles; i++) {
if (filelist_is_selected(sfile->files, i, CHECK_FILES)) {
struct direntry *file= filelist_file(sfile->files, i);
- RNA_collection_add(op->ptr, "files", &itemptr);
+ RNA_property_collection_add(op->ptr, prop_files, &itemptr);
RNA_string_set(&itemptr, "name", file->relname);
}
}
}
-
- if(RNA_struct_find_property(op->ptr, "dirs")) {
+
+ if(prop_dirs) {
+ RNA_property_collection_clear(op->ptr, prop_dirs);
for (i=0; i<numfiles; i++) {
if (filelist_is_selected(sfile->files, i, CHECK_DIRS)) {
struct direntry *file= filelist_file(sfile->files, i);
- RNA_collection_add(op->ptr, "dirs", &itemptr);
+ RNA_property_collection_add(op->ptr, prop_dirs, &itemptr);
RNA_string_set(&itemptr, "name", file->relname);
}
}
@@ -653,25 +659,27 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op)
{
- int change= FALSE;
- if(RNA_struct_find_property(op->ptr, "filename")) {
- RNA_string_get(op->ptr, "filename", sfile->params->file);
- change= TRUE;
- }
- if(RNA_struct_find_property(op->ptr, "directory")) {
- RNA_string_get(op->ptr, "directory", sfile->params->dir);
- change= TRUE;
- }
-
+ PropertyRNA *prop;
+
/* If neither of the above are set, split the filepath back */
- if(RNA_struct_find_property(op->ptr, "filepath")) {
- if(change==FALSE) {
- char filepath[FILE_MAX];
- RNA_string_get(op->ptr, "filepath", filepath);
- BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file);
+ if((prop= RNA_struct_find_property(op->ptr, "filepath"))) {
+ char filepath[FILE_MAX];
+ RNA_property_string_get(op->ptr, prop, filepath);
+ BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file);
+ }
+ else {
+ if((prop= RNA_struct_find_property(op->ptr, "filename"))) {
+ RNA_property_string_get(op->ptr, prop, sfile->params->file);
+ }
+ if((prop= RNA_struct_find_property(op->ptr, "directory"))) {
+ RNA_property_string_get(op->ptr, prop, sfile->params->dir);
}
}
+ /* we could check for relative_path property which is used when converting
+ * in the other direction but doesnt hurt to do this every time */
+ BLI_path_abs(sfile->params->dir, G.main->name);
+
/* XXX, files and dirs updates missing, not really so important though */
}
@@ -1161,6 +1169,13 @@ int file_filename_exec(bContext *C, wmOperator *UNUSED(unused))
return OPERATOR_FINISHED;
}
+/* TODO, directory operator is non-functional while a library is loaded
+ * until this is properly supported just disable it. */
+static int file_directory_poll(bContext *C)
+{
+ return ED_operator_file_active(C) && filelist_lib(CTX_wm_space_file(C)->files) == NULL;
+}
+
void FILE_OT_directory(struct wmOperatorType *ot)
{
/* identifiers */
@@ -1171,7 +1186,7 @@ void FILE_OT_directory(struct wmOperatorType *ot)
/* api callbacks */
ot->invoke= file_directory_invoke;
ot->exec= file_directory_exec;
- ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+ ot->poll= file_directory_poll; /* <- important, handler is on window level */
}
void FILE_OT_refresh(struct wmOperatorType *ot)
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 6736230e84f..7382188d62a 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -602,28 +602,6 @@ short filelist_changed(struct FileList* filelist)
return filelist->changed;
}
-static struct ImBuf * filelist_loadimage(struct FileList* filelist, int index)
-{
- ImBuf *imb = NULL;
- int fidx = 0;
-
- if ( (index < 0) || (index >= filelist->numfiltered) ) {
- return NULL;
- }
- fidx = filelist->fidx[index];
- imb = filelist->filelist[fidx].image;
- if (!imb)
- {
- if ( (filelist->filelist[fidx].flags & IMAGEFILE) || (filelist->filelist[fidx].flags & MOVIEFILE) ) {
- imb = IMB_thumb_read(filelist->filelist[fidx].path, THB_NORMAL);
- }
- if (imb) {
- filelist->filelist[fidx].image = imb;
- }
- }
- return imb;
-}
-
struct ImBuf * filelist_getimage(struct FileList* filelist, int index)
{
ImBuf* ibuf = NULL;
@@ -1127,7 +1105,7 @@ void filelist_from_main(struct FileList *filelist)
if( filelist->dir[0]==0) {
/* make directories */
- filelist->numfiles= 23;
+ filelist->numfiles= 24;
filelist->filelist= (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry));
for(a=0; a<filelist->numfiles; a++) {
@@ -1157,6 +1135,7 @@ void filelist_from_main(struct FileList *filelist)
filelist->filelist[20].relname= BLI_strdup("Armature");
filelist->filelist[21].relname= BLI_strdup("Action");
filelist->filelist[22].relname= BLI_strdup("NodeTree");
+ filelist->filelist[23].relname= BLI_strdup("Speaker");
filelist_sort(filelist, FILE_SORT_ALPHA);
}
else {
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index a6e84b0c41d..aa2ea124fe0 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -300,7 +300,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
tmp= GetLogicalDrives();
- for (i=2; i < 26; i++) {
+ for (i=0; i < 26; i++) {
if ((tmp>>i) & 1) {
tmps[0]='A'+i;
tmps[1]=':';