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-08-24 11:54:18 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-08-24 11:59:54 +0300
commitc75e74b456facef2491bc283a87c195cfd91a076 (patch)
treeb7778733907bb943a00c57f2a1c79fe224b034d7
parent6e3569d9f49c4724adfee45de08c0ec38e46425a (diff)
Depsgraph: Fix wrong detection of invisible objects
Was happenign for following cases: - Deep hierarchy of non-restircted collections, which has grand-grand parent restricted. - Collections which are constructed from invisible object.
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc21
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.h5
2 files changed, 21 insertions, 5 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 45c8bb5c93d..979f2197df0 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -143,6 +143,7 @@ DepsgraphNodeBuilder::DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph)
view_layer_(NULL),
view_layer_index_(-1),
collection_(NULL),
+ is_parent_collection_visible_(true),
cow_id_hash_(NULL)
{
}
@@ -459,18 +460,19 @@ void DepsgraphNodeBuilder::build_collection(Collection *collection)
*/
return;
}
+ /* Backup state. */
Collection *current_state_collection = collection_;
+ const bool is_current_parent_collection_visible =
+ is_parent_collection_visible_;
+ /* Modify state as we've entered new collection/ */
collection_ = collection;
const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT)
? COLLECTION_RESTRICT_VIEW
: COLLECTION_RESTRICT_RENDER;
- const bool is_parent_collection_restricted =
- (current_state_collection == NULL)
- ? false
- : (current_state_collection->flag & restrict_flag);
const bool is_collection_restricted = (collection->flag & restrict_flag);
const bool is_collection_visible =
- !is_collection_restricted && !is_parent_collection_restricted;
+ !is_collection_restricted && is_parent_collection_visible_;
+ is_parent_collection_visible_ = is_collection_visible;
/* Collection itself. */
IDDepsNode *id_node = add_id_node(&collection->id);
id_node->is_visible = is_collection_visible;
@@ -483,7 +485,9 @@ void DepsgraphNodeBuilder::build_collection(Collection *collection)
LISTBASE_FOREACH (CollectionChild *, child, &collection->children) {
build_collection(child->collection);
}
+ /* Restore state. */
collection_ = current_state_collection;
+ is_parent_collection_visible_ = is_current_parent_collection_visible;
}
void DepsgraphNodeBuilder::build_object(int base_index,
@@ -491,6 +495,9 @@ void DepsgraphNodeBuilder::build_object(int base_index,
eDepsNode_LinkedState_Type linked_state,
bool is_visible)
{
+ if (string(object->id.name) == "OBGEO-icicles_large_03") {
+ printf(">> %d\n", is_visible);
+ }
const bool has_object = built_map_.checkIsBuiltAndTag(object);
/* Skip rest of components if the ID node was already there. */
if (has_object) {
@@ -569,7 +576,11 @@ void DepsgraphNodeBuilder::build_object(int base_index,
}
/* Object dupligroup. */
if (object->dup_group != NULL) {
+ const bool is_current_parent_collection_visible =
+ is_parent_collection_visible_;
+ is_parent_collection_visible_ = is_visible;
build_collection(object->dup_group);
+ is_parent_collection_visible_ = is_current_parent_collection_visible;
}
}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
index aacb0670a41..e4b253f6d76 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
@@ -249,6 +249,11 @@ protected:
* setting the current state.
*/
Collection *collection_;
+ /* Accumulated flag over the hierarchy opf currently building collections.
+ * Denotes whether all the hierarchy from parent of collection_ to the
+ * very root is visible (aka not restricted.).
+ */
+ bool is_parent_collection_visible_;
GHash *cow_id_hash_;
BuilderMap built_map_;