[Bf-blender-cvs] [9123595b52b] master: Fix T64705: can't drive object visibility in collection instances
Brecht Van Lommel
noreply at git.blender.org
Thu Jun 20 19:02:01 CEST 2019
Commit: 9123595b52b3354082c0eb77134599784df34899
Author: Brecht Van Lommel
Date: Thu Jun 20 18:30:35 2019 +0200
Branches: master
https://developer.blender.org/rB9123595b52b3354082c0eb77134599784df34899
Fix T64705: can't drive object visibility in collection instances
Not the cleanest solution, but should be fine until we add support for driving
collection visibility and revise this system as a whole.
===================================================================
M source/blender/blenkernel/BKE_collection.h
M source/blender/blenkernel/intern/collection.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h
index 502c949be9a..c1e36f5dd83 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -176,11 +176,13 @@ typedef void (*BKE_scene_collections_Cb)(struct Collection *ob, void *data);
#define FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(_collection, _object, _mode) \
{ \
int _base_flag = (_mode == DAG_EVAL_VIEWPORT) ? BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER; \
+ int _object_restrict_flag = (_mode == DAG_EVAL_VIEWPORT) ? OB_RESTRICT_VIEWPORT : \
+ OB_RESTRICT_RENDER; \
int _base_id = 0; \
for (Base *_base = (Base *)BKE_collection_object_cache_get(_collection).first; _base; \
_base = _base->next, _base_id++) { \
- if (_base->flag & _base_flag) { \
- Object *_object = _base->object;
+ Object *_object = _base->object; \
+ if ((_base->flag & _base_flag) && (_object->restrictflag & _object_restrict_flag) == 0) {
#define FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END \
} \
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 5b718909601..ac55846714b 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -443,15 +443,13 @@ static void collection_object_cache_fill(ListBase *lb, Collection *collection, i
BLI_addtail(lb, base);
}
- int object_restrict = base->object->restrictflag;
-
- if (((child_restrict & COLLECTION_RESTRICT_VIEWPORT) == 0) &&
- ((object_restrict & OB_RESTRICT_VIEWPORT) == 0)) {
+ /* Only collection flags are checked here currently, object restrict flag is checked
+ * in FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN since it can be animated
+ * without updating the cache. */
+ if (((child_restrict & COLLECTION_RESTRICT_VIEWPORT) == 0)) {
base->flag |= BASE_ENABLED_VIEWPORT;
}
-
- if (((child_restrict & COLLECTION_RESTRICT_RENDER) == 0) &&
- ((object_restrict & OB_RESTRICT_RENDER) == 0)) {
+ if (((child_restrict & COLLECTION_RESTRICT_RENDER) == 0)) {
base->flag |= BASE_ENABLED_RENDER;
}
}
More information about the Bf-blender-cvs
mailing list