26
25
* ***** END GPL LICENSE BLOCK *****
29
/* Based on ghash, difference is ghash is not a fixed size,
30
* so for BPath we dont need to malloc */
35
struct BPathIteratorSeqData {
38
struct Sequence **seqar; /* Sequence */
39
struct Scene *scene; /* Current scene */
42
struct BPathIterator {
50
void (*setpath_callback)(struct BPathIterator *, char *);
51
void (*getpath_callback)(struct BPathIterator *, char *);
53
char* base_path; /* base path, the directry the blend file is in - normally G.sce */
55
/* only for seq data */
56
struct BPathIteratorSeqData seqdata;
59
void BLI_bpathIterator_init (struct BPathIterator *bpi, char *base_path);
60
void BLI_bpathIterator_free (struct BPathIterator *bpi);
61
char* BLI_bpathIterator_getLib (struct BPathIterator *bpi);
62
char* BLI_bpathIterator_getName (struct BPathIterator *bpi);
63
int BLI_bpathIterator_getType (struct BPathIterator *bpi);
64
int BLI_bpathIterator_getPathMaxLen (struct BPathIterator *bpi);
65
void BLI_bpathIterator_step (struct BPathIterator *bpi);
66
int BLI_bpathIterator_isDone (struct BPathIterator *bpi);
67
void BLI_bpathIterator_getPath (struct BPathIterator *bpi, char *path);
68
void BLI_bpathIterator_getPathExpanded (struct BPathIterator *bpi, char *path_expanded);
69
void BLI_bpathIterator_setPath (struct BPathIterator *bpi, char *path);
30
* \attention Based on ghash, difference is ghash is not a fixed size,
31
* so for BPath we don't need to malloc
34
#ifndef __BLI_BPATH_H__
35
#define __BLI_BPATH_H__
42
/* Function that does something with an ID's file path. Should return 1 if the
43
* path has changed, and in that case, should write the result to pathOut. */
44
typedef int (*BPathVisitor)(void *userdata, char *path_dst, const char *path_src);
45
/* Executes 'visit' for each path associated with 'id'. */
46
void bpath_traverse_id(struct Main *bmain, struct ID *id, BPathVisitor visit_cb, const int flag, void *userdata);
47
void bpath_traverse_id_list(struct Main *bmain, struct ListBase *lb, BPathVisitor visit_cb, const int flag, void *userdata);
48
void bpath_traverse_main(struct Main *bmain, BPathVisitor visit_cb, const int flag, void *userdata);
49
int bpath_relocate_visitor(void *oldbasepath, char *path_dst, const char *path_src);
51
#define BPATH_TRAVERSE_ABS (1<<0) /* convert paths to absolute */
52
#define BPATH_TRAVERSE_SKIP_LIBRARY (1<<2) /* skip library paths */
53
#define BPATH_TRAVERSE_SKIP_PACKED (1<<3) /* skip packed data */
54
#define BPATH_TRAVERSE_SKIP_MULTIFILE (1<<4) /* skip paths where a single dir is used with an array of files, eg.
55
* sequence strip images and pointcache. in this case only use the first
56
* file, this is needed for directory manipulation functions which might
57
* otherwise modify the same directory multiple times */
71
59
/* high level funcs */
73
61
/* creates a text file with missing files if there are any */
74
void checkMissingFiles(char *basepath, ReportList *reports);
75
void makeFilesRelative(char *basepath, ReportList *reports);
76
void makeFilesAbsolute(char *basepath, ReportList *reports);
77
void findMissingFiles(char *basepath, char *str);
62
void checkMissingFiles(struct Main *bmain, struct ReportList *reports);
63
void makeFilesRelative(struct Main *bmain, const char *basedir, struct ReportList *reports);
64
void makeFilesAbsolute(struct Main *bmain, const char *basedir, struct ReportList *reports);
65
void findMissingFiles(struct Main *bmain, const char *searchpath, struct ReportList *reports);
67
#endif // __BLI_BPATH_H__