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
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')
-rw-r--r--source/blender/editors/curve/editfont.c2
-rw-r--r--source/blender/editors/screen/screendump.c22
-rw-r--r--source/blender/editors/sound/sound_ops.c8
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c6
-rw-r--r--source/blender/editors/space_file/file_ops.c30
-rw-r--r--source/blender/editors/space_file/file_panels.c6
-rw-r--r--source/blender/editors/space_file/filelist.c369
-rw-r--r--source/blender/editors/space_file/filelist.h12
-rw-r--r--source/blender/editors/space_file/filesel.c49
-rw-r--r--source/blender/editors/space_file/space_file.c5
-rw-r--r--source/blender/editors/space_image/image_ops.c20
-rw-r--r--source/blender/editors/space_info/info_ops.c10
-rw-r--r--source/blender/editors/space_script/script_edit.c8
-rw-r--r--source/blender/editors/space_script/script_ops.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c42
-rw-r--r--source/blender/editors/space_text/text_ops.c16
16 files changed, 497 insertions, 110 deletions
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index a9736f3f88d..868c5902670 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -417,7 +417,7 @@ void FONT_OT_file_paste(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE);
+ WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE, FILE_SPECIAL);
}
/******************* paste buffer operator ********************/
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 5ae1bdf84aa..fb3da4a5353 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -73,24 +73,24 @@ static int screenshot_exec(bContext *C, wmOperator *op)
if(scd && scd->dumprect) {
Scene *scene= CTX_data_scene(C);
ImBuf *ibuf;
- char filename[FILE_MAX];
+ char path[FILE_MAX];
- RNA_string_get(op->ptr, "filename", filename);
+ RNA_string_get(op->ptr, "path", path);
- strcpy(G.ima, filename);
- BLI_convertstringcode(filename, G.sce);
+ strcpy(G.ima, path);
+ BLI_convertstringcode(path, G.sce);
/* BKE_add_image_extension() checks for if extension was already set */
if(scene->r.scemode & R_EXTENSION)
- if(strlen(filename)<FILE_MAXDIR+FILE_MAXFILE-5)
- BKE_add_image_extension(scene, filename, scene->r.imtype);
+ if(strlen(path)<FILE_MAXDIR+FILE_MAXFILE-5)
+ BKE_add_image_extension(scene, path, scene->r.imtype);
ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0, 0);
ibuf->rect= scd->dumprect;
if(scene->r.planes == 8) IMB_cspace(ibuf, rgb_to_bw);
- BKE_write_ibuf(scene, ibuf, filename, scene->r.imtype, scene->r.subimtype, scene->r.quality);
+ BKE_write_ibuf(scene, ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality);
IMB_freeImBuf(ibuf);
@@ -149,10 +149,10 @@ static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *event)
scd->dumprect= dumprect;
op->customdata= scd;
- if(RNA_property_is_set(op->ptr, "filename"))
+ if(RNA_property_is_set(op->ptr, "path"))
return screenshot_exec(C, op);
- RNA_string_set(op->ptr, "filename", G.ima);
+ RNA_string_set(op->ptr, "path", G.ima);
WM_event_add_fileselect(C, op);
@@ -173,7 +173,7 @@ void SCREEN_OT_screenshot(wmOperatorType *ot)
ot->flag= 0;
- WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE);
+ WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL);
RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "");
}
@@ -327,7 +327,7 @@ void SCREEN_OT_screencast(wmOperatorType *ot)
ot->flag= 0;
- RNA_def_property(ot->srna, "filename", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property(ot->srna, "path", PROP_STRING, PROP_FILEPATH);
RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "");
}
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 303ca0eaefd..1121a3bcbcd 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -66,13 +66,13 @@
static int open_exec(bContext *C, wmOperator *op)
{
- char filename[FILE_MAX];
+ char path[FILE_MAX];
bSound *sound;
AUD_SoundInfo info;
- RNA_string_get(op->ptr, "filename", filename);
+ RNA_string_get(op->ptr, "path", path);
- sound = sound_new_file(CTX_data_main(C), filename);
+ sound = sound_new_file(CTX_data_main(C), path);
if (sound==NULL || sound->handle == NULL) {
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
@@ -114,7 +114,7 @@ void SOUND_OT_open(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE);
+ WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL);
RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory.");
}
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 481c2d6cfc3..9b335b86163 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -1069,10 +1069,10 @@ static int file_browse_exec(bContext *C, wmOperator *op)
FileBrowseOp *fbo= op->customdata;
char *str;
- if (RNA_property_is_set(op->ptr, "filename")==0 || fbo==NULL)
+ if (RNA_property_is_set(op->ptr, "path")==0 || fbo==NULL)
return OPERATOR_CANCELLED;
- str= RNA_string_get_alloc(op->ptr, "filename", 0, 0);
+ str= RNA_string_get_alloc(op->ptr, "path", 0, 0);
RNA_property_string_set(&fbo->ptr, fbo->prop, str);
RNA_property_update(C, &fbo->ptr, fbo->prop);
MEM_freeN(str);
@@ -1128,6 +1128,6 @@ void BUTTONS_OT_file_browse(wmOperatorType *ot)
ot->cancel= file_browse_cancel;
/* properties */
- WM_operator_properties_filesel(ot, 0);
+ WM_operator_properties_filesel(ot, 0, FILE_SPECIAL);
}
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index e1a6e346ce2..5d3c2c766a3 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -520,9 +520,11 @@ int file_exec(bContext *C, wmOperator *unused)
wmOperator *op= sfile->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);
- RNA_string_set(op->ptr, "filename", name);
+ RNA_string_set(op->ptr, "path", name);
/* some ops have multiple files to select */
{
@@ -872,11 +874,13 @@ void FILE_OT_bookmark_toggle(struct wmOperatorType *ot)
int file_filenum_exec(bContext *C, wmOperator *op)
{
SpaceFile *sfile= CTX_wm_space_file(C);
+ ScrArea *sa= CTX_wm_area(C);
int inc = RNA_int_get(op->ptr, "increment");
if(sfile->params && (inc != 0)) {
BLI_newname(sfile->params->file, inc);
- WM_event_add_notifier(C, NC_WINDOW, NULL);
+ ED_area_tag_redraw(sa);
+ // WM_event_add_notifier(C, NC_WINDOW, NULL);
}
return OPERATOR_FINISHED;
@@ -916,6 +920,24 @@ int file_rename_exec(bContext *C, wmOperator *op)
}
+int file_rename_poll(bContext *C)
+{
+ int poll = ED_operator_file_active(C);
+ SpaceFile *sfile= CTX_wm_space_file(C);
+
+ if (sfile && sfile->params) {
+ if (sfile->params->active_file < 0) {
+ poll= 0;
+ } else {
+ char dir[FILE_MAX], group[FILE_MAX];
+ if (filelist_islibrary(sfile->files, dir, group)) poll= 0;
+ }
+ }
+ else
+ poll= 0;
+ return poll;
+}
+
void FILE_OT_rename(struct wmOperatorType *ot)
{
/* identifiers */
@@ -924,7 +946,7 @@ void FILE_OT_rename(struct wmOperatorType *ot)
/* api callbacks */
ot->exec= file_rename_exec;
- ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+ ot->poll= file_rename_poll;
}
@@ -938,6 +960,8 @@ int file_delete_poll(bContext *C)
if (sfile->params->active_file < 0) {
poll= 0;
} else {
+ char dir[FILE_MAX], group[FILE_MAX];
+ if (filelist_islibrary(sfile->files, dir, group)) poll= 0;
file = filelist_file(sfile->files, sfile->params->active_file);
if (file && S_ISDIR(file->type)) poll= 0;
}
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index 24c3f9b4ca1..2d351016893 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -181,6 +181,12 @@ static void file_panel_operator(const bContext *C, Panel *pa)
RNA_STRUCT_BEGIN(op->ptr, prop) {
if(strcmp(RNA_property_identifier(prop), "rna_type") == 0)
continue;
+ if(strcmp(RNA_property_identifier(prop), "type") == 0)
+ continue;
+ if(strcmp(RNA_property_identifier(prop), "path") == 0)
+ continue;
+ if(strcmp(RNA_property_identifier(prop), "directory") == 0)
+ continue;
if(strcmp(RNA_property_identifier(prop), "filename") == 0)
continue;
if(strcmp(RNA_property_identifier(prop), "display") == 0)
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 538c1e4fce7..23f24f26dc0 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -60,6 +60,7 @@
#include "BKE_library.h"
#include "BKE_global.h"
#include "BKE_main.h"
+#include "BKE_report.h"
#include "BLO_readfile.h"
#include "DNA_space_types.h"
@@ -109,7 +110,6 @@ typedef struct FileList
{
struct direntry *filelist;
int *fidx;
-
int numfiles;
int numfiltered;
char dir[FILE_MAX];
@@ -118,6 +118,12 @@ typedef struct FileList
short hide_dot;
unsigned int filter;
short changed;
+
+ struct BlendHandle *libfiledata;
+ short hide_parent;
+
+ void (*read)(struct FileList *);
+
ListBase loadimages;
ListBase threads;
} FileList;
@@ -277,12 +283,20 @@ static int compare_extension(const void *a1, const void *a2) {
void filelist_filter(FileList* filelist)
{
+ /* char dir[FILE_MAX], group[GROUP_MAX]; XXXXX */
int num_filtered = 0;
int i, j;
if (!filelist->filelist)
return;
+ /* XXXXX TODO: check if the filter can be handled outside the filelist
+ if ( ( (filelist->type == FILE_LOADLIB) && BIF_filelist_islibrary(filelist, dir, group))
+ || (filelist->type == FILE_MAIN) ) {
+ filelist->filter = 0;
+ }
+ */
+
if (!filelist->filter) {
if (filelist->fidx) {
MEM_freeN(filelist->fidx);
@@ -438,23 +452,29 @@ void folderlist_free(ListBase* folderlist)
folderlist= NULL;
}
+static void filelist_read_main(struct FileList* filelist);
+static void filelist_read_library(struct FileList* filelist);
+static void filelist_read_dir(struct FileList* filelist);
+
//------------------FILELIST------------------------//
-struct FileList* filelist_new()
+struct FileList* filelist_new(short type)
{
FileList* p = MEM_callocN( sizeof(FileList), "filelist" );
- return p;
-}
-
-struct FileList* filelist_copy(struct FileList* filelist)
-{
- FileList* p = filelist_new();
- BLI_strncpy(p->dir, filelist->dir, FILE_MAX);
- p->filelist = NULL;
- p->fidx = NULL;
+ switch(type) {
+ case FILE_MAIN:
+ p->read = filelist_read_main;
+ break;
+ case FILE_LOADLIB:
+ p->read = filelist_read_library;
+ break;
+ default:
+ p->read = filelist_read_dir;
+ }
return p;
}
+
void filelist_free(struct FileList* filelist)
{
int i;
@@ -493,6 +513,18 @@ void filelist_free(struct FileList* filelist)
filelist->hide_dot =0;
}
+void filelist_freelib(struct FileList* filelist)
+{
+ if(filelist->libfiledata)
+ BLO_blendhandle_close(filelist->libfiledata);
+ filelist->libfiledata= 0;
+}
+
+struct BlendHandle *filelist_lib(struct FileList* filelist)
+{
+ return filelist->libfiledata;
+}
+
int filelist_numfiles(struct FileList* filelist)
{
return filelist->numfiltered;
@@ -733,16 +765,16 @@ void filelist_setfilter(struct FileList* filelist, unsigned int filter)
filelist->filter = filter;
}
-void filelist_readdir(struct FileList* filelist)
+static void filelist_read_dir(struct FileList* filelist)
{
char wdir[FILE_MAX];
-
if (!filelist) return;
+
filelist->fidx = 0;
filelist->filelist = 0;
BLI_getwdN(wdir);
-
+
BLI_cleanup_dir(G.sce, filelist->dir);
BLI_hide_dot_files(filelist->hide_dot);
filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist));
@@ -750,12 +782,50 @@ void filelist_readdir(struct FileList* filelist)
chdir(wdir);
filelist_setfiletypes(filelist, G.have_quicktime);
filelist_filter(filelist);
-
+
if (!filelist->threads.first) {
BLI_init_threads(&filelist->threads, exec_loadimages, 2);
}
}
+static void filelist_read_main(struct FileList* filelist)
+{
+ if (!filelist) return;
+ filelist_from_main(filelist);
+}
+
+static void filelist_read_library(struct FileList* filelist)
+{
+ if (!filelist) return;
+ BLI_cleanup_dir(G.sce, filelist->dir);
+ filelist_from_library(filelist);
+ if(!filelist->libfiledata) {
+ int num;
+ struct direntry *file;
+ filelist_read_dir(filelist);
+ file = filelist->filelist;
+ for(num=0; num<filelist->numfiles; num++, file++) {
+ if(BLO_has_bfile_extension(file->relname)) {
+ char name[FILE_MAXDIR+FILE_MAXFILE];
+
+ BLI_strncpy(name, filelist->dir, sizeof(name));
+ strcat(name, file->relname);
+
+ /* prevent current file being used as acceptable dir */
+ if (BLI_streq(G.main->name, name)==0) {
+ file->type &= ~S_IFMT;
+ file->type |= S_IFDIR;
+ }
+ }
+ }
+ }
+}
+
+void filelist_readdir(struct FileList* filelist)
+{
+ filelist->read(filelist);
+}
+
int filelist_empty(struct FileList* filelist)
{
return filelist->filelist == 0;
@@ -937,3 +1007,272 @@ void filelist_sort(struct FileList* filelist, short sort)
filelist_filter(filelist);
}
+
+
+int filelist_islibrary(struct FileList* filelist, char* dir, char* group)
+{
+ return BLO_is_a_library(filelist->dir, dir, group);
+}
+
+static int groupname_to_code(char *group)
+{
+ char buf[32];
+ char *lslash;
+
+ BLI_strncpy(buf, group, 31);
+ lslash= BLI_last_slash(buf);
+ if (lslash)
+ lslash[0]= '\0';
+
+ return BLO_idcode_from_name(buf);
+}
+
+void filelist_from_library(struct FileList* filelist)
+{
+ LinkNode *l, *names, *previews;
+ struct ImBuf* ima;
+ int ok, i, nnames, idcode;
+ char filename[FILE_MAXDIR+FILE_MAXFILE];
+ char dir[FILE_MAX], group[GROUP_MAX];
+
+ /* name test */
+ ok= filelist_islibrary(filelist, dir, group);
+ if (!ok) {
+ /* free */
+ if(filelist->libfiledata) BLO_blendhandle_close(filelist->libfiledata);
+ filelist->libfiledata= 0;
+ return;
+ }
+
+ BLI_strncpy(filename, G.sce, sizeof(filename)); // G.sce = last file loaded, for UI
+
+ /* there we go */
+ /* for the time being only read filedata when libfiledata==0 */
+ if (filelist->libfiledata==0) {
+ filelist->libfiledata= BLO_blendhandle_from_file(dir);
+ if(filelist->libfiledata==0) return;
+ }
+
+ idcode= groupname_to_code(group);
+
+ // memory for strings is passed into filelist[i].relname
+ // and free'd in freefilelist
+ previews = NULL;
+ if (idcode) {
+ previews= BLO_blendhandle_get_previews(filelist->libfiledata, idcode);
+ names= BLO_blendhandle_get_datablock_names(filelist->libfiledata, idcode);
+ /* ugh, no rewind, need to reopen */
+ BLO_blendhandle_close(filelist->libfiledata);
+ filelist->libfiledata= BLO_blendhandle_from_file(dir);
+
+ } else {
+ names= BLO_blendhandle_get_linkable_groups(filelist->libfiledata);
+ }
+
+ nnames= BLI_linklist_length(names);
+
+ filelist->numfiles= nnames + 1;
+ filelist->filelist= malloc(filelist->numfiles * sizeof(*filelist->filelist));
+ memset(filelist->filelist, 0, filelist->numfiles * sizeof(*filelist->filelist));
+
+ filelist->filelist[0].relname= BLI_strdup("..");
+ filelist->filelist[0].type |= S_IFDIR;
+
+ for (i=0, l= names; i<nnames; i++, l= l->next) {
+ char *blockname= l->link;
+
+ filelist->filelist[i + 1].relname= BLI_strdup(blockname);
+ if (!idcode)
+ filelist->filelist[i + 1].type |= S_IFDIR;
+ }
+
+ if(previews) {
+ for (i=0, l= previews; i<nnames; i++, l= l->next) {
+ PreviewImage *img= l->link;
+
+ if (img) {
+ unsigned int w = img->w[PREVIEW_MIPMAP_LARGE];
+ unsigned int h = img->h[PREVIEW_MIPMAP_LARGE];
+ unsigned int *rect = img->rect[PREVIEW_MIPMAP_LARGE];
+
+ /* first allocate imbuf for copying preview into it */
+ if (w > 0 && h > 0 && rect) {
+ ima = IMB_allocImBuf(w, h, 32, IB_rect, 0);
+ memcpy(ima->rect, rect, w*h*sizeof(unsigned int));
+ filelist->filelist[i + 1].image = ima;
+ filelist->filelist[i + 1].flags = IMAGEFILE;
+ }
+ }
+ }
+ }
+
+ BLI_linklist_free(names, free);
+ if (previews) BLI_linklist_free(previews, (void(*)(void*)) MEM_freeN);
+
+ filelist_sort(filelist, FILE_SORT_ALPHA);
+
+ BLI_strncpy(G.sce, filename, sizeof(filename)); // prevent G.sce to change
+
+ filelist->filter = 0;
+ filelist_filter(filelist);
+}
+
+void filelist_hideparent(struct FileList* filelist, short hide)
+{
+ filelist->hide_parent = hide;
+}
+
+void filelist_from_main(struct FileList *filelist)
+{
+ ID *id;
+ struct direntry *files, *firstlib = NULL;
+ ListBase *lb;
+ int a, fake, idcode, ok, totlib, totbl;
+
+ // filelist->type = FILE_MAIN; // XXXXX TODO: add modes to filebrowser
+
+ if(filelist->dir[0]=='/') filelist->dir[0]= 0;
+
+ if(filelist->dir[0]) {
+ idcode= groupname_to_code(filelist->dir);
+ if(idcode==0) filelist->dir[0]= 0;
+ }
+
+ if( filelist->dir[0]==0) {
+
+ /* make directories */
+ filelist->numfiles= 23;
+ filelist->filelist= (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry));
+
+ for(a=0; a<filelist->numfiles; a++) {
+ memset( &(filelist->filelist[a]), 0 , sizeof(struct direntry));
+ filelist->filelist[a].type |= S_IFDIR;
+ }
+
+ filelist->filelist[0].relname= BLI_strdup("..");
+ filelist->filelist[2].relname= BLI_strdup("Scene");
+ filelist->filelist[3].relname= BLI_strdup("Object");
+ filelist->filelist[4].relname= BLI_strdup("Mesh");
+ filelist->filelist[5].relname= BLI_strdup("Curve");
+ filelist->filelist[6].relname= BLI_strdup("Metaball");
+ filelist->filelist[7].relname= BLI_strdup("Material");
+ filelist->filelist[8].relname= BLI_strdup("Texture");
+ filelist->filelist[9].relname= BLI_strdup("Image");
+ filelist->filelist[10].relname= BLI_strdup("Ika");
+ filelist->filelist[11].relname= BLI_strdup("Wave");
+ filelist->filelist[12].relname= BLI_strdup("Lattice");
+ filelist->filelist[13].relname= BLI_strdup("Lamp");
+ filelist->filelist[14].relname= BLI_strdup("Camera");
+ filelist->filelist[15].relname= BLI_strdup("Ipo");
+ filelist->filelist[16].relname= BLI_strdup("World");
+ filelist->filelist[17].relname= BLI_strdup("Screen");
+ filelist->filelist[18].relname= BLI_strdup("VFont");
+ filelist->filelist[19].relname= BLI_strdup("Text");
+ filelist->filelist[20].relname= BLI_strdup("Armature");
+ filelist->filelist[21].relname= BLI_strdup("Action");
+ filelist->filelist[22].relname= BLI_strdup("NodeTree");
+ filelist_sort(filelist, FILE_SORT_ALPHA);
+ }
+ else {
+
+ /* make files */
+ idcode= groupname_to_code(filelist->dir);
+
+ lb= wich_libbase(G.main, idcode );
+ if(lb==0) return;
+
+ id= lb->first;
+ filelist->numfiles= 0;
+ while(id) {
+ /* XXXXX TODO: the selection of the ipo blocktype might go somewhere else?
+ if(filelist->has_func && idcode==ID_IP) {
+ if(filelist->ipotype== ((Ipo *)id)->blocktype) filelist->numfiles++;
+ }
+ else */
+ if (!filelist->hide_dot || id->name[2] != '.') {
+ filelist->numfiles++;
+ }
+
+ id= id->next;
+ }
+
+ /* XXXXX TODO: if databrowse F4 or append/link filelist->hide_parent has to be set */
+ if (!filelist->hide_parent) filelist->numfiles+= 1;
+ filelist->filelist= (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry));
+
+ files = filelist->filelist;
+
+ if (!filelist->hide_parent) {
+ memset( &(filelist->filelist[0]), 0 , sizeof(struct direntry));
+ filelist->filelist[0].relname= BLI_strdup("..");
+ filelist->filelist[0].type |= S_IFDIR;
+
+ files++;
+ }
+
+ id= lb->first;
+ totlib= totbl= 0;
+
+ while(id) {
+#if 0
+ // XXXXX TODO: this is deprecated, checks for correct IPO block?
+ ok= 0;
+ if(filelist->has_func && idcode==ID_IP) {
+ if(filelist->ipotype== ((Ipo *)id)->blocktype) ok= 1;
+ }
+ else ok= 1;
+#endif
+ ok = 1;
+ if(ok) {
+ if (!filelist->hide_dot || id->name[2] != '.') {
+ memset( files, 0 , sizeof(struct direntry));
+ if(id->lib==NULL)
+ files->relname= BLI_strdup(id->name+2);
+ else {
+ files->relname= MEM_mallocN(FILE_MAXDIR+FILE_MAXFILE+32, "filename for lib");
+ sprintf(files->relname, "%s | %s", id->lib->name, id->name+2);
+ }
+ /* files->type |= S_IFDIR; */
+#if 0 // XXXXX TODO show the selection status of the objects
+ if(!filelist->has_func) { /* F4 DATA BROWSE */
+ if(idcode==ID_OB) {
+ if( ((Object *)id)->flag & SELECT) files->flags |= ACTIVE;
+ }
+ else if(idcode==ID_SCE) {
+ if( ((Scene *)id)->r.scemode & R_BG_RENDER) files->flags |= ACTIVE;
+ }
+ }
+#endif
+ files->nr= totbl+1;
+ files->poin= id;
+ fake= id->flag & LIB_FAKEUSER;
+ if(idcode == ID_MA || idcode == ID_TE || idcode == ID_LA || idcode == ID_WO || idcode == ID_IM) {
+ files->flags |= IMAGEFILE;
+ }
+ if(id->lib && fake) sprintf(files->extra, "LF %d", id->us);
+ else if(id->lib) sprintf(files->extra, "L %d", id->us);
+ else if(fake) sprintf(files->extra, "F %d", id->us);
+ else sprintf(files->extra, " %d", id->us);
+
+ if(id->lib) {
+ if(totlib==0) firstlib= files;
+ totlib++;
+ }
+
+ files++;
+ }
+ totbl++;
+ }
+
+ id= id->next;
+ }
+
+ /* only qsort of library blocks */
+ if(totlib>1) {
+ qsort(firstlib, totlib, sizeof(struct direntry), compare_name);
+ }
+ }
+ filelist->filter = 0;
+ filelist_filter(filelist);
+}
+
diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h
index dd3c2c766c1..a8d909f899e 100644
--- a/source/blender/editors/space_file/filelist.h
+++ b/source/blender/editors/space_file/filelist.h
@@ -42,12 +42,13 @@ struct FolderList;
struct direntry;
struct BlendHandle;
struct Scene;
+struct Main;
struct rcti;
+struct ReportList;
-struct FileList * filelist_new();
+struct FileList * filelist_new(short type);
void filelist_init_icons();
void filelist_free_icons();
-struct FileList * filelist_copy(struct FileList* filelist);
int filelist_find(struct FileList* filelist, char *file);
void filelist_free(struct FileList* filelist);
void filelist_sort(struct FileList* filelist, short sort);
@@ -71,6 +72,13 @@ int filelist_empty(struct FileList* filelist);
void filelist_parent(struct FileList* filelist);
void filelist_setfiletypes(struct FileList* filelist, short has_quicktime);
+
+int filelist_islibrary (struct FileList* filelist, char* dir, char* group);
+void filelist_from_main(struct FileList* filelist);
+void filelist_from_library(struct FileList* filelist);
+void filelist_freelib(struct FileList* filelist);
+void filelist_hideparent(struct FileList* filelist, short hide);
+
struct ListBase * folderlist_new();
void folderlist_free(struct ListBase* folderlist);
void folderlist_popdir(struct ListBase* folderlist, char *dir);
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;
}
}
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 722fa475727..f71defe3949 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -119,6 +119,7 @@ static void file_free(SpaceLink *sl)
SpaceFile *sfile= (SpaceFile *) sl;
if(sfile->files) {
+ filelist_freelib(sfile->files);
filelist_free(sfile->files);
MEM_freeN(sfile->files);
sfile->files= NULL;
@@ -165,7 +166,7 @@ static SpaceLink *file_duplicate(SpaceLink *sl)
/* clear or remove stuff from old */
sfilen->op = NULL; /* file window doesn't own operators */
- sfilen->files = filelist_new();
+ sfilen->files = filelist_new(sfileo->params->type);
if(sfileo->folders_prev)
sfilen->folders_prev = MEM_dupallocN(sfileo->folders_prev);
@@ -190,7 +191,7 @@ static void file_refresh(const bContext *C, ScrArea *sa)
if (!sfile->folders_prev)
sfile->folders_prev = folderlist_new();
if (!sfile->files) {
- sfile->files = filelist_new();
+ sfile->files = filelist_new(params->type);
file_change_dir(sfile);
params->active_file = -1; // added this so it opens nicer (ton)
}
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 ********************/
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index 640c968742c..f4d8682b8ea 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -300,11 +300,11 @@ void FILE_OT_report_missing_files(wmOperatorType *ot)
static int find_missing_files_exec(bContext *C, wmOperator *op)
{
- char *filename;
+ char *path;
- filename= RNA_string_get_alloc(op->ptr, "filename", NULL, 0);
- findMissingFiles(filename);
- MEM_freeN(filename);
+ path= RNA_string_get_alloc(op->ptr, "path", NULL, 0);
+ findMissingFiles(path);
+ MEM_freeN(path);
return OPERATOR_FINISHED;
}
@@ -330,7 +330,7 @@ void FILE_OT_find_missing_files(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, 0);
+ WM_operator_properties_filesel(ot, 0, FILE_SPECIAL);
}
#if 0
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c
index 88b8dccc6c9..c17793b28f8 100644
--- a/source/blender/editors/space_script/script_edit.c
+++ b/source/blender/editors/space_script/script_edit.c
@@ -64,10 +64,10 @@ static int run_pyfile_exec(bContext *C, wmOperator *op)
ARegion *ar= CTX_wm_region(C);
- char filename[512];
- RNA_string_get(op->ptr, "filename", filename);
+ char path[512];
+ RNA_string_get(op->ptr, "path", path);
#ifndef DISABLE_PYTHON
- if(BPY_run_python_script(C, filename, NULL, op->reports)) {
+ if(BPY_run_python_script(C, path, NULL, op->reports)) {
ED_region_tag_redraw(ar);
return OPERATOR_FINISHED;
}
@@ -85,7 +85,7 @@ void SCRIPT_OT_python_file_run(wmOperatorType *ot)
ot->exec= run_pyfile_exec;
ot->poll= ED_operator_areaactive;
- RNA_def_string_file_path(ot->srna, "filename", "", 512, "Filename", "");
+ RNA_def_string_file_path(ot->srna, "path", "", 512, "Path", "");
}
static int run_ui_scripts_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/space_script/script_ops.c b/source/blender/editors/space_script/script_ops.c
index aa35ba54b7f..270cc1ffd8f 100644
--- a/source/blender/editors/space_script/script_ops.c
+++ b/source/blender/editors/space_script/script_ops.c
@@ -68,7 +68,7 @@ void script_keymap(wmWindowManager *wm)
ListBase *keymap= WM_keymap_listbase(wm, "Script", SPACE_SCRIPT, 0);
/* TODO - this is just while we have no way to load a text datablock */
- RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_python_file_run", PKEY, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0)->ptr, "filename", "test.py");
+ RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_python_file_run", PKEY, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0)->ptr, "path", "test.py");
WM_keymap_add_item(keymap, "SCRIPT_OT_python_run_ui_scripts", PKEY, KM_PRESS, KM_SHIFT, 0);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 8a1b3bf3465..bd5259ddb52 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -289,7 +289,7 @@ static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)
Editing *ed= seq_give_editing(scene, TRUE);
struct anim *an;
- char filename[FILE_MAX];
+ char path[FILE_MAX];
Sequence *seq, *soundseq=NULL; /* generic strip vars */
Strip *strip;
@@ -301,12 +301,12 @@ static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)
channel= RNA_int_get(op->ptr, "channel");
sound = RNA_boolean_get(op->ptr, "sound");
- RNA_string_get(op->ptr, "filename", filename);
+ RNA_string_get(op->ptr, "path", path);
- an = openanim(filename, IB_rect);
+ an = openanim(path, IB_rect);
if (an==NULL) {
- BKE_reportf(op->reports, RPT_ERROR, "Filename \"%s\" could not be loaded as a movie", filename);
+ BKE_reportf(op->reports, RPT_ERROR, "File \"%s\" could not be loaded as a movie", path);
return OPERATOR_CANCELLED;
}
@@ -323,7 +323,7 @@ static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)
strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
- BLI_split_dirfile_basic(filename, strip->dir, se->name);
+ BLI_split_dirfile_basic(path, strip->dir, se->name);
RNA_string_get(op->ptr, "name", seq->name);
@@ -332,7 +332,7 @@ static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)
if(sound)
{
- soundseq = sequencer_add_sound_strip(C, NULL, start_frame, channel+1, filename);
+ soundseq = sequencer_add_sound_strip(C, NULL, start_frame, channel+1, path);
if(soundseq != NULL)
RNA_string_get(op->ptr, "name", soundseq->name);
}
@@ -376,7 +376,7 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE);
+ WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE, FILE_SPECIAL);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
RNA_def_boolean(ot->srna, "sound", TRUE, "Sound", "Load sound with the movie");
}
@@ -384,7 +384,7 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
/* add sound operator */
static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op)
{
- char filename[FILE_MAX];
+ char path[FILE_MAX];
Scene *scene= CTX_data_scene(C);
Sequence *seq; /* generic strip vars */
int start_frame, channel; /* operator props */
@@ -392,9 +392,9 @@ static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op)
start_frame= RNA_int_get(op->ptr, "start_frame");
channel= RNA_int_get(op->ptr, "channel");
- RNA_string_get(op->ptr, "filename", filename);
+ RNA_string_get(op->ptr, "path", path);
- seq = sequencer_add_sound_strip(C, op, start_frame, channel, filename);
+ seq = sequencer_add_sound_strip(C, op, start_frame, channel, path);
if(seq == NULL)
return OPERATOR_CANCELLED;
@@ -442,7 +442,7 @@ void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE);
+ WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory.");
}
@@ -455,7 +455,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
int tot_images;
- char filename[FILE_MAX];
+ char path[FILE_MAX];
Sequence *seq; /* generic strip vars */
Strip *strip;
@@ -466,14 +466,14 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
start_frame= RNA_int_get(op->ptr, "start_frame");
channel= RNA_int_get(op->ptr, "channel");
- RNA_string_get(op->ptr, "filename", filename);
+ RNA_string_get(op->ptr, "path", path);
seq = alloc_sequence(ed->seqbasep, start_frame, channel);
seq->type= SEQ_IMAGE;
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- BLI_split_dirfile_basic(filename, strip->dir, NULL);
+ BLI_split_dirfile_basic(path, strip->dir, NULL);
tot_images= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
@@ -490,7 +490,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
RNA_END;
}
else {
- BLI_split_dirfile_basic(filename, NULL, se->name);
+ BLI_split_dirfile_basic(path, NULL, se->name);
}
RNA_string_get(op->ptr, "name", seq->name);
@@ -538,7 +538,7 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE);
+ WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", "");
@@ -606,15 +606,15 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
if (seq->type==SEQ_PLUGIN) {
- char filename[FILE_MAX];
- RNA_string_get(op->ptr, "filename", filename);
+ char path[FILE_MAX];
+ RNA_string_get(op->ptr, "path", path);
- sh.init_plugin(seq, filename);
+ sh.init_plugin(seq, path);
if(seq->plugin==NULL) {
BLI_remlink(ed->seqbasep, seq);
seq_free_sequence(scene, seq);
- BKE_reportf(op->reports, RPT_ERROR, "Sequencer plugin \"%s\" could not load.", filename);
+ BKE_reportf(op->reports, RPT_ERROR, "Sequencer plugin \"%s\" could not load.", path);
return OPERATOR_CANCELLED;
}
}
@@ -673,7 +673,7 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- WM_operator_properties_filesel(ot, 0);
+ WM_operator_properties_filesel(ot, 0, FILE_SPECIAL);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME);
RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type");
RNA_def_float_vector(ot->srna, "color", 3, NULL, 0.0f, 1.0f, "Color", "Initialize the strip with this color (only used when type='COLOR')", 0.0f, 1.0f);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 3411d9114df..3568f50dfe1 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -192,7 +192,7 @@ static int open_exec(bContext *C, wmOperator *op)
Text *text;
char str[FILE_MAX];
- RNA_string_get(op->ptr, "filename", str);
+ RNA_string_get(op->ptr, "path", str);
text= add_text(str, G.sce);
@@ -211,10 +211,10 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
Text *text= CTX_data_edit_text(C);
char *path= (text && text->name)? text->name: G.sce;
- if(RNA_property_is_set(op->ptr, "filename"))
+ if(RNA_property_is_set(op->ptr, "path"))
return open_exec(C, op);
- RNA_string_set(op->ptr, "filename", path);
+ RNA_string_set(op->ptr, "path", path);
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
@@ -233,7 +233,7 @@ void TEXT_OT_open(wmOperatorType *ot)
ot->poll= text_new_poll;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE);
+ WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL);
}
/******************* reload operator *********************/
@@ -420,7 +420,7 @@ static int save_as_exec(bContext *C, wmOperator *op)
if(!text)
return OPERATOR_CANCELLED;
- RNA_string_get(op->ptr, "filename", str);
+ RNA_string_get(op->ptr, "path", str);
if(text->name) MEM_freeN(text->name);
text->name= BLI_strdup(str);
@@ -438,7 +438,7 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event)
Text *text= CTX_data_edit_text(C);
char *str;
- if(RNA_property_is_set(op->ptr, "filename"))
+ if(RNA_property_is_set(op->ptr, "path"))
return save_as_exec(C, op);
if(text->name)
@@ -448,7 +448,7 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event)
else
str= G.sce;
- RNA_string_set(op->ptr, "filename", str);
+ RNA_string_set(op->ptr, "path", str);
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
@@ -467,7 +467,7 @@ void TEXT_OT_save_as(wmOperatorType *ot)
ot->poll= text_edit_poll;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE);
+ WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL);
}
/******************* run script operator *********************/