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
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-06-08 12:42:41 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-06-08 12:57:16 +0300
commit4017b4833152655dbb161896ab1bf47469a61d69 (patch)
tree2e767b2204bacabe2af1d834c57454d11df629ce /source/blender/depsgraph/intern/builder/deg_builder_relations.cc
parent378e42e11933bd069b49a83232c5eccb279bc6c7 (diff)
Depsgraph: Don't optimize out collections used by duplication system
This makes evaluated objects to point to a non-evaluated collection, which is already really bad. What is even more worse, objects in those collections are not evaluated either. Proper solution would be to implement visibility flag for nodes, which will be set to 0 for transform/geometry components, but which will be 1 for copy-on-write components. This way we will guarantee consistency of dependency graph. For now this change is good enough and unlocks production. Fixes T55375: Crash when changing visibility of instanced collection Fixes T55357: Particle geometry crash
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_relations.cc')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 0dffe60e9d9..eb1ee0c1535 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -406,7 +406,7 @@ void DepsgraphRelationBuilder::build_id(ID *id)
build_camera((Camera *)id);
break;
case ID_GR:
- build_collection(NULL, (Collection *)id);
+ build_collection(DEG_COLLECTION_OWNER_UNKNOWN, NULL, (Collection *)id);
break;
case ID_OB:
build_object(NULL, (Object *)id);
@@ -451,14 +451,20 @@ void DepsgraphRelationBuilder::build_id(ID *id)
}
}
-void DepsgraphRelationBuilder::build_collection(Object *object, Collection *collection)
+void DepsgraphRelationBuilder::build_collection(
+ eDepsNode_CollectionOwner owner_type,
+ Object *object,
+ Collection *collection)
{
- const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ?
- COLLECTION_RESTRICT_VIEW : COLLECTION_RESTRICT_RENDER;
- if (collection->flag & restrict_flag) {
- return;
+ const bool allow_restrict_flags = (owner_type == DEG_COLLECTION_OWNER_SCENE);
+ if (allow_restrict_flags) {
+ const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT)
+ ? COLLECTION_RESTRICT_VIEW
+ : COLLECTION_RESTRICT_RENDER;
+ if (collection->flag & restrict_flag) {
+ return;
+ }
}
-
const bool group_done = built_map_.checkIsBuiltAndTag(collection);
OperationKey object_local_transform_key(object != NULL ? &object->id : NULL,
DEG_NODE_TYPE_TRANSFORM,
@@ -468,7 +474,7 @@ void DepsgraphRelationBuilder::build_collection(Object *object, Collection *coll
build_object(NULL, cob->ob);
}
LISTBASE_FOREACH (CollectionChild *, child, &collection->children) {
- build_collection(NULL, child->collection);
+ build_collection(owner_type, NULL, child->collection);
}
}
if (object != NULL) {
@@ -591,7 +597,7 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object)
/* Object dupligroup. */
if (object->dup_group != NULL) {
- build_collection(object, object->dup_group);
+ build_collection(DEG_COLLECTION_OWNER_OBJECT, object, object->dup_group);
}
}
@@ -1602,7 +1608,7 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
break;
case PART_DRAW_GR:
if (part->dup_group != NULL) {
- build_collection(NULL, part->dup_group);
+ build_collection(DEG_COLLECTION_OWNER_OBJECT, NULL, part->dup_group);
LISTBASE_FOREACH (CollectionObject *, go, &part->dup_group->gobject) {
build_particles_visualization_object(object,
psys,