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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-12-18 20:18:00 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-12-21 18:05:48 +0300
commit0edd93effbc1c0adf7aa9c5647ef69845496f669 (patch)
tree66cf32ac697824226fa8de790b0d70ada5ce42b5 /source/blender/blenkernel/intern/object.c
parentadec52a8a843a5224e1e59a1dfdcff4986d7dc18 (diff)
Fix inconsistent/broken Cycles object visibility for instances.
Object visibility is now handled by the depsgraph iterator, but this API was incomplete as it made no distinction for visibility of the object itself, particles and generated instances. The depsgraph iterator API now includes information about which part of the object is visible, and this is used by Cycles to replace the old custom logic. Cycles and EEVEE visibility should now be consistent, which unfortunately does means some subtle compatibility breakage for both. Fixes T58956, T58202, T59284. Differential Revision: https://developer.blender.org/D4109
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r--source/blender/blenkernel/intern/object.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 3d341f5d82f..fd047c50d2c 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -714,33 +714,40 @@ bool BKE_object_is_mode_compat(const struct Object *ob, eObjectMode object_mode)
}
/**
- * Return if the object is visible, as evaluated by depsgraph
+ * Return which parts of the object are visible, as evaluated by depsgraph
*/
-bool BKE_object_is_visible(const Object *ob, const eObjectVisibilityCheck mode)
+int BKE_object_visibility(const Object *ob, const int dag_eval_mode)
{
if ((ob->base_flag & BASE_VISIBLE) == 0) {
- return false;
+ return 0;
}
- if (mode == OB_VISIBILITY_CHECK_UNKNOWN_RENDER_MODE) {
- return true;
+ /* Test which components the object has. */
+ int visibility = OB_VISIBLE_SELF;
+ if (ob->particlesystem.first) {
+ visibility |= OB_VISIBLE_INSTANCES | OB_VISIBLE_PARTICLES;
}
-
- if (((ob->transflag & OB_DUPLI) == 0) &&
- (ob->particlesystem.first == NULL))
- {
- return true;
+ else if (ob->transflag & OB_DUPLI) {
+ visibility |= OB_VISIBLE_INSTANCES;
}
- switch (mode) {
- case OB_VISIBILITY_CHECK_FOR_VIEWPORT:
- return ((ob->duplicator_visibility_flag & OB_DUPLI_FLAG_VIEWPORT) != 0);
- case OB_VISIBILITY_CHECK_FOR_RENDER:
- return ((ob->duplicator_visibility_flag & OB_DUPLI_FLAG_RENDER) != 0);
- default:
- BLI_assert(!"Object visible test mode not supported.");
- return false;
+ /* Optional hiding of self if there are particles or instancers. */
+ if (visibility & (OB_VISIBLE_PARTICLES | OB_VISIBLE_INSTANCES)) {
+ switch ((eEvaluationMode)dag_eval_mode) {
+ case DAG_EVAL_VIEWPORT:
+ if (!(ob->duplicator_visibility_flag & OB_DUPLI_FLAG_VIEWPORT)) {
+ visibility &= ~OB_VISIBLE_SELF;
+ }
+ break;
+ case DAG_EVAL_RENDER:
+ if (!(ob->duplicator_visibility_flag & OB_DUPLI_FLAG_RENDER)) {
+ visibility &= ~OB_VISIBLE_SELF;
+ }
+ break;
+ }
}
+
+ return visibility;
}
bool BKE_object_exists_check(Main *bmain, const Object *obtest)