[Bf-blender-cvs] [03ecd17] gooseberry: New ID datablock 'CacheLibrary', for managing physical cache archives and files.

Lukas Tönne noreply at git.blender.org
Mon Mar 23 13:00:35 CET 2015


Commit: 03ecd1760af610b4e6593252a95824b8d3ddeeea
Author: Lukas Tönne
Date:   Thu Feb 19 11:01:49 2015 +0100
Branches: gooseberry
https://developer.blender.org/rB03ecd1760af610b4e6593252a95824b8d3ddeeea

New ID datablock 'CacheLibrary', for managing physical cache archives
and files.

At it's core this is just a file path, but many different cache users
may refer to this, so having a dedicated ID block helps. It can be
compared to Image datablocks, which also primarily are used for data
on storage, but can be packed with the blend file, and carry some
additional information that would be cumbersome to keep sync'ed
otherwise.

The name 'CacheLibrary' deliberately resembles the 'Library' datablock:
just as a Library stores ID blocks in a physical file, a CacheLibrary
stores cached data (in Alembic HDF5/Ogawa or other formats).

Conflicts:
	source/blender/blenkernel/BKE_pointcache.h
	source/blender/blenkernel/intern/pointcache.c
	source/blender/makesdna/DNA_pointcache_types.h

Conflicts:
	source/blender/makesrna/intern/rna_main_api.c

===================================================================

M	source/blender/CMakeLists.txt
M	source/blender/blenfont/BLF_translation.h
A	source/blender/blenkernel/BKE_cache_library.h
M	source/blender/blenkernel/BKE_library.h
M	source/blender/blenkernel/BKE_main.h
M	source/blender/blenkernel/CMakeLists.txt
A	source/blender/blenkernel/intern/cache_library.c
M	source/blender/blenkernel/intern/idcode.c
M	source/blender/blenkernel/intern/library.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/makesdna/DNA_ID.h
A	source/blender/makesdna/DNA_cache_library_types.h
M	source/blender/makesdna/intern/makesdna.c
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/RNA_enum_types.h
M	source/blender/makesrna/intern/CMakeLists.txt
M	source/blender/makesrna/intern/makesrna.c
M	source/blender/makesrna/intern/rna_ID.c
A	source/blender/makesrna/intern/rna_cache_library.c
M	source/blender/makesrna/intern/rna_internal.h
M	source/blender/makesrna/intern/rna_main.c
M	source/blender/makesrna/intern/rna_main_api.c
M	source/blender/windowmanager/intern/wm_operators.c

===================================================================

diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index ed62b0b..e6483ef 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -31,6 +31,7 @@ set(SRC_DNA_INC
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_armature_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_boid_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_brush_types.h
+	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_cache_library_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_camera_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_cloth_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_color_types.h
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index b42e6f8..0ce60c9 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -146,6 +146,7 @@ const char *BLF_translate_do_new_dataname(const char *msgctxt, const char *msgid
 #define BLF_I18NCONTEXT_ID_ACTION               "Action"
 #define BLF_I18NCONTEXT_ID_ARMATURE             "Armature"
 #define BLF_I18NCONTEXT_ID_BRUSH                "Brush"
+#define BLF_I18NCONTEXT_ID_CACHELIBRARY         "CacheLibrary"
 #define BLF_I18NCONTEXT_ID_CAMERA               "Camera"
 #define BLF_I18NCONTEXT_ID_CURVE                "Curve"
 #define BLF_I18NCONTEXT_ID_FREESTYLELINESTYLE   "FreestyleLineStyle"
diff --git a/source/blender/blenkernel/BKE_cache_library.h b/source/blender/blenkernel/BKE_cache_library.h
new file mode 100644
index 0000000..b88e047
--- /dev/null
+++ b/source/blender/blenkernel/BKE_cache_library.h
@@ -0,0 +1,41 @@
+/*
+ * ***** 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) 2015 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Lukas Toenne
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BKE_CACHE_LIBRARY_H__
+#define __BKE_CACHE_LIBRARY_H__
+
+/** \file BKE_cache_library.h
+ *  \ingroup bke
+ */
+
+struct CacheLibrary;
+struct Main;
+
+struct CacheLibrary *BKE_cache_library_add(struct Main *bmain, const char *name);
+void BKE_cache_library_free(struct CacheLibrary *cache);
+
+#endif
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index e88a4e8..d137718 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -71,7 +71,7 @@ void id_clear_lib_data(struct Main *bmain, struct ID *id);
 
 struct ListBase *which_libbase(struct Main *mainlib, short type);
 
-#define MAX_LIBARRAY    35
+#define MAX_LIBARRAY    36
 int set_listbasepointers(struct Main *main, struct ListBase *lb[MAX_LIBARRAY]);
 
 void BKE_libblock_free(struct Main *bmain, void *idv);
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index ec654ea..a0c67e0 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -94,6 +94,7 @@ typedef struct Main {
 	ListBase movieclip;
 	ListBase mask;
 	ListBase linestyle;
+	ListBase cache_library;
 
 	char id_tag_update[256];
 
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 04cda82..b866046 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -76,6 +76,7 @@ set(SRC
 	intern/brush.c
 	intern/bullet.c
 	intern/bvhutils.c
+	intern/cache_library.c
 	intern/camera.c
 	intern/cdderivedmesh.c
 	intern/cloth.c
@@ -196,6 +197,7 @@ set(SRC
 	BKE_brush.h
 	BKE_bullet.h
 	BKE_bvhutils.h
+	BKE_cache_library.h
 	BKE_camera.h
 	BKE_ccg.h
 	BKE_cdderivedmesh.h
diff --git a/source/blender/blenkernel/intern/cache_library.c b/source/blender/blenkernel/intern/cache_library.c
new file mode 100644
index 0000000..c3961d0
--- /dev/null
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -0,0 +1,54 @@
+/*
+ * ***** 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) 2015 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * Contributor(s): Lukas Toenne
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenkernel/intern/cache_library.c
+ *  \ingroup bke
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
+
+#include "DNA_cache_library_types.h"
+
+#include "BKE_cache_library.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+
+void BKE_cache_library_free(CacheLibrary *UNUSED(cache))
+{
+}
+
+CacheLibrary *BKE_cache_library_add(Main *bmain, const char *name)
+{
+	CacheLibrary *cachelib;
+
+	cachelib = BKE_libblock_alloc(bmain, ID_CL, name);
+
+	BLI_strncpy(cachelib->filepath, "//cache/", sizeof(cachelib->filepath));
+
+	return cachelib;
+}
diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c
index 1b7a03e..fbd2359 100644
--- a/source/blender/blenkernel/intern/idcode.c
+++ b/source/blender/blenkernel/intern/idcode.c
@@ -53,6 +53,7 @@ static IDType idtypes[] = {
 	{ ID_AC,     "Action",           "actions",         IDTYPE_FLAGS_ISLINKABLE },
 	{ ID_AR,     "Armature",         "armatures",       IDTYPE_FLAGS_ISLINKABLE },
 	{ ID_BR,     "Brush",            "brushes",         IDTYPE_FLAGS_ISLINKABLE },
+	{ ID_CL,     "CacheLibrary",     "cache_libraries", 0                       },
 	{ ID_CA,     "Camera",           "cameras",         IDTYPE_FLAGS_ISLINKABLE },
 	{ ID_CU,     "Curve",            "curves",          IDTYPE_FLAGS_ISLINKABLE },
 	{ ID_GD,     "GPencil",          "grease_pencil",   IDTYPE_FLAGS_ISLINKABLE }, /* rename gpencil */
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 9cda4d9..d164178 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -45,6 +45,7 @@
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_brush_types.h"
+#include "DNA_cache_library_types.h"
 #include "DNA_camera_types.h"
 #include "DNA_group_types.h"
 #include "DNA_gpencil_types.h"
@@ -79,6 +80,7 @@
 #include "BKE_armature.h"
 #include "BKE_bpath.h"
 #include "BKE_brush.h"
+#include "BKE_cache_library.h"
 #include "BKE_camera.h"
 #include "BKE_context.h"
 #include "BKE_curve.h"
@@ -107,6 +109,7 @@
 #include "BKE_paint.h"
 #include "BKE_particle.h"
 #include "BKE_packedFile.h"
+#include "BKE_pointcache.h"
 #include "BKE_speaker.h"
 #include "BKE_sound.h"
 #include "BKE_screen.h"
@@ -521,6 +524,8 @@ ListBase *which_libbase(Main *mainlib, short type)
 			return &(mainlib->palettes);
 		case ID_PC:
 			return &(mainlib->paintcurves);
+		case ID_CL:
+			return &(mainlib->cache_library);
 	}
 	return NULL;
 }
@@ -616,6 +621,7 @@ int set_listbasepointers(Main *main, ListBase **lb)
 	lb[a++] = &(main->linestyle); /* referenced by scenes */
 	lb[a++] = &(main->scene);
 	lb[a++] = &(main->library);
+	lb[a++] = &(main->cache_library);
 	lb[a++] = &(main->wm);
 	lb[a++] = &(main->mask);
 	
@@ -747,6 +753,9 @@ static ID *alloc_libblock_notest(short type)
 		case ID_PC:
 			id = MEM_callocN(sizeof(PaintCurve), "Paint Curve");
 			break;
+		case ID_CL:
+			id = MEM_callocN(sizeof(CacheLibrary), "Cache Library");
+			break;
 	}
 	return id;
 }
@@ -1029,6 +1038,9 @@ void BKE_libblock_free_ex(Main *bmain, void *idv, bool do_id_user)
 		case ID_PC:
 			BKE_paint_curve_free((PaintCurve *)id);
 			break;
+		case ID_CL:
+			BKE_cache_library_free((CacheLibrary *)id);
+			break;
 	}
 
 	/* avoid notifying on removed data */
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index e794d67..abc04f7 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -58,6 +58,7 @@
 #include "DNA_armature_types.h"
 #include "DNA_actuator_types.h"
 #include "DNA_brush_types.h"
+#include "DNA_cache_library_types.h"
 #include "DNA_camera_types.h"
 #include "DNA_cloth_types.h"
 #include "DNA_controller_types.h"
@@ -1970,7 +1971,6 @@ static void direct_link_paint_curve(FileData *fd, PaintCurve *pc)
 	pc->points = newdataadr(fd, pc->points);
 }
 
-
 static void direct_link_script(FileData *UNUSED(fd), Script *script)
 {
 	script->id.us = 1;
@@ -1978,6 +1978,21 @@ static void direct_link_script(FileData *UNUSED(fd), Script *script)
 }
 
 
+/* ************ READ CacheLibrary *************** */
+
+static void lib_link_cache_library(FileData *UNUSED(fd), Main *main)
+{
+	CacheLibrary *cachelib;
+	for (cachelib = main->cache_library.first; cachelib; cachelib = cachelib->id.next) {
+		cachelib->id.us = 1;
+	}
+}
+
+static void direct_link_cache_library(FileData *UNUSED(fd), CacheLibrary *UNUSED(cachelib))
+{
+}
+
+
 /* ************ READ PACKEDFILE *************** */
 
 static PackedFile *direct_l

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list