move bpath module from BLI to BKE, it was making many bad level calls into BKE.
This commit is contained in:
@@ -25,14 +25,14 @@
|
|||||||
* ***** END GPL LICENSE BLOCK *****
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \file BLI_bpath.h
|
/** \file BKE_bpath.h
|
||||||
* \ingroup bli
|
* \ingroup bli
|
||||||
* \attention Based on ghash, difference is ghash is not a fixed size,
|
* \attention Based on ghash, difference is ghash is not a fixed size,
|
||||||
* so for BPath we don't need to malloc
|
* so for BPath we don't need to malloc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __BLI_BPATH_H__
|
#ifndef __BKE_BPATH_H__
|
||||||
#define __BLI_BPATH_H__
|
#define __BKE_BPATH_H__
|
||||||
|
|
||||||
struct ID;
|
struct ID;
|
||||||
struct ListBase;
|
struct ListBase;
|
||||||
@@ -43,20 +43,20 @@ struct ReportList;
|
|||||||
* path has changed, and in that case, should write the result to pathOut. */
|
* path has changed, and in that case, should write the result to pathOut. */
|
||||||
typedef int (*BPathVisitor)(void *userdata, char *path_dst, const char *path_src);
|
typedef int (*BPathVisitor)(void *userdata, char *path_dst, const char *path_src);
|
||||||
/* Executes 'visit' for each path associated with 'id'. */
|
/* Executes 'visit' for each path associated with 'id'. */
|
||||||
void BLI_bpath_traverse_id(struct Main *bmain, struct ID *id, BPathVisitor visit_cb, const int flag, void *userdata);
|
void BKE_bpath_traverse_id(struct Main *bmain, struct ID *id, BPathVisitor visit_cb, const int flag, void *userdata);
|
||||||
void BLI_bpath_traverse_id_list(struct Main *bmain, struct ListBase *lb, BPathVisitor visit_cb, const int flag, void *userdata);
|
void BKE_bpath_traverse_id_list(struct Main *bmain, struct ListBase *lb, BPathVisitor visit_cb, const int flag, void *userdata);
|
||||||
void BLI_bpath_traverse_main(struct Main *bmain, BPathVisitor visit_cb, const int flag, void *userdata);
|
void BKE_bpath_traverse_main(struct Main *bmain, BPathVisitor visit_cb, const int flag, void *userdata);
|
||||||
int BLI_bpath_relocate_visitor(void *oldbasepath, char *path_dst, const char *path_src);
|
int BKE_bpath_relocate_visitor(void *oldbasepath, char *path_dst, const char *path_src);
|
||||||
|
|
||||||
/* Functions for temp backup/restore of paths, path count must NOT change */
|
/* Functions for temp backup/restore of paths, path count must NOT change */
|
||||||
void *BLI_bpath_list_backup(struct Main *bmain, const int flag);
|
void *BKE_bpath_list_backup(struct Main *bmain, const int flag);
|
||||||
void BLI_bpath_list_restore(struct Main *bmain, const int flag, void *ls_handle);
|
void BKE_bpath_list_restore(struct Main *bmain, const int flag, void *ls_handle);
|
||||||
void BLI_bpath_list_free(void *ls_handle);
|
void BKE_bpath_list_free(void *ls_handle);
|
||||||
|
|
||||||
#define BLI_BPATH_TRAVERSE_ABS (1 << 0) /* convert paths to absolute */
|
#define BKE_BPATH_TRAVERSE_ABS (1 << 0) /* convert paths to absolute */
|
||||||
#define BLI_BPATH_TRAVERSE_SKIP_LIBRARY (1 << 2) /* skip library paths */
|
#define BKE_BPATH_TRAVERSE_SKIP_LIBRARY (1 << 2) /* skip library paths */
|
||||||
#define BLI_BPATH_TRAVERSE_SKIP_PACKED (1 << 3) /* skip packed data */
|
#define BKE_BPATH_TRAVERSE_SKIP_PACKED (1 << 3) /* skip packed data */
|
||||||
#define BLI_BPATH_TRAVERSE_SKIP_MULTIFILE (1 << 4) /* skip paths where a single dir is used with an array of files, eg.
|
#define BKE_BPATH_TRAVERSE_SKIP_MULTIFILE (1 << 4) /* skip paths where a single dir is used with an array of files, eg.
|
||||||
* sequence strip images and pointcache. in this case only use the first
|
* sequence strip images and pointcache. in this case only use the first
|
||||||
* file, this is needed for directory manipulation functions which might
|
* file, this is needed for directory manipulation functions which might
|
||||||
* otherwise modify the same directory multiple times */
|
* otherwise modify the same directory multiple times */
|
||||||
@@ -64,9 +64,9 @@ void BLI_bpath_list_free(void *ls_handle);
|
|||||||
/* high level funcs */
|
/* high level funcs */
|
||||||
|
|
||||||
/* creates a text file with missing files if there are any */
|
/* creates a text file with missing files if there are any */
|
||||||
void BLI_bpath_missing_files_check(struct Main *bmain, struct ReportList *reports);
|
void BKE_bpath_missing_files_check(struct Main *bmain, struct ReportList *reports);
|
||||||
void BLI_bpath_missing_files_find(struct Main *bmain, const char *searchpath, struct ReportList *reports);
|
void BKE_bpath_missing_files_find(struct Main *bmain, const char *searchpath, struct ReportList *reports);
|
||||||
void BLI_bpath_relative_convert(struct Main *bmain, const char *basedir, struct ReportList *reports);
|
void BKE_bpath_relative_convert(struct Main *bmain, const char *basedir, struct ReportList *reports);
|
||||||
void BLI_bpath_absolute_convert(struct Main *bmain, const char *basedir, struct ReportList *reports);
|
void BKE_bpath_absolute_convert(struct Main *bmain, const char *basedir, struct ReportList *reports);
|
||||||
|
|
||||||
#endif /* __BLI_BPATH_H__ */
|
#endif /* __BKE_BPATH_H__ */
|
||||||
@@ -65,6 +65,7 @@ set(SRC
|
|||||||
intern/bmfont.c
|
intern/bmfont.c
|
||||||
intern/boids.c
|
intern/boids.c
|
||||||
intern/booleanops_mesh.c
|
intern/booleanops_mesh.c
|
||||||
|
intern/bpath.c
|
||||||
intern/brush.c
|
intern/brush.c
|
||||||
intern/bullet.c
|
intern/bullet.c
|
||||||
intern/bvhutils.c
|
intern/bvhutils.c
|
||||||
@@ -101,9 +102,9 @@ set(SRC
|
|||||||
intern/lamp.c
|
intern/lamp.c
|
||||||
intern/lattice.c
|
intern/lattice.c
|
||||||
intern/library.c
|
intern/library.c
|
||||||
|
intern/mask.c
|
||||||
intern/mask_evaluate.c
|
intern/mask_evaluate.c
|
||||||
intern/mask_rasterize.c
|
intern/mask_rasterize.c
|
||||||
intern/mask.c
|
|
||||||
intern/material.c
|
intern/material.c
|
||||||
intern/mball.c
|
intern/mball.c
|
||||||
intern/mesh.c
|
intern/mesh.c
|
||||||
@@ -147,6 +148,7 @@ set(SRC
|
|||||||
intern/world.c
|
intern/world.c
|
||||||
intern/writeavi.c
|
intern/writeavi.c
|
||||||
intern/writeframeserver.c
|
intern/writeframeserver.c
|
||||||
|
|
||||||
|
|
||||||
BKE_DerivedMesh.h
|
BKE_DerivedMesh.h
|
||||||
BKE_action.h
|
BKE_action.h
|
||||||
@@ -234,6 +236,8 @@ set(SRC
|
|||||||
BKE_world.h
|
BKE_world.h
|
||||||
BKE_writeavi.h
|
BKE_writeavi.h
|
||||||
BKE_writeframeserver.h
|
BKE_writeframeserver.h
|
||||||
|
BKE_bpath.h
|
||||||
|
|
||||||
depsgraph_private.h
|
depsgraph_private.h
|
||||||
nla_private.h
|
nla_private.h
|
||||||
intern/CCGSubSurf.h
|
intern/CCGSubSurf.h
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
#include "DNA_object_types.h"
|
#include "DNA_object_types.h"
|
||||||
|
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
#include "BLI_ghash.h"
|
#include "BLI_ghash.h"
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
#include "DNA_sound_types.h"
|
#include "DNA_sound_types.h"
|
||||||
|
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
#include "BLI_dynstr.h"
|
#include "BLI_dynstr.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
#include "BLI_callbacks.h"
|
#include "BLI_callbacks.h"
|
||||||
@@ -182,7 +182,7 @@ static void clean_paths(Main *main)
|
|||||||
{
|
{
|
||||||
Scene *scene;
|
Scene *scene;
|
||||||
|
|
||||||
BLI_bpath_traverse_main(main, clean_paths_visit_cb, BLI_BPATH_TRAVERSE_SKIP_MULTIFILE, NULL);
|
BKE_bpath_traverse_main(main, clean_paths_visit_cb, BKE_BPATH_TRAVERSE_SKIP_MULTIFILE, NULL);
|
||||||
|
|
||||||
for (scene = main->scene.first; scene; scene = scene->id.next) {
|
for (scene = main->scene.first; scene; scene = scene->id.next) {
|
||||||
BLI_clean(scene->r.pic);
|
BLI_clean(scene->r.pic);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
#include "DNA_smoke_types.h"
|
#include "DNA_smoke_types.h"
|
||||||
|
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
#include "BKE_font.h"
|
#include "BKE_font.h"
|
||||||
@@ -95,9 +95,9 @@ static int checkMissingFiles_visit_cb(void *userdata, char *UNUSED(path_dst), co
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* high level function */
|
/* high level function */
|
||||||
void BLI_bpath_missing_files_check(Main *bmain, ReportList *reports)
|
void BKE_bpath_missing_files_check(Main *bmain, ReportList *reports)
|
||||||
{
|
{
|
||||||
BLI_bpath_traverse_main(bmain, checkMissingFiles_visit_cb, BLI_BPATH_TRAVERSE_ABS, reports);
|
BKE_bpath_traverse_main(bmain, checkMissingFiles_visit_cb, BKE_BPATH_TRAVERSE_ABS, reports);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct BPathRemap_Data {
|
typedef struct BPathRemap_Data {
|
||||||
@@ -132,7 +132,7 @@ static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *reports)
|
void BKE_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *reports)
|
||||||
{
|
{
|
||||||
BPathRemap_Data data = {NULL};
|
BPathRemap_Data data = {NULL};
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ void BLI_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *re
|
|||||||
data.basedir = basedir;
|
data.basedir = basedir;
|
||||||
data.reports = reports;
|
data.reports = reports;
|
||||||
|
|
||||||
BLI_bpath_traverse_main(bmain, makeFilesRelative_visit_cb, 0, (void *)&data);
|
BKE_bpath_traverse_main(bmain, makeFilesRelative_visit_cb, 0, (void *)&data);
|
||||||
|
|
||||||
BKE_reportf(reports, data.count_failed ? RPT_WARNING : RPT_INFO,
|
BKE_reportf(reports, data.count_failed ? RPT_WARNING : RPT_INFO,
|
||||||
"Total files %d | Changed %d | Failed %d",
|
"Total files %d | Changed %d | Failed %d",
|
||||||
@@ -174,8 +174,8 @@ static int makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* similar to BLI_bpath_relative_convert - keep in sync! */
|
/* similar to BKE_bpath_relative_convert - keep in sync! */
|
||||||
void BLI_bpath_absolute_convert(Main *bmain, const char *basedir, ReportList *reports)
|
void BKE_bpath_absolute_convert(Main *bmain, const char *basedir, ReportList *reports)
|
||||||
{
|
{
|
||||||
BPathRemap_Data data = {NULL};
|
BPathRemap_Data data = {NULL};
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ void BLI_bpath_absolute_convert(Main *bmain, const char *basedir, ReportList *re
|
|||||||
data.basedir = basedir;
|
data.basedir = basedir;
|
||||||
data.reports = reports;
|
data.reports = reports;
|
||||||
|
|
||||||
BLI_bpath_traverse_main(bmain, makeFilesAbsolute_visit_cb, 0, (void *)&data);
|
BKE_bpath_traverse_main(bmain, makeFilesAbsolute_visit_cb, 0, (void *)&data);
|
||||||
|
|
||||||
BKE_reportf(reports, data.count_failed ? RPT_WARNING : RPT_INFO,
|
BKE_reportf(reports, data.count_failed ? RPT_WARNING : RPT_INFO,
|
||||||
"Total files %d | Changed %d | Failed %d",
|
"Total files %d | Changed %d | Failed %d",
|
||||||
@@ -298,14 +298,14 @@ static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_bpath_missing_files_find(Main *bmain, const char *searchpath, ReportList *reports)
|
void BKE_bpath_missing_files_find(Main *bmain, const char *searchpath, ReportList *reports)
|
||||||
{
|
{
|
||||||
struct BPathFind_Data data = {NULL};
|
struct BPathFind_Data data = {NULL};
|
||||||
|
|
||||||
data.reports = reports;
|
data.reports = reports;
|
||||||
BLI_split_dir_part(searchpath, data.searchdir, sizeof(data.searchdir));
|
BLI_split_dir_part(searchpath, data.searchdir, sizeof(data.searchdir));
|
||||||
|
|
||||||
BLI_bpath_traverse_main(bmain, findMissingFiles_visit_cb, 0, (void *)&data);
|
BKE_bpath_traverse_main(bmain, findMissingFiles_visit_cb, 0, (void *)&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run a visitor on a string, replacing the contents of the string as needed. */
|
/* Run a visitor on a string, replacing the contents of the string as needed. */
|
||||||
@@ -383,11 +383,11 @@ static int rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *ab
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Run visitor function 'visit' on all paths contained in 'id'. */
|
/* Run visitor function 'visit' on all paths contained in 'id'. */
|
||||||
void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
|
void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
|
||||||
{
|
{
|
||||||
const char *absbase = (flag & BLI_BPATH_TRAVERSE_ABS) ? ID_BLEND_PATH(bmain, id) : NULL;
|
const char *absbase = (flag & BKE_BPATH_TRAVERSE_ABS) ? ID_BLEND_PATH(bmain, id) : NULL;
|
||||||
|
|
||||||
if ((flag & BLI_BPATH_TRAVERSE_SKIP_LIBRARY) && id->lib) {
|
if ((flag & BKE_BPATH_TRAVERSE_SKIP_LIBRARY) && id->lib) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,7 +396,7 @@ void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
|
|||||||
{
|
{
|
||||||
Image *ima;
|
Image *ima;
|
||||||
ima = (Image *)id;
|
ima = (Image *)id;
|
||||||
if (ima->packedfile == NULL || (flag & BLI_BPATH_TRAVERSE_SKIP_PACKED) == 0) {
|
if (ima->packedfile == NULL || (flag & BKE_BPATH_TRAVERSE_SKIP_PACKED) == 0) {
|
||||||
if (ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
|
if (ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
|
||||||
rewrite_path_fixed(ima->name, visit_cb, absbase, bpath_user_data);
|
rewrite_path_fixed(ima->name, visit_cb, absbase, bpath_user_data);
|
||||||
}
|
}
|
||||||
@@ -475,7 +475,7 @@ void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
|
|||||||
case ID_SO:
|
case ID_SO:
|
||||||
{
|
{
|
||||||
bSound *sound = (bSound *)id;
|
bSound *sound = (bSound *)id;
|
||||||
if (sound->packedfile == NULL || (flag & BLI_BPATH_TRAVERSE_SKIP_PACKED) == 0) {
|
if (sound->packedfile == NULL || (flag & BKE_BPATH_TRAVERSE_SKIP_PACKED) == 0) {
|
||||||
rewrite_path_fixed(sound->name, visit_cb, absbase, bpath_user_data);
|
rewrite_path_fixed(sound->name, visit_cb, absbase, bpath_user_data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -488,7 +488,7 @@ void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
|
|||||||
case ID_VF:
|
case ID_VF:
|
||||||
{
|
{
|
||||||
VFont *vfont = (VFont *)id;
|
VFont *vfont = (VFont *)id;
|
||||||
if (vfont->packedfile == NULL || (flag & BLI_BPATH_TRAVERSE_SKIP_PACKED) == 0) {
|
if (vfont->packedfile == NULL || (flag & BKE_BPATH_TRAVERSE_SKIP_PACKED) == 0) {
|
||||||
if (BKE_vfont_is_builtin(vfont) == FALSE) {
|
if (BKE_vfont_is_builtin(vfont) == FALSE) {
|
||||||
rewrite_path_fixed(((VFont *)id)->name, visit_cb, absbase, bpath_user_data);
|
rewrite_path_fixed(((VFont *)id)->name, visit_cb, absbase, bpath_user_data);
|
||||||
}
|
}
|
||||||
@@ -555,7 +555,7 @@ void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
|
|||||||
int len = MEM_allocN_len(se) / sizeof(*se);
|
int len = MEM_allocN_len(se) / sizeof(*se);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (flag & BLI_BPATH_TRAVERSE_SKIP_MULTIFILE) {
|
if (flag & BKE_BPATH_TRAVERSE_SKIP_MULTIFILE) {
|
||||||
/* only operate on one path */
|
/* only operate on one path */
|
||||||
len = MIN2(1, len);
|
len = MIN2(1, len);
|
||||||
}
|
}
|
||||||
@@ -604,26 +604,26 @@ void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_bpath_traverse_id_list(Main *bmain, ListBase *lb, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
|
void BKE_bpath_traverse_id_list(Main *bmain, ListBase *lb, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
|
||||||
{
|
{
|
||||||
ID *id;
|
ID *id;
|
||||||
for (id = lb->first; id; id = id->next) {
|
for (id = lb->first; id; id = id->next) {
|
||||||
BLI_bpath_traverse_id(bmain, id, visit_cb, flag, bpath_user_data);
|
BKE_bpath_traverse_id(bmain, id, visit_cb, flag, bpath_user_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_bpath_traverse_main(Main *bmain, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
|
void BKE_bpath_traverse_main(Main *bmain, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
|
||||||
{
|
{
|
||||||
ListBase *lbarray[MAX_LIBARRAY];
|
ListBase *lbarray[MAX_LIBARRAY];
|
||||||
int a = set_listbasepointers(bmain, lbarray);
|
int a = set_listbasepointers(bmain, lbarray);
|
||||||
while (a--) {
|
while (a--) {
|
||||||
BLI_bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data);
|
BKE_bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rewrites a relative path to be relative to the main file - unless the path is
|
/* Rewrites a relative path to be relative to the main file - unless the path is
|
||||||
* absolute, in which case it is not altered. */
|
* absolute, in which case it is not altered. */
|
||||||
int BLI_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *path_src)
|
int BKE_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *path_src)
|
||||||
{
|
{
|
||||||
/* be sure there is low chance of the path being too short */
|
/* be sure there is low chance of the path being too short */
|
||||||
char filepath[(FILE_MAXDIR * 2) + FILE_MAXFILE];
|
char filepath[(FILE_MAXDIR * 2) + FILE_MAXFILE];
|
||||||
@@ -700,23 +700,23 @@ static int bpath_list_restore(void *userdata, char *path_dst, const char *path_s
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* return ls_handle */
|
/* return ls_handle */
|
||||||
void *BLI_bpath_list_backup(Main *bmain, const int flag)
|
void *BKE_bpath_list_backup(Main *bmain, const int flag)
|
||||||
{
|
{
|
||||||
ListBase *ls = MEM_callocN(sizeof(ListBase), __func__);
|
ListBase *ls = MEM_callocN(sizeof(ListBase), __func__);
|
||||||
|
|
||||||
BLI_bpath_traverse_main(bmain, bpath_list_append, flag, ls);
|
BKE_bpath_traverse_main(bmain, bpath_list_append, flag, ls);
|
||||||
|
|
||||||
return ls;
|
return ls;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_bpath_list_restore(Main *bmain, const int flag, void *ls_handle)
|
void BKE_bpath_list_restore(Main *bmain, const int flag, void *ls_handle)
|
||||||
{
|
{
|
||||||
ListBase *ls = ls_handle;
|
ListBase *ls = ls_handle;
|
||||||
|
|
||||||
BLI_bpath_traverse_main(bmain, bpath_list_restore, flag, ls);
|
BKE_bpath_traverse_main(bmain, bpath_list_restore, flag, ls);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_bpath_list_free(void *ls_handle)
|
void BKE_bpath_list_free(void *ls_handle)
|
||||||
{
|
{
|
||||||
ListBase *ls = ls_handle;
|
ListBase *ls = ls_handle;
|
||||||
BLI_assert(ls->first == NULL); /* assumes we were used */
|
BLI_assert(ls->first == NULL); /* assumes we were used */
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
#include "RNA_access.h"
|
#include "RNA_access.h"
|
||||||
|
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_rand.h"
|
#include "BLI_rand.h"
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_threads.h"
|
#include "BLI_threads.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
|
|
||||||
#include "BKE_bmfont.h"
|
#include "BKE_bmfont.h"
|
||||||
#include "BKE_colortools.h"
|
#include "BKE_colortools.h"
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_dynstr.h"
|
#include "BLI_dynstr.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
|
|
||||||
#include "BKE_animsys.h"
|
#include "BKE_animsys.h"
|
||||||
#include "BKE_camera.h"
|
#include "BKE_camera.h"
|
||||||
@@ -136,9 +136,9 @@ void BKE_id_lib_local_paths(Main *bmain, Library *lib, ID *id)
|
|||||||
{
|
{
|
||||||
char *bpath_user_data[2] = {bmain->name, lib->filepath};
|
char *bpath_user_data[2] = {bmain->name, lib->filepath};
|
||||||
|
|
||||||
BLI_bpath_traverse_id(bmain, id,
|
BKE_bpath_traverse_id(bmain, id,
|
||||||
BLI_bpath_relocate_visitor,
|
BKE_bpath_relocate_visitor,
|
||||||
BLI_BPATH_TRAVERSE_SKIP_MULTIFILE,
|
BKE_BPATH_TRAVERSE_SKIP_MULTIFILE,
|
||||||
bpath_user_data);
|
bpath_user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
#include "BLI_listbase.h"
|
#include "BLI_listbase.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
#include "BLI_string.h"
|
#include "BLI_string.h"
|
||||||
|
|
||||||
#include "BKE_animsys.h"
|
#include "BKE_animsys.h"
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
|
|
||||||
|
|
||||||
#include "BKE_global.h"
|
#include "BKE_global.h"
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
#include "BLI_edgehash.h"
|
#include "BLI_edgehash.h"
|
||||||
#include "BLI_scanfill.h"
|
#include "BLI_scanfill.h"
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
#include "DNA_object_types.h"
|
#include "DNA_object_types.h"
|
||||||
|
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
#include "BLI_pbvh.h"
|
#include "BLI_pbvh.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
#include "BLI_rand.h"
|
#include "BLI_rand.h"
|
||||||
#include "BLI_threads.h"
|
#include "BLI_threads.h"
|
||||||
#include "BLI_linklist.h"
|
#include "BLI_linklist.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
|
|
||||||
#include "BKE_anim.h"
|
#include "BKE_anim.h"
|
||||||
#include "BKE_animsys.h"
|
#include "BKE_animsys.h"
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
|
|
||||||
#include "BKE_animsys.h"
|
#include "BKE_animsys.h"
|
||||||
#include "BKE_global.h"
|
#include "BKE_global.h"
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
#include "BLI_kdopbvh.h"
|
#include "BLI_kdopbvh.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
|
|
||||||
#include "DNA_key_types.h"
|
#include "DNA_key_types.h"
|
||||||
#include "DNA_object_types.h"
|
#include "DNA_object_types.h"
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
#include "BLI_listbase.h"
|
#include "BLI_listbase.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
|
|
||||||
#include "BKE_animsys.h"
|
#include "BKE_animsys.h"
|
||||||
#include "BKE_global.h"
|
#include "BKE_global.h"
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ set(SRC
|
|||||||
intern/BLI_mempool.c
|
intern/BLI_mempool.c
|
||||||
intern/DLRB_tree.c
|
intern/DLRB_tree.c
|
||||||
intern/boxpack2d.c
|
intern/boxpack2d.c
|
||||||
intern/bpath.c
|
|
||||||
intern/callbacks.c
|
intern/callbacks.c
|
||||||
intern/cpu.c
|
intern/cpu.c
|
||||||
intern/dynlib.c
|
intern/dynlib.c
|
||||||
@@ -101,7 +100,6 @@ set(SRC
|
|||||||
BLI_bitmap.h
|
BLI_bitmap.h
|
||||||
BLI_blenlib.h
|
BLI_blenlib.h
|
||||||
BLI_boxpack2d.h
|
BLI_boxpack2d.h
|
||||||
BLI_bpath.h
|
|
||||||
BLI_callbacks.h
|
BLI_callbacks.h
|
||||||
BLI_cpu.h
|
BLI_cpu.h
|
||||||
BLI_dlrbTree.h
|
BLI_dlrbTree.h
|
||||||
|
|||||||
@@ -139,7 +139,7 @@
|
|||||||
#include "BLI_bitmap.h"
|
#include "BLI_bitmap.h"
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_linklist.h"
|
#include "BLI_linklist.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
@@ -3031,7 +3031,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
|
|||||||
|
|
||||||
/* path backup/restore */
|
/* path backup/restore */
|
||||||
void *path_list_backup = NULL;
|
void *path_list_backup = NULL;
|
||||||
const int path_list_flag = (BLI_BPATH_TRAVERSE_SKIP_LIBRARY | BLI_BPATH_TRAVERSE_SKIP_MULTIFILE);
|
const int path_list_flag = (BKE_BPATH_TRAVERSE_SKIP_LIBRARY | BKE_BPATH_TRAVERSE_SKIP_MULTIFILE);
|
||||||
|
|
||||||
/* open temporary file, so we preserve the original in case we crash */
|
/* open temporary file, so we preserve the original in case we crash */
|
||||||
BLI_snprintf(tempname, sizeof(tempname), "%s@", filepath);
|
BLI_snprintf(tempname, sizeof(tempname), "%s@", filepath);
|
||||||
@@ -3044,7 +3044,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
|
|||||||
|
|
||||||
/* check if we need to backup and restore paths */
|
/* check if we need to backup and restore paths */
|
||||||
if (UNLIKELY((write_flags & G_FILE_RELATIVE_REMAP) && (G_FILE_SAVE_COPY & write_flags))) {
|
if (UNLIKELY((write_flags & G_FILE_RELATIVE_REMAP) && (G_FILE_SAVE_COPY & write_flags))) {
|
||||||
path_list_backup = BLI_bpath_list_backup(mainvar, path_list_flag);
|
path_list_backup = BKE_bpath_list_backup(mainvar, path_list_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remapping of relative paths to new file location */
|
/* remapping of relative paths to new file location */
|
||||||
@@ -3067,7 +3067,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
|
|||||||
* we should not have any relative paths, but if there
|
* we should not have any relative paths, but if there
|
||||||
* is somehow, an invalid or empty G.main->name it will
|
* is somehow, an invalid or empty G.main->name it will
|
||||||
* print an error, don't try make the absolute in this case. */
|
* print an error, don't try make the absolute in this case. */
|
||||||
BLI_bpath_absolute_convert(mainvar, G.main->name, NULL);
|
BKE_bpath_absolute_convert(mainvar, G.main->name, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3075,15 +3075,15 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
|
|||||||
write_user_block= write_flags & G_FILE_USERPREFS;
|
write_user_block= write_flags & G_FILE_USERPREFS;
|
||||||
|
|
||||||
if (write_flags & G_FILE_RELATIVE_REMAP)
|
if (write_flags & G_FILE_RELATIVE_REMAP)
|
||||||
BLI_bpath_relative_convert(mainvar, filepath, NULL); /* note, making relative to something OTHER then G.main->name */
|
BKE_bpath_relative_convert(mainvar, filepath, NULL); /* note, making relative to something OTHER then G.main->name */
|
||||||
|
|
||||||
/* actual file writing */
|
/* actual file writing */
|
||||||
err= write_file_handle(mainvar, file, NULL, NULL, write_user_block, write_flags, thumb);
|
err= write_file_handle(mainvar, file, NULL, NULL, write_user_block, write_flags, thumb);
|
||||||
close(file);
|
close(file);
|
||||||
|
|
||||||
if (UNLIKELY(path_list_backup)) {
|
if (UNLIKELY(path_list_backup)) {
|
||||||
BLI_bpath_list_restore(mainvar, path_list_flag, path_list_backup);
|
BKE_bpath_list_restore(mainvar, path_list_flag, path_list_backup);
|
||||||
BLI_bpath_list_free(path_list_backup);
|
BKE_bpath_list_free(path_list_backup);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
#include "BKE_context.h"
|
#include "BKE_context.h"
|
||||||
@@ -204,7 +204,7 @@ static int make_paths_relative_exec(bContext *C, wmOperator *op)
|
|||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
BLI_bpath_relative_convert(bmain, bmain->name, op->reports);
|
BKE_bpath_relative_convert(bmain, bmain->name, op->reports);
|
||||||
|
|
||||||
/* redraw everything so any changed paths register */
|
/* redraw everything so any changed paths register */
|
||||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
WM_main_add_notifier(NC_WINDOW, NULL);
|
||||||
@@ -237,7 +237,7 @@ static int make_paths_absolute_exec(bContext *C, wmOperator *op)
|
|||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
BLI_bpath_absolute_convert(bmain, bmain->name, op->reports);
|
BKE_bpath_absolute_convert(bmain, bmain->name, op->reports);
|
||||||
|
|
||||||
/* redraw everything so any changed paths register */
|
/* redraw everything so any changed paths register */
|
||||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
WM_main_add_notifier(NC_WINDOW, NULL);
|
||||||
@@ -266,7 +266,7 @@ static int report_missing_files_exec(bContext *C, wmOperator *op)
|
|||||||
Main *bmain = CTX_data_main(C);
|
Main *bmain = CTX_data_main(C);
|
||||||
|
|
||||||
/* run the missing file check */
|
/* run the missing file check */
|
||||||
BLI_bpath_missing_files_check(bmain, op->reports);
|
BKE_bpath_missing_files_check(bmain, op->reports);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
@@ -291,7 +291,7 @@ static int find_missing_files_exec(bContext *C, wmOperator *op)
|
|||||||
{
|
{
|
||||||
Main *bmain = CTX_data_main(C);
|
Main *bmain = CTX_data_main(C);
|
||||||
const char *searchpath = RNA_string_get_alloc(op->ptr, "filepath", NULL, 0);
|
const char *searchpath = RNA_string_get_alloc(op->ptr, "filepath", NULL, 0);
|
||||||
BLI_bpath_missing_files_find(bmain, searchpath, op->reports);
|
BKE_bpath_missing_files_find(bmain, searchpath, op->reports);
|
||||||
MEM_freeN((void *)searchpath);
|
MEM_freeN((void *)searchpath);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
#include "BLI_path_util.h"
|
#include "BLI_path_util.h"
|
||||||
#include "BLI_string.h"
|
#include "BLI_string.h"
|
||||||
#include "BLI_bpath.h"
|
#include "BKE_bpath.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
#include "BKE_main.h"
|
#include "BKE_main.h"
|
||||||
@@ -127,13 +127,13 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (absolute) flag |= BLI_BPATH_TRAVERSE_ABS;
|
if (absolute) flag |= BKE_BPATH_TRAVERSE_ABS;
|
||||||
if (!packed) flag |= BLI_BPATH_TRAVERSE_SKIP_PACKED;
|
if (!packed) flag |= BKE_BPATH_TRAVERSE_SKIP_PACKED;
|
||||||
if (local) flag |= BLI_BPATH_TRAVERSE_SKIP_LIBRARY;
|
if (local) flag |= BKE_BPATH_TRAVERSE_SKIP_LIBRARY;
|
||||||
|
|
||||||
list = PyList_New(0);
|
list = PyList_New(0);
|
||||||
|
|
||||||
BLI_bpath_traverse_main(G.main, bpy_blend_paths_visit_cb, flag, (void *)list);
|
BKE_bpath_traverse_main(G.main, bpy_blend_paths_visit_cb, flag, (void *)list);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user