diff options
author | Andrea Weikert <elubie@gmx.net> | 2009-09-12 23:54:39 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2009-09-12 23:54:39 +0400 |
commit | 9a25d22326060395b09cd6d81d7b4ac080bafb8f (patch) | |
tree | eb9ef68ff4b155f69d3d8beedc221b72d92ea83c /source/blender/editors/space_image/image_ops.c | |
parent | c1e2e3fea2dd1b22cf22a9dca4d88bde2d280ab6 (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_image/image_ops.c')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index bee06e6892f..806d0d7ce52 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -609,7 +609,7 @@ static const EnumPropertyItem image_file_type_items[] = { static void image_filesel(bContext *C, wmOperator *op, const char *path) { - RNA_string_set(op->ptr, "filename", path); + RNA_string_set(op->ptr, "path", path); WM_event_add_fileselect(C, op); } @@ -623,7 +623,7 @@ static int open_exec(bContext *C, wmOperator *op) Image *ima= NULL; char str[FILE_MAX]; - RNA_string_get(op->ptr, "filename", str); + RNA_string_get(op->ptr, "path", str); ima= BKE_add_image_file(str, scene->r.cfra); if(!ima) @@ -640,7 +640,7 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) SpaceImage *sima= CTX_wm_space_image(C); char *path= (sima->image)? sima->image->name: U.textudir; - if(RNA_property_is_set(op->ptr, "filename")) + if(RNA_property_is_set(op->ptr, "path")) return open_exec(C, op); image_filesel(C, op, path); @@ -663,7 +663,7 @@ void IMAGE_OT_open(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE); + WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL); } /******************** replace image operator ********************/ @@ -676,7 +676,7 @@ static int replace_exec(bContext *C, wmOperator *op) if(!sima->image) return OPERATOR_CANCELLED; - RNA_string_get(op->ptr, "filename", str); + RNA_string_get(op->ptr, "path", str); BLI_strncpy(sima->image->name, str, sizeof(sima->image->name)-1); /* we cant do much if the str is longer then 240 :/ */ BKE_image_signal(sima->image, &sima->iuser, IMA_SIGNAL_RELOAD); @@ -693,7 +693,7 @@ static int replace_invoke(bContext *C, wmOperator *op, wmEvent *event) if(!sima->image) return OPERATOR_CANCELLED; - if(RNA_property_is_set(op->ptr, "filename")) + if(RNA_property_is_set(op->ptr, "path")) return replace_exec(C, op); image_filesel(C, op, path); @@ -716,7 +716,7 @@ void IMAGE_OT_replace(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE); + WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL); } /******************** save image as operator ********************/ @@ -801,7 +801,7 @@ static int save_as_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; sima->imtypenr= RNA_enum_get(op->ptr, "file_type"); - RNA_string_get(op->ptr, "filename", str); + RNA_string_get(op->ptr, "path", str); save_image_doit(C, sima, scene, op, str); @@ -815,7 +815,7 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event) ImBuf *ibuf= ED_space_image_buffer(sima); Scene *scene= CTX_data_scene(C); - if(RNA_property_is_set(op->ptr, "filename")) + if(RNA_property_is_set(op->ptr, "path")) return save_as_exec(C, op); if(!ima) @@ -861,7 +861,7 @@ void IMAGE_OT_save_as(wmOperatorType *ot) /* properties */ RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as."); - WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE); + WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL); } /******************** save image operator ********************/ |