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:
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r--source/blender/editors/space_file/file_ops.c48
-rw-r--r--source/blender/editors/space_file/fsmenu.c2
2 files changed, 29 insertions, 21 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 4dd97c63d40..1b0893e50e0 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -621,25 +621,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);
}
}
@@ -651,25 +657,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 */
}
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]=':';