Blender  V2.93
BKE_bpath.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
23 #pragma once
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 struct ID;
30 struct ListBase;
31 struct Main;
32 struct ReportList;
33 
34 /* Function that does something with an ID's file path. Should return 1 if the
35  * path has changed, and in that case, should write the result to pathOut. */
36 typedef bool (*BPathVisitor)(void *userdata, char *path_dst, const char *path_src);
37 /* Executes 'visit' for each path associated with 'id'. */
38 void BKE_bpath_traverse_id(struct Main *bmain,
39  struct ID *id,
40  BPathVisitor visit_cb,
41  const int flag,
42  void *bpath_user_data);
43 void BKE_bpath_traverse_id_list(struct Main *bmain,
44  struct ListBase *lb,
45  BPathVisitor visit_cb,
46  const int flag,
47  void *bpath_user_data);
48 void BKE_bpath_traverse_main(struct Main *bmain,
49  BPathVisitor visit_cb,
50  const int flag,
51  void *bpath_user_data);
52 bool BKE_bpath_relocate_visitor(void *oldbasepath, char *path_dst, const char *path_src);
53 
54 /* Functions for temp backup/restore of paths, path count must NOT change */
55 void *BKE_bpath_list_backup(struct Main *bmain, const int flag);
56 void BKE_bpath_list_restore(struct Main *bmain, const int flag, void *ls_handle);
57 void BKE_bpath_list_free(void *ls_handle);
58 
59 enum {
60  /* convert paths to absolute */
62  /* skip library paths */
64  /* skip packed data */
66  /* skip paths where a single dir is used with an array of files, eg.
67  * sequence strip images and pointcache. in this case only use the first
68  * file, this is needed for directory manipulation functions which might
69  * otherwise modify the same directory multiple times */
71  /* reload data (when the path is edited) */
73 };
74 
75 /* high level funcs */
76 
77 /* creates a text file with missing files if there are any */
78 void BKE_bpath_missing_files_check(struct Main *bmain, struct ReportList *reports);
79 void BKE_bpath_missing_files_find(struct Main *bmain,
80  const char *searchpath,
81  struct ReportList *reports,
82  const bool find_all);
83 void BKE_bpath_relative_rebase(struct Main *bmain,
84  const char *basedir_src,
85  const char *basedir_dst,
86  struct ReportList *reports);
87 void BKE_bpath_relative_convert(struct Main *bmain,
88  const char *basedir,
89  struct ReportList *reports);
90 void BKE_bpath_absolute_convert(struct Main *bmain,
91  const char *basedir,
92  struct ReportList *reports);
93 
94 #ifdef __cplusplus
95 }
96 #endif
void BKE_bpath_traverse_id_list(struct Main *bmain, struct ListBase *lb, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
Definition: bpath.c:772
void BKE_bpath_traverse_main(struct Main *bmain, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
Definition: bpath.c:781
void BKE_bpath_traverse_id(struct Main *bmain, struct ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
Definition: bpath.c:540
bool BKE_bpath_relocate_visitor(void *oldbasepath, char *path_dst, const char *path_src)
Definition: bpath.c:797
void BKE_bpath_relative_rebase(struct Main *bmain, const char *basedir_src, const char *basedir_dst, struct ReportList *reports)
Definition: bpath.c:162
void BKE_bpath_list_restore(struct Main *bmain, const int flag, void *ls_handle)
Definition: bpath.c:882
void BKE_bpath_relative_convert(struct Main *bmain, const char *basedir, struct ReportList *reports)
Definition: bpath.c:224
void BKE_bpath_missing_files_find(struct Main *bmain, const char *searchpath, struct ReportList *reports, const bool find_all)
Definition: bpath.c:430
void BKE_bpath_missing_files_check(struct Main *bmain, struct ReportList *reports)
Definition: bpath.c:107
void BKE_bpath_list_free(void *ls_handle)
Definition: bpath.c:889
@ BKE_BPATH_TRAVERSE_SKIP_MULTIFILE
Definition: BKE_bpath.h:70
@ BKE_BPATH_TRAVERSE_SKIP_LIBRARY
Definition: BKE_bpath.h:63
@ BKE_BPATH_TRAVERSE_ABS
Definition: BKE_bpath.h:61
@ BKE_BPATH_TRAVERSE_SKIP_PACKED
Definition: BKE_bpath.h:65
@ BKE_BPATH_TRAVERSE_RELOAD_EDITED
Definition: BKE_bpath.h:72
void * BKE_bpath_list_backup(struct Main *bmain, const int flag)
Definition: bpath.c:873
bool(* BPathVisitor)(void *userdata, char *path_dst, const char *path_src)
Definition: BKE_bpath.h:36
void BKE_bpath_absolute_convert(struct Main *bmain, const char *basedir, struct ReportList *reports)
Definition: bpath.c:276
Definition: DNA_ID.h:273
Definition: BKE_main.h:116