[Bf-blender-cvs] [59ed1d0] alembic_pointcache: Added a cache library pointer to objects as a replacement for CL->GR pointers.
Lukas Tönne
noreply at git.blender.org
Wed Mar 18 12:52:35 CET 2015
Commit: 59ed1d0a6790e78f7f1837c09ffb12e57ef62a86
Author: Lukas Tönne
Date: Wed Mar 18 10:24:17 2015 +0100
Branches: alembic_pointcache
https://developer.blender.org/rB59ed1d0a6790e78f7f1837c09ffb12e57ef62a86
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 165ae5a..163c67a 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -294,7 +294,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 aa9bcd4..813009c 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1541,6 +1541,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]);
@@ -1605,6 +1606,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 caf35d5..3693a39 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4440,6 +4440,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) {
@@ -8754,6 +8755,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 ed03bf8..90ef299 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -263,7 +263,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 c5d901e..2996f70 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -2646,6 +2646,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