[Bf-blender-cvs] [4959b2b] gooseberry: Added a cache library pointer to objects as a replacement for CL->GR pointers.

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


Commit: 4959b2b30a024ee6aaedc6da1138f09243567bd6
Author: Lukas Tönne
Date:   Wed Mar 18 10:24:17 2015 +0100
Branches: gooseberry
https://developer.blender.org/rB4959b2b30a024ee6aaedc6da1138f09243567bd6

Added a cache library pointer to objects as a replacement for CL->GR
pointers.

Relationship between CacheLibrary, duplicator Objects and Groups is
difficult. There are a number of somewhat conflicting goals:
- CacheLibraries write out data for objects and dupli groups. Multiple
  objects can be stored in the same cache: CL *->* GR
- Objects can override a dupli group with different caches: OB *->1 CL
- As before, each object can be the duplicator for one group: OB *->1 GR

To combine these requirements, the first relationship will be made
indirect. Only the Object -> Group/CacheLib relations are explicit
pointers in the DNA. For finding all objects contained in a cache
library the usual recursive DNA tagging system must then be used.

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

M	release/scripts/startup/bl_ui/properties_object.py
M	source/blender/blenkernel/intern/object.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/makesdna/DNA_object_types.h
M	source/blender/makesrna/intern/rna_object.c

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

diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index 567ba56..e655b17 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -296,7 +296,11 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, Panel):
 
         elif ob.dupli_type == 'GROUP':
             layout.prop(ob, "dupli_group", text="Group")
-            layout.prop(ob, "use_dupli_cache")
+            row = layout.row(align=True)
+            row.prop(ob, "cache_library")
+            sub = row.row(align=True)
+            sub.active = ob.cache_library is not None
+            sub.prop(ob, "use_dupli_cache", text="Read", toggle=True)
 
 
 class OBJECT_PT_relations_extras(ObjectButtonsPanel, Panel):
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 2c68255..c45b246 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1547,6 +1547,7 @@ Object *BKE_object_copy_ex(Main *bmain, Object *ob, bool copy_caches)
 	id_us_plus((ID *)obn->data);
 	id_us_plus((ID *)obn->gpd);
 	id_lib_extern((ID *)obn->dup_group);
+	id_lib_extern((ID *)obn->cache_library);
 
 	for (a = 0; a < obn->totcol; a++) id_us_plus((ID *)obn->mat[a]);
 	
@@ -1611,6 +1612,7 @@ static void extern_local_object(Object *ob)
 
 	id_lib_extern((ID *)ob->data);
 	id_lib_extern((ID *)ob->dup_group);
+	id_lib_extern((ID *)ob->cache_library);
 	id_lib_extern((ID *)ob->poselib);
 	id_lib_extern((ID *)ob->gpd);
 
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index df2981c..86784c5 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4446,6 +4446,7 @@ static void lib_link_object(FileData *fd, Main *main)
 			ob->track = newlibadr(fd, ob->id.lib, ob->track);
 			ob->poselib = newlibadr_us(fd, ob->id.lib, ob->poselib);
 			ob->dup_group = newlibadr_us(fd, ob->id.lib, ob->dup_group);
+			ob->cache_library = newlibadr_us(fd, ob->id.lib, ob->cache_library);
 			
 			ob->proxy = newlibadr_us(fd, ob->id.lib, ob->proxy);
 			if (ob->proxy) {
@@ -8763,6 +8764,8 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
 	
 	if (ob->dup_group)
 		expand_doit(fd, mainvar, ob->dup_group);
+	if (ob->cache_library)
+		expand_doit(fd, mainvar, ob->cache_library);
 	
 	if (ob->proxy)
 		expand_doit(fd, mainvar, ob->proxy);
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 96c62e1..ce1f0bb 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -274,7 +274,8 @@ typedef struct Object {
 	struct PartDeflect *pd;		/* particle deflector/attractor/collision data */
 	struct SoftBody *soft;		/* if exists, saved in file */
 	struct Group *dup_group;	/* object duplicator for group */
-	struct DupliCache *dup_cache;	/* cached dupli overrides */
+	struct DupliCache *dup_cache;		/* cached dupli overrides */
+	struct CacheLibrary *cache_library;	/* cache library to use */
 
 	char  body_type;			/* for now used to temporarily holds the type of collision object */
 	char  shapeflag;			/* flag for pinning */
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 5874c9b..562fdf3 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -2885,6 +2885,12 @@ static void rna_def_object(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Dupli Group", "Instance an existing group");
 	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
 
+	prop = RNA_def_property(srna, "cache_library", PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_sdna(prop, NULL, "cache_library");
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Cache Library", "Cache Library to use");
+	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
+
 	prop = RNA_def_property(srna, "dupli_frames_start", PROP_INT, PROP_NONE | PROP_UNIT_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "dupsta");
 	RNA_def_property_range(prop, MINAFRAME, MAXFRAME);




More information about the Bf-blender-cvs mailing list