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>2010-06-26 12:53:29 +0400
committerAndrea Weikert <elubie@gmx.net>2010-06-26 12:53:29 +0400
commit892851f787fb4613a297ecb350df114b379ab21b (patch)
tree1129d5577c372f0ee9eef07cc9ba781356eb73e8 /source/blender/editors/space_file/file_ops.c
parent54e6fc151901a57ce53ee4b80955c1a7265412ca (diff)
file operator cleanup
* the default properties of the file operator now only contain the "filepath", which means only the complete path to a file is returned. * "filename" and "directory" has been added to the link/append operator - the only place it was used. * sequence operators still work on the "files", which was custom property passed to the file operator anyway. * have tested sequence loading, image loading and append/link - please report if there are any issues
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r--source/blender/editors/space_file/file_ops.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 9028e5f15c6..7c2a2f436cc 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -545,7 +545,7 @@ void FILE_OT_cancel(struct wmOperatorType *ot)
int file_exec(bContext *C, wmOperator *exec_op)
{
SpaceFile *sfile= CTX_wm_space_file(C);
- char name[FILE_MAX];
+ char filepath[FILE_MAX];
if(sfile->op) {
wmOperator *op= sfile->op;
@@ -567,16 +567,23 @@ int file_exec(bContext *C, wmOperator *exec_op)
}
sfile->op = NULL;
- RNA_string_set(op->ptr, "filename", sfile->params->file);
- BLI_strncpy(name, sfile->params->dir, sizeof(name));
- RNA_string_set(op->ptr, "directory", name);
- strcat(name, sfile->params->file); // XXX unsafe
- if(RNA_struct_find_property(op->ptr, "relative_path"))
- if(RNA_boolean_get(op->ptr, "relative_path"))
- BLI_path_rel(name, G.sce);
+ BLI_join_dirfile(filepath, sfile->params->dir, sfile->params->file);
+ if(RNA_struct_find_property(op->ptr, "relative_path")) {
+ if(RNA_boolean_get(op->ptr, "relative_path")) {
+ BLI_path_rel(filepath, G.sce);
+ }
+ }
- RNA_string_set(op->ptr, "filepath", name);
+ if(RNA_struct_find_property(op->ptr, "filename")) {
+ RNA_string_set(op->ptr, "filename", sfile->params->file);
+ }
+ if(RNA_struct_find_property(op->ptr, "directory")) {
+ RNA_string_set(op->ptr, "directory", sfile->params->dir);
+ }
+ if(RNA_struct_find_property(op->ptr, "filepath")) {
+ RNA_string_set(op->ptr, "filepath", filepath);
+ }
/* some ops have multiple files to select */
{
@@ -612,8 +619,8 @@ int file_exec(bContext *C, wmOperator *exec_op)
folderlist_free(sfile->folders_next);
fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir,0, 1);
- BLI_make_file_string(G.sce, name, BLI_gethome(), ".Bfs");
- fsmenu_write_file(fsmenu_get(), name);
+ BLI_make_file_string(G.sce, filepath, BLI_gethome(), ".Bfs");
+ fsmenu_write_file(fsmenu_get(), filepath);
WM_event_fileselect_event(C, op, EVT_FILESELECT_EXEC);
ED_fileselect_clear(C, sfile);