[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53030] trunk/blender/source/blender: move bpath module from BLI to BKE, it was making many bad level calls into BKE.
Campbell Barton
ideasman42 at gmail.com
Sat Dec 15 16:31:52 CET 2012
Revision: 53030
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53030
Author: campbellbarton
Date: 2012-12-15 15:31:50 +0000 (Sat, 15 Dec 2012)
Log Message:
-----------
move bpath module from BLI to BKE, it was making many bad level calls into BKE.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/CMakeLists.txt
trunk/blender/source/blender/blenkernel/intern/action.c
trunk/blender/source/blender/blenkernel/intern/armature.c
trunk/blender/source/blender/blenkernel/intern/blender.c
trunk/blender/source/blender/blenkernel/intern/brush.c
trunk/blender/source/blender/blenkernel/intern/curve.c
trunk/blender/source/blender/blenkernel/intern/image.c
trunk/blender/source/blender/blenkernel/intern/lattice.c
trunk/blender/source/blender/blenkernel/intern/library.c
trunk/blender/source/blender/blenkernel/intern/material.c
trunk/blender/source/blender/blenkernel/intern/mball.c
trunk/blender/source/blender/blenkernel/intern/mesh.c
trunk/blender/source/blender/blenkernel/intern/object.c
trunk/blender/source/blender/blenkernel/intern/particle.c
trunk/blender/source/blender/blenkernel/intern/speaker.c
trunk/blender/source/blender/blenkernel/intern/texture.c
trunk/blender/source/blender/blenkernel/intern/world.c
trunk/blender/source/blender/blenlib/CMakeLists.txt
trunk/blender/source/blender/blenloader/intern/writefile.c
trunk/blender/source/blender/editors/space_info/info_ops.c
trunk/blender/source/blender/python/intern/bpy.c
Added Paths:
-----------
trunk/blender/source/blender/blenkernel/BKE_bpath.h
trunk/blender/source/blender/blenkernel/intern/bpath.c
Removed Paths:
-------------
trunk/blender/source/blender/blenlib/BLI_bpath.h
trunk/blender/source/blender/blenlib/intern/bpath.c
Copied: trunk/blender/source/blender/blenkernel/BKE_bpath.h (from rev 53029, trunk/blender/source/blender/blenlib/BLI_bpath.h)
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_bpath.h (rev 0)
+++ trunk/blender/source/blender/blenkernel/BKE_bpath.h 2012-12-15 15:31:50 UTC (rev 53030)
@@ -0,0 +1,72 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file BKE_bpath.h
+ * \ingroup bli
+ * \attention Based on ghash, difference is ghash is not a fixed size,
+ * so for BPath we don't need to malloc
+ */
+
+#ifndef __BKE_BPATH_H__
+#define __BKE_BPATH_H__
+
+struct ID;
+struct ListBase;
+struct Main;
+struct ReportList;
+
+/* Function that does something with an ID's file path. Should return 1 if the
+ * 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);
+/* Executes 'visit' for each path associated with 'id'. */
+void BKE_bpath_traverse_id(struct Main *bmain, struct ID *id, 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 BKE_bpath_traverse_main(struct Main *bmain, BPathVisitor visit_cb, const int flag, void *userdata);
+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 */
+void *BKE_bpath_list_backup(struct Main *bmain, const int flag);
+void BKE_bpath_list_restore(struct Main *bmain, const int flag, void *ls_handle);
+void BKE_bpath_list_free(void *ls_handle);
+
+#define BKE_BPATH_TRAVERSE_ABS (1 << 0) /* convert paths to absolute */
+#define BKE_BPATH_TRAVERSE_SKIP_LIBRARY (1 << 2) /* skip library paths */
+#define BKE_BPATH_TRAVERSE_SKIP_PACKED (1 << 3) /* skip packed data */
+#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
+ * file, this is needed for directory manipulation functions which might
+ * otherwise modify the same directory multiple times */
+
+/* high level funcs */
+
+/* creates a text file with missing files if there are any */
+void BKE_bpath_missing_files_check(struct Main *bmain, struct ReportList *reports);
+void BKE_bpath_missing_files_find(struct Main *bmain, const char *searchpath, struct ReportList *reports);
+void BKE_bpath_relative_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 /* __BKE_BPATH_H__ */
Modified: trunk/blender/source/blender/blenkernel/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/blenkernel/CMakeLists.txt 2012-12-15 11:15:05 UTC (rev 53029)
+++ trunk/blender/source/blender/blenkernel/CMakeLists.txt 2012-12-15 15:31:50 UTC (rev 53030)
@@ -65,6 +65,7 @@
intern/bmfont.c
intern/boids.c
intern/booleanops_mesh.c
+ intern/bpath.c
intern/brush.c
intern/bullet.c
intern/bvhutils.c
@@ -101,9 +102,9 @@
intern/lamp.c
intern/lattice.c
intern/library.c
+ intern/mask.c
intern/mask_evaluate.c
intern/mask_rasterize.c
- intern/mask.c
intern/material.c
intern/mball.c
intern/mesh.c
@@ -147,6 +148,7 @@
intern/world.c
intern/writeavi.c
intern/writeframeserver.c
+
BKE_DerivedMesh.h
BKE_action.h
@@ -234,6 +236,8 @@
BKE_world.h
BKE_writeavi.h
BKE_writeframeserver.h
+ BKE_bpath.h
+
depsgraph_private.h
nla_private.h
intern/CCGSubSurf.h
Modified: trunk/blender/source/blender/blenkernel/intern/action.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/action.c 2012-12-15 11:15:05 UTC (rev 53029)
+++ trunk/blender/source/blender/blenkernel/intern/action.c 2012-12-15 15:31:50 UTC (rev 53030)
@@ -43,7 +43,7 @@
#include "DNA_object_types.h"
#include "BLI_blenlib.h"
-#include "BLI_bpath.h"
+#include "BKE_bpath.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
Modified: trunk/blender/source/blender/blenkernel/intern/armature.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/armature.c 2012-12-15 11:15:05 UTC (rev 53029)
+++ trunk/blender/source/blender/blenkernel/intern/armature.c 2012-12-15 15:31:50 UTC (rev 53030)
@@ -37,7 +37,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_bpath.h"
+#include "BKE_bpath.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
Modified: trunk/blender/source/blender/blenkernel/intern/blender.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/blender.c 2012-12-15 11:15:05 UTC (rev 53029)
+++ trunk/blender/source/blender/blenkernel/intern/blender.c 2012-12-15 15:31:50 UTC (rev 53030)
@@ -56,7 +56,7 @@
#include "DNA_sound_types.h"
#include "BLI_blenlib.h"
-#include "BLI_bpath.h"
+#include "BKE_bpath.h"
#include "BLI_dynstr.h"
#include "BLI_utildefines.h"
#include "BLI_callbacks.h"
@@ -182,7 +182,7 @@
{
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) {
BLI_clean(scene->r.pic);
Copied: trunk/blender/source/blender/blenkernel/intern/bpath.c (from rev 53029, trunk/blender/source/blender/blenlib/intern/bpath.c)
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/bpath.c (rev 0)
+++ trunk/blender/source/blender/blenkernel/intern/bpath.c 2012-12-15 15:31:50 UTC (rev 53030)
@@ -0,0 +1,725 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Campbell barton, Alex Fraser
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenlib/intern/bpath.c
+ * \ingroup bli
+ */
+
+/* TODO,
+ * currently there are some cases we don't support.
+ * - passing output paths to the visitor?, like render out.
+ * - passing sequence strips with many images.
+ * - passing directory paths - visitors don't know which path is a dir or a file.
+ * */
+
+#include <sys/stat.h>
+
+#include <string.h>
+#include <assert.h>
+
+/* path/file handling stuff */
+#ifndef WIN32
+# include <dirent.h>
+# include <unistd.h>
+#else
+# include <io.h>
+# include "BLI_winstuff.h"
+#endif
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_brush_types.h"
+#include "DNA_image_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_movieclip_types.h"
+#include "DNA_object_fluidsim.h"
+#include "DNA_object_force.h"
+#include "DNA_object_types.h"
+#include "DNA_particle_types.h"
+#include "DNA_sequence_types.h"
+#include "DNA_sound_types.h"
+#include "DNA_text_types.h"
+#include "DNA_material_types.h"
+#include "DNA_node_types.h"
+#include "DNA_texture_types.h"
+#include "DNA_vfont_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_smoke_types.h"
+
+#include "BLI_blenlib.h"
+#include "BKE_bpath.h"
+#include "BLI_utildefines.h"
+
+#include "BKE_font.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+#include "BKE_node.h"
+#include "BKE_report.h"
+#include "BKE_sequencer.h"
+#include "BKE_image.h" /* so we can check the image's type */
+
+static int checkMissingFiles_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src)
+{
+ ReportList *reports = (ReportList *)userdata;
+
+ if (!BLI_exists(path_src)) {
+ BKE_reportf(reports, RPT_WARNING, "Path '%s' not found", path_src);
+ }
+
+ return FALSE;
+}
+
+/* high level function */
+void BKE_bpath_missing_files_check(Main *bmain, ReportList *reports)
+{
+ BKE_bpath_traverse_main(bmain, checkMissingFiles_visit_cb, BKE_BPATH_TRAVERSE_ABS, reports);
+}
+
+typedef struct BPathRemap_Data {
+ const char *basedir;
+ ReportList *reports;
+
+ int count_tot;
+ int count_changed;
+ int count_failed;
+} BPathRemap_Data;
+
+static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char *path_src)
+{
+ BPathRemap_Data *data = (BPathRemap_Data *)userdata;
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list