Blender V2.61 - r43446

BLI_bpath.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): Campbell Barton
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00034 #ifndef BLI_BPATH_H
00035 #define BLI_BPATH_H
00036 
00037 struct ID;
00038 struct ListBase;
00039 struct Main;
00040 struct ReportList;
00041 
00042 /* Function that does something with an ID's file path. Should return 1 if the
00043    path has changed, and in that case, should write the result to pathOut. */
00044 typedef int (*BPathVisitor)(void *userdata, char *path_dst, const char *path_src);
00045 /* Executes 'visit' for each path associated with 'id'. */
00046 void bpath_traverse_id(struct Main *bmain, struct ID *id, BPathVisitor visit_cb, const int flag, void *userdata);
00047 void bpath_traverse_id_list(struct Main *bmain, struct ListBase *lb, BPathVisitor visit_cb, const int flag, void *userdata);
00048 void bpath_traverse_main(struct Main *bmain, BPathVisitor visit_cb, const int flag, void *userdata);
00049 int bpath_relocate_visitor(void *oldbasepath, char *path_dst, const char *path_src);
00050 
00051 #define BPATH_TRAVERSE_ABS             (1<<0) /* convert paths to absolute */
00052 #define BPATH_TRAVERSE_SKIP_LIBRARY    (1<<2) /* skip library paths */
00053 #define BPATH_TRAVERSE_SKIP_PACKED     (1<<3) /* skip packed data */
00054 #define BPATH_TRAVERSE_SKIP_MULTIFILE  (1<<4) /* skip paths where a single dir is used with an array of files, eg.
00055                                                * sequence strip images and pointcache. in this case only use the first
00056                                                * file, this is needed for directory manipulation functions which might
00057                                                * otherwise modify the same directory multiple times */
00058 
00059 /* high level funcs */
00060 
00061 /* creates a text file with missing files if there are any */
00062 void checkMissingFiles(struct Main *bmain, struct ReportList *reports);
00063 void makeFilesRelative(struct Main *bmain, const char *basedir, struct ReportList *reports);
00064 void makeFilesAbsolute(struct Main *bmain, const char *basedir, struct ReportList *reports);
00065 void findMissingFiles(struct Main *bmain, const char *searchpath, struct ReportList *reports);
00066 
00067 #endif // BLI_BPATH_H