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:
authorAndrea Weikert <elubie@gmx.net>2009-09-12 23:54:39 +0400
committerAndrea Weikert <elubie@gmx.net>2009-09-12 23:54:39 +0400
commit9a25d22326060395b09cd6d81d7b4ac080bafb8f (patch)
treeeb9ef68ff4b155f69d3d8beedc221b72d92ea83c /source/blender/editors/space_file/filesel.c
parentc1e2e3fea2dd1b22cf22a9dca4d88bde2d280ab6 (diff)
2.5 filebrowser
Appending and Linking * Linking Operator, invokes filebrowser for Append/Link * Separated the append/link function into three parts: ** BLO_library_append_begin finds main for appending ** BLO_library_append_named_part appends one Object,Group, Material, ... ** BLO_library_append_end actually reads and expands the libraries NOTE 1: I also changed the returned properties for the filebrowser operators to the following convention: "path" - the full path to a file or directory, means what is in directory + filename buttons in filebrowser "directory" - the content of the directory button in filebrowser "filename" - the content of the filename button in filebrowser Usually only path should be required, but in some cases it might be more convenient to retrieve the parts separately. Ton, Brecht: If you have time to take a look, let me know if anything needs to be fixed.
Diffstat (limited to 'source/blender/editors/space_file/filesel.c')
-rw-r--r--source/blender/editors/space_file/filesel.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index f300505933f..b0bd3a9a5e7 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -123,6 +123,22 @@ short ED_fileselect_set_params(SpaceFile *sfile)
/* set the parameters from the operator, if it exists */
if (op) {
BLI_strncpy(params->title, op->type->name, sizeof(params->title));
+
+ params->type = RNA_int_get(op->ptr, "type");
+
+ if (RNA_property_is_set(op->ptr, "path")) {
+ RNA_string_get(op->ptr, "path", name);
+ if (params->type == FILE_LOADLIB) {
+ BLI_strncpy(params->dir, name, sizeof(params->dir));
+ BLI_cleanup_dir(G.sce, params->dir);
+ } else {
+ /* if operator has path set, use it, otherwise keep the last */
+ BLI_convertstringcode(name, G.sce);
+ BLI_split_dirfile(name, dir, file);
+ BLI_strncpy(params->file, file, sizeof(params->file));
+ BLI_make_file_string(G.sce, params->dir, dir, ""); /* XXX needed ? - also solve G.sce */
+ }
+ }
params->filter = 0;
params->filter |= RNA_boolean_get(op->ptr, "filter_blender") ? BLENDERFILE : 0;
params->filter |= RNA_boolean_get(op->ptr, "filter_image") ? IMAGEFILE : 0;
@@ -136,21 +152,18 @@ short ED_fileselect_set_params(SpaceFile *sfile)
if (params->filter != 0)
params->flag |= FILE_FILTER;
- params->flag |= FILE_HIDE_DOT;
-
+ if (params->type == FILE_LOADLIB) {
+ params->flag |= FILE_HIDE_DOT;
+ params->flag |= RNA_boolean_get(op->ptr, "link") ? FILE_LINK : 0;
+ params->flag |= RNA_boolean_get(op->ptr, "autoselect") ? FILE_AUTOSELECT : 0;
+ params->flag |= RNA_boolean_get(op->ptr, "active_layer") ? FILE_ACTIVELAY : 0;
+ }
+
if(params->filter & (IMAGEFILE|MOVIEFILE))
params->display= FILE_IMGDISPLAY;
else
params->display= FILE_SHORTDISPLAY;
- /* if operator has path set, use it, otherwise keep the last */
- if (RNA_property_is_set(op->ptr, "filename")) {
- RNA_string_get(op->ptr, "filename", name);
- BLI_convertstringcode(name, G.sce);
- BLI_split_dirfile(name, dir, file);
- BLI_strncpy(params->file, file, sizeof(params->file));
- BLI_make_file_string(G.sce, params->dir, dir, ""); /* XXX needed ? - also solve G.sce */
- }
} else {
/* default values, if no operator */
params->flag |= FILE_HIDE_DOT;
@@ -357,19 +370,15 @@ FileLayout* ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar
void file_change_dir(struct SpaceFile *sfile)
{
if (sfile->params) {
- if (BLI_exists(sfile->params->dir)) {
- filelist_setdir(sfile->files, sfile->params->dir);
+ filelist_setdir(sfile->files, sfile->params->dir);
- if(folderlist_clear_next(sfile))
- folderlist_free(sfile->folders_next);
+ if(folderlist_clear_next(sfile))
+ folderlist_free(sfile->folders_next);
- folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
+ folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
- filelist_free(sfile->files);
- sfile->params->active_file = -1;
- } else {
- BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), FILE_MAX);
- }
+ filelist_free(sfile->files);
+ sfile->params->active_file = -1;
}
}