Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2015-03-17 18:17:04 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-03-26 16:13:38 +0300
commit0d3da1343c16e1be6a6e6b78b77cf8b3354afe07 (patch)
tree3092d8dc268caa3ca6fd32b78c593d8feeda1462 /source
parent26b58bd1510ee0773b6373df9f160b7170e1b98c (diff)
Use a new flag in duplicator objects to enable cache reading and avoid
unnecessary dependencies. This flag will replace the current "read" mode on cache libraries. Beside enabling cache reading, it also disables the current "fake" dependencies between duplicators and their group objects. This is exploiting the layer visibility mechanism in depsgraph to ensure that animated group objects get evaluated when used by a visible duplicator, even when they are not themselves visible. These dependencies cause group object updates even if the duplicator is using cached results. To avoid this unnecessary overhead and make caching worthwhile we rebuild depsgraph without these relations when using the cache instead.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c7
-rw-r--r--source/blender/blenkernel/intern/object_dupli.c6
-rw-r--r--source/blender/makesdna/DNA_object_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_object.c5
4 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index c9b906ee6a0..b35d070ea8c 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -620,7 +620,12 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Main *bmain, Sc
/* inverted relation, so addtoroot shouldn't be set to zero */
}
- if (ob->transflag & OB_DUPLI) {
+ /* XXX Fake dependency: duplicator object becomes a child of group objects.
+ * This exploits the layer visibility mechanism, making the group objects update
+ * when the duplicator is visible (even if group objects are not visible themselves).
+ * It is not a true dependency, the duplicator does not in any way depend on group objects or data!
+ */
+ if (ob->transflag & OB_DUPLI && !(ob->transflag & OB_DUPLI_USE_CACHE)) {
if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) {
GroupObject *go;
for (go = ob->dup_group->gobject.first; go; go = go->next) {
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index 388be0ce429..e29153f6f14 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -1397,9 +1397,11 @@ void BKE_object_dupli_cache_update(Scene *scene, Object *ob, EvaluationContext *
const eCacheLibrary_EvalMode eval_mode = eval_ctx->mode == DAG_EVAL_RENDER ? CACHE_LIBRARY_EVAL_RENDER : CACHE_LIBRARY_EVAL_VIEWPORT;
Main *bmain = G.main;
+ bool is_dupligroup = (ob->transflag & OB_DUPLIGROUP) && ob->dup_group;
+ bool is_cached = (ob->transflag & OB_DUPLI_USE_CACHE) && BKE_cache_test_dupligroup(bmain, eval_mode, ob->dup_group);
+
/* cache is a group duplicator feature only */
- if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group &&
- BKE_cache_test_dupligroup(bmain, eval_mode, ob->dup_group)) {
+ if (is_dupligroup && is_cached) {
if (ob->dup_cache && !(ob->dup_cache->flag & DUPCACHE_FLAG_DIRTY)) {
/* skip if cache is valid */
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 215cb8d04cf..21c8cb10b0a 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -431,6 +431,7 @@ enum {
OB_RENDER_DUPLI = 1 << 12,
OB_NO_CONSTRAINTS = 1 << 13, /* runtime constraints disable */
OB_NO_PSYS_UPDATE = 1 << 14, /* hack to work around particle issue */
+ OB_DUPLI_USE_CACHE = 1 << 15, /* use cache instead of object data */
OB_DUPLI = OB_DUPLIFRAMES | OB_DUPLIVERTS | OB_DUPLIGROUP | OB_DUPLIFACES | OB_DUPLIPARTS,
};
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 73206ea310c..0fc573109b6 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -2647,6 +2647,11 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Dupli Faces Scale", "Scale the DupliFace objects");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
+ prop = RNA_def_property(srna, "use_dupli_cache", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLI_USE_CACHE);
+ RNA_def_property_ui_text(prop, "Use Dupli Cache", "Use caching instead of object data");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
+
prop = RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
RNA_def_property_flag(prop, PROP_EDITABLE);