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
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')
-rw-r--r--source/blender/blenkernel/BKE_object.h15
-rw-r--r--source/blender/blenkernel/intern/object.c43
-rw-r--r--source/blender/depsgraph/DEG_depsgraph_query.h2
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query_iter.cc71
-rw-r--r--source/blender/draw/engines/eevee/eevee_engine.c7
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightcache.c6
-rw-r--r--source/blender/draw/engines/eevee/eevee_render.c6
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c2
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_render.c11
-rw-r--r--source/blender/draw/engines/workbench/workbench_deferred.c6
-rw-r--r--source/blender/draw/engines/workbench/workbench_forward.c6
-rw-r--r--source/blender/draw/intern/DRW_render.h2
-rw-r--r--source/blender/draw/intern/draw_manager.c18
-rw-r--r--source/blender/draw/modes/object_mode.c11
-rw-r--r--source/blender/makesdna/DNA_object_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_depsgraph.c33
16 files changed, 154 insertions, 87 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 0b405b52a17..50e095720e0 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -97,13 +97,14 @@ bool BKE_object_is_mode_compat(const struct Object *ob, eObjectMode object_mode)
bool BKE_object_data_is_in_editmode(const struct ID *id);
-typedef enum eObjectVisibilityCheck {
- OB_VISIBILITY_CHECK_FOR_VIEWPORT,
- OB_VISIBILITY_CHECK_FOR_RENDER,
- OB_VISIBILITY_CHECK_UNKNOWN_RENDER_MODE,
-} eObjectVisibilityCheck;
-
-bool BKE_object_is_visible(const struct Object *ob, const eObjectVisibilityCheck mode);
+typedef enum eObjectVisibilityResult {
+ OB_VISIBLE_SELF = 1,
+ OB_VISIBLE_PARTICLES = 2,
+ OB_VISIBLE_INSTANCES = 4,
+ OB_VISIBLE_ALL = (OB_VISIBLE_SELF | OB_VISIBLE_PARTICLES | OB_VISIBLE_INSTANCES),
+} eObjectVisibilityResult;
+
+int BKE_object_visibility(const struct Object *ob, const int dag_eval_mode);
void BKE_object_init(struct Object *ob);
struct Object *BKE_object_add_only_object(
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)
diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h
index c9fa6b0a035..11a4ebee8c6 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -118,7 +118,7 @@ typedef struct DEGObjectIterData {
struct Scene *scene;
- int visibility_check; /* eObjectVisibilityCheck. */
+ eEvaluationMode eval_mode;
/* **** Iteration over dupli-list. *** */
diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
index 52c4ab33dc6..88dc74419e5 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
@@ -107,6 +107,26 @@ void verify_id_properties_freed(DEGObjectIterData *data)
temp_dupli_object->id.properties = NULL;
}
+static bool deg_object_hide_original(eEvaluationMode eval_mode, Object *ob, DupliObject *dob)
+{
+ /* Automatic hiding if this object is being instanced on verts/faces/frames
+ * by its parent. Ideally this should not be needed, but due to the wrong
+ * dependency direction in the data design there is no way to keep the object
+ * visible otherwise. The better solution eventually would be for objects
+ * to specify which object they instance, instead of through parenting. */
+ if (eval_mode == DAG_EVAL_RENDER || dob) {
+ const int hide_original_types = OB_DUPLIFRAMES | OB_DUPLIVERTS | OB_DUPLIFACES;
+
+ if (!dob || !(dob->type & hide_original_types)) {
+ if (ob->parent && (ob->parent->transflag & hide_original_types)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
{
DEGObjectIterData *data = (DEGObjectIterData *)iter->data;
@@ -116,16 +136,15 @@ bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
data->dupli_object_next = data->dupli_object_next->next;
- /* Group duplis need to set ob matrices correct, for deform. so no_draw
- * is part handled.
- */
- if ((obd->transflag & OB_RENDER_DUPLI) == 0 && dob->no_draw) {
+ if (dob->no_draw) {
continue;
}
-
if (obd->type == OB_MBALL) {
continue;
}
+ if (deg_object_hide_original(data->eval_mode, dob->ob, dob)) {
+ continue;
+ }
verify_id_properties_freed(data);
@@ -142,12 +161,11 @@ bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
/* Duplicated elements shouldn't care whether their original collection is visible or not. */
temp_dupli_object->base_flag |= BASE_VISIBLE;
- if (BKE_object_is_visible(temp_dupli_object, OB_VISIBILITY_CHECK_UNKNOWN_RENDER_MODE) == false) {
+ int ob_visibility = BKE_object_visibility(temp_dupli_object, data->eval_mode);
+ if (ob_visibility == 0) {
continue;
}
- temp_dupli_object->transflag &= ~OB_DUPLI;
-
copy_m4_m4(data->temp_dupli_object.obmat, dob->mat);
iter->current = &data->temp_dupli_object;
BLI_assert(
@@ -196,25 +214,29 @@ void deg_iterator_objects_step(BLI_Iterator *iter, DEG::IDDepsNode *id_node)
Object *object = (Object *)id_node->id_cow;
BLI_assert(DEG::deg_validate_copy_on_write_datablock(&object->id));
- if ((BKE_object_is_visible(object, OB_VISIBILITY_CHECK_UNKNOWN_RENDER_MODE) == false) &&
- ((data->flag & DEG_ITER_OBJECT_FLAG_VISIBLE) != 0))
- {
- return;
- }
+ int ob_visibility = OB_VISIBLE_ALL;
+ if (data->flag & DEG_ITER_OBJECT_FLAG_VISIBLE) {
+ ob_visibility = BKE_object_visibility(object, data->eval_mode);
- if ((data->flag & DEG_ITER_OBJECT_FLAG_DUPLI) &&
- (object->transflag & OB_DUPLI))
- {
- data->dupli_parent = object;
- data->dupli_list = object_duplilist(data->graph, data->scene, object);
- data->dupli_object_next = (DupliObject *)data->dupli_list->first;
- if (BKE_object_is_visible(object, (eObjectVisibilityCheck)data->visibility_check) == false) {
+ if (deg_object_hide_original(data->eval_mode, object, NULL)) {
return;
}
}
- iter->current = object;
- iter->skip = false;
+ if (ob_visibility & OB_VISIBLE_INSTANCES) {
+ if ((data->flag & DEG_ITER_OBJECT_FLAG_DUPLI) &&
+ (object->transflag & OB_DUPLI))
+ {
+ data->dupli_parent = object;
+ data->dupli_list = object_duplilist(data->graph, data->scene, object);
+ data->dupli_object_next = (DupliObject *)data->dupli_list->first;
+ }
+ }
+
+ if (ob_visibility & (OB_VISIBLE_SELF | OB_VISIBLE_PARTICLES)) {
+ iter->current = object;
+ iter->skip = false;
+ }
}
} // namespace
@@ -239,10 +261,7 @@ void DEG_iterator_objects_begin(BLI_Iterator *iter, DEGObjectIterData *data)
data->scene = DEG_get_evaluated_scene(depsgraph);
data->id_node_index = 0;
data->num_id_nodes = num_id_nodes;
- eEvaluationMode eval_mode = DEG_get_mode(depsgraph);
- data->visibility_check = (eval_mode == DAG_EVAL_RENDER)
- ? OB_VISIBILITY_CHECK_FOR_RENDER
- : OB_VISIBILITY_CHECK_FOR_VIEWPORT;
+ data->eval_mode = DEG_get_mode(depsgraph);
deg_invalidate_iterator_work_data(data);
DEG::IDDepsNode *id_node = deg_graph->id_nodes[data->id_node_index];
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c
index aa2cf3fede3..6a2ca982d53 100644
--- a/source/blender/draw/engines/eevee/eevee_engine.c
+++ b/source/blender/draw/engines/eevee/eevee_engine.c
@@ -130,15 +130,14 @@ void EEVEE_cache_populate(void *vedata, Object *ob)
EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure();
const DRWContextState *draw_ctx = DRW_context_state_get();
+ const int ob_visibility = DRW_object_visibility_in_active_context(ob);
bool cast_shadow = false;
- if (ob->base_flag & BASE_VISIBLE) {
+ if (ob_visibility & OB_VISIBLE_PARTICLES) {
EEVEE_hair_cache_populate(vedata, sldata, ob, &cast_shadow);
}
- if (DRW_object_is_renderable(ob) &&
- DRW_object_is_visible_in_active_context(ob))
- {
+ if (DRW_object_is_renderable(ob) && (ob_visibility & OB_VISIBLE_SELF)) {
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) {
EEVEE_materials_cache_populate(vedata, sldata, ob, &cast_shadow);
}
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index 71082268f10..74cac25367c 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -411,7 +411,8 @@ static void eevee_lightbake_count_probes(EEVEE_LightBake *lbake)
DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob)
{
- if (!BKE_object_is_visible(ob, OB_VISIBILITY_CHECK_FOR_RENDER)) {
+ const int ob_visibility = BKE_object_visibility(ob, DAG_EVAL_RENDER);
+ if ((ob_visibility & OB_VISIBLE_SELF) == 0) {
continue;
}
@@ -1006,7 +1007,8 @@ static void eevee_lightbake_gather_probes(EEVEE_LightBake *lbake)
* This allows a large number of probe to be precomputed (even dupli ones). */
DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob)
{
- if (!BKE_object_is_visible(ob, OB_VISIBILITY_CHECK_FOR_RENDER)) {
+ const int ob_visibility = BKE_object_visibility(ob, DAG_EVAL_RENDER);
+ if ((ob_visibility & OB_VISIBLE_SELF) == 0) {
continue;
}
diff --git a/source/blender/draw/engines/eevee/eevee_render.c b/source/blender/draw/engines/eevee/eevee_render.c
index 8d196ee07eb..45bfba09890 100644
--- a/source/blender/draw/engines/eevee/eevee_render.c
+++ b/source/blender/draw/engines/eevee/eevee_render.c
@@ -34,6 +34,7 @@
#include "DNA_object_types.h"
#include "BKE_camera.h"
+#include "BKE_object.h"
#include "BLI_rand.h"
#include "BLI_rect.h"
@@ -179,11 +180,12 @@ void EEVEE_render_cache(
RE_engine_update_stats(engine, NULL, info);
}
- if (ob->base_flag & BASE_VISIBLE) {
+ const int ob_visibility = DRW_object_visibility_in_active_context(ob);
+ if (ob_visibility & OB_VISIBLE_PARTICLES) {
EEVEE_hair_cache_populate(vedata, sldata, ob, &cast_shadow);
}
- if (DRW_object_is_visible_in_active_context(ob)) {
+ if (ob_visibility & OB_VISIBLE_SELF) {
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) {
EEVEE_materials_cache_populate(vedata, sldata, ob, &cast_shadow);
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 23c53977445..79724f6a5d2 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -559,7 +559,7 @@ static void gpencil_add_draw_data(void *vedata, Object *ob)
void GPENCIL_cache_populate(void *vedata, Object *ob)
{
/* object must be visible */
- if (!DRW_object_is_visible_in_active_context(ob)) {
+ if (!(DRW_object_visibility_in_active_context(ob) & OB_VISIBLE_SELF)) {
return;
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_render.c b/source/blender/draw/engines/gpencil/gpencil_render.c
index 51a8209fbf2..1fe008e4d44 100644
--- a/source/blender/draw/engines/gpencil/gpencil_render.c
+++ b/source/blender/draw/engines/gpencil/gpencil_render.c
@@ -28,6 +28,7 @@
#include "DRW_render.h"
#include "BKE_camera.h"
+#include "BKE_object.h"
#include "DNA_gpencil_types.h"
@@ -130,12 +131,10 @@ static void GPENCIL_render_cache(
void *vedata, struct Object *ob,
struct RenderEngine *UNUSED(engine), struct Depsgraph *UNUSED(depsgraph))
{
- if ((ob == NULL) || (DRW_object_is_visible_in_active_context(ob) == false)) {
- return;
- }
-
- if (ob->type == OB_GPENCIL) {
- GPENCIL_cache_populate(vedata, ob);
+ if (ob && ob->type == OB_GPENCIL) {
+ if (DRW_object_visibility_in_active_context(ob) & OB_VISIBLE_SELF) {
+ GPENCIL_cache_populate(vedata, ob);
+ }
}
}
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c
index c3b469674d3..52caeb6cbf4 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -35,6 +35,7 @@
#include "BKE_node.h"
#include "BKE_modifier.h"
+#include "BKE_object.h"
#include "BKE_particle.h"
#include "DNA_image_types.h"
@@ -808,7 +809,10 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
return; /* Do not draw solid in this case. */
}
- if (!DRW_object_is_visible_in_active_context(ob) || (ob->dt < OB_SOLID)) {
+ if (!(DRW_object_visibility_in_active_context(ob) & OB_VISIBLE_SELF)) {
+ return;
+ }
+ if (ob->dt < OB_SOLID) {
return;
}
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c
index ca02cc2b5ea..6c955ac1fcb 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -34,6 +34,7 @@
#include "BKE_node.h"
#include "BKE_particle.h"
#include "BKE_modifier.h"
+#include "BKE_object.h"
#include "DNA_image_types.h"
#include "DNA_mesh_types.h"
@@ -489,7 +490,10 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
return; /* Do not draw solid in this case. */
}
- if (!DRW_object_is_visible_in_active_context(ob) || (ob->dt < OB_WIRE)) {
+ if (!(DRW_object_visibility_in_active_context(ob) & OB_VISIBLE_SELF)) {
+ return;
+ }
+ if (ob->dt < OB_WIRE) {
return;
}
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 89aa55c56b2..223868890f2 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -511,7 +511,7 @@ DrawData *DRW_drawdata_ensure(
/* Settings */
bool DRW_object_is_renderable(const struct Object *ob);
-bool DRW_object_is_visible_in_active_context(const struct Object *ob);
+int DRW_object_visibility_in_active_context(const struct Object *ob);
bool DRW_object_is_flat_normal(const struct Object *ob);
bool DRW_object_use_hide_faces(const struct Object *ob);
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 5def2b41461..a991c51a7c3 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -151,7 +151,7 @@ struct DRWTextStore *DRW_text_cache_ensure(void)
bool DRW_object_is_renderable(const Object *ob)
{
- BLI_assert(BKE_object_is_visible(ob, OB_VISIBILITY_CHECK_UNKNOWN_RENDER_MODE));
+ BLI_assert((ob->base_flag & BASE_VISIBLE) != 0);
if (ob->type == OB_MESH) {
if ((ob == DST.draw_ctx.object_edit) || BKE_object_is_in_editmode(ob)) {
@@ -171,12 +171,12 @@ bool DRW_object_is_renderable(const Object *ob)
* Return whether this object is visible depending if
* we are rendering or drawing in the viewport.
*/
-bool DRW_object_is_visible_in_active_context(const Object *ob)
+int DRW_object_visibility_in_active_context(const Object *ob)
{
- const eObjectVisibilityCheck mode = DRW_state_is_scene_render() ?
- OB_VISIBILITY_CHECK_FOR_RENDER :
- OB_VISIBILITY_CHECK_FOR_VIEWPORT;
- return BKE_object_is_visible(ob, mode);
+ const eEvaluationMode mode = DRW_state_is_scene_render() ?
+ DAG_EVAL_RENDER :
+ DAG_EVAL_VIEWPORT;
+ return BKE_object_visibility(ob, mode);
}
bool DRW_object_is_flat_normal(const Object *ob)
@@ -1673,8 +1673,10 @@ bool DRW_render_check_grease_pencil(Depsgraph *depsgraph)
{
DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob)
{
- if ((ob->type == OB_GPENCIL) && (DRW_object_is_visible_in_active_context(ob))) {
- return true;
+ if (ob->type == OB_GPENCIL) {
+ if (DRW_object_visibility_in_active_context(ob) & OB_VISIBLE_SELF) {
+ return true;
+ }
}
}
DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index 91e41f75bed..c0504901243 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -2271,7 +2271,7 @@ static void DRW_shgroup_relationship_lines(
Scene *scene,
Object *ob)
{
- if (ob->parent && DRW_object_is_visible_in_active_context(ob->parent)) {
+ if (ob->parent && (DRW_object_visibility_in_active_context(ob->parent) & OB_VISIBLE_SELF)) {
DRW_shgroup_call_dynamic_add(sgl->relationship_lines, ob->orig);
DRW_shgroup_call_dynamic_add(sgl->relationship_lines, ob->obmat[3]);
}
@@ -2279,11 +2279,11 @@ static void DRW_shgroup_relationship_lines(
if (ob->rigidbody_constraint) {
Object *rbc_ob1 = ob->rigidbody_constraint->ob1;
Object *rbc_ob2 = ob->rigidbody_constraint->ob2;
- if (rbc_ob1 && DRW_object_is_visible_in_active_context(rbc_ob1)) {
+ if (rbc_ob1 && (DRW_object_visibility_in_active_context(rbc_ob1) & OB_VISIBLE_SELF)) {
DRW_shgroup_call_dynamic_add(sgl->relationship_lines, rbc_ob1->obmat[3]);
DRW_shgroup_call_dynamic_add(sgl->relationship_lines, ob->obmat[3]);
}
- if (rbc_ob2 && DRW_object_is_visible_in_active_context(rbc_ob2)) {
+ if (rbc_ob2 && (DRW_object_visibility_in_active_context(rbc_ob2) & OB_VISIBLE_SELF)) {
DRW_shgroup_call_dynamic_add(sgl->relationship_lines, rbc_ob2->obmat[3]);
DRW_shgroup_call_dynamic_add(sgl->relationship_lines, ob->obmat[3]);
}
@@ -2608,13 +2608,14 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
RegionView3D *rv3d = draw_ctx->rv3d;
ModifierData *md = NULL;
int theme_id = TH_UNDEFINED;
+ const int ob_visibility = DRW_object_visibility_in_active_context(ob);
/* Handle particles first in case the emitter itself shouldn't be rendered. */
- if (ob->type == OB_MESH) {
+ if (ob_visibility & OB_VISIBLE_PARTICLES) {
OBJECT_cache_populate_particles(ob, psl);
}
- if (DRW_object_is_visible_in_active_context(ob) == false) {
+ if ((ob_visibility & OB_VISIBLE_SELF) == 0) {
return;
}
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 606cbe66d0d..524c22a678d 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -434,7 +434,7 @@ enum {
OB_DUPLIFACES = 1 << 9,
OB_DUPLIFACES_SCALE = 1 << 10,
OB_DUPLIPARTS = 1 << 11,
- OB_RENDER_DUPLI = 1 << 12,
+ OB_TRANSLFAG_DEPRECATED_2 = 1 << 12,
OB_NO_CONSTRAINTS = 1 << 13, /* runtime constraints disable */
OB_NO_PSYS_UPDATE = 1 << 14, /* hack to work around particle issue */
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c
index 1103e5c1f92..d03dfc65ef4 100644
--- a/source/blender/makesrna/intern/rna_depsgraph.c
+++ b/source/blender/makesrna/intern/rna_depsgraph.c
@@ -46,6 +46,7 @@
#include "BLI_math.h"
#include "BKE_anim.h"
+#include "BKE_object.h"
#include "DEG_depsgraph_build.h"
#include "DEG_depsgraph_debug.h"
@@ -79,6 +80,22 @@ static PointerRNA rna_DepsgraphObjectInstance_instance_object_get(PointerRNA *pt
return rna_pointer_inherit_refine(ptr, &RNA_Object, instance_object);
}
+static bool rna_DepsgraphObjectInstance_show_self_get(PointerRNA *ptr)
+{
+ BLI_Iterator *iterator = ptr->data;
+ DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
+ int ob_visibility = BKE_object_visibility(iterator->current, deg_iter->eval_mode);
+ return (ob_visibility & OB_VISIBLE_SELF) != 0;
+}
+
+static bool rna_DepsgraphObjectInstance_show_particles_get(PointerRNA *ptr)
+{
+ BLI_Iterator *iterator = ptr->data;
+ DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
+ int ob_visibility = BKE_object_visibility(iterator->current, deg_iter->eval_mode);
+ return (ob_visibility & OB_VISIBLE_PARTICLES) != 0;
+}
+
static PointerRNA rna_DepsgraphObjectInstance_parent_get(PointerRNA *ptr)
{
BLI_Iterator *iterator = ptr->data;
@@ -444,9 +461,19 @@ static void rna_def_depsgraph_instance(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
RNA_def_property_pointer_funcs(prop, "rna_DepsgraphObjectInstance_object_get", NULL, NULL, NULL);
+ prop = RNA_def_property(srna, "show_self", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Show Self", "The object geometry itself should be visible in the render");
+ RNA_def_property_boolean_funcs(prop, "rna_DepsgraphObjectInstance_show_self_get", NULL);
+
+ prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Show Particles", "Particles part of the object should be visible in the render");
+ RNA_def_property_boolean_funcs(prop, "rna_DepsgraphObjectInstance_show_particles_get", NULL);
+
prop = RNA_def_property(srna, "is_instance", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Instance", "Denotes whether the object is coming from dupli-list");
+ RNA_def_property_ui_text(prop, "Is Instance", "Denotes if the object is generated by another object");
RNA_def_property_boolean_funcs(prop, "rna_DepsgraphObjectInstance_is_instance_get", NULL);
prop = RNA_def_property(srna, "instance_object", PROP_POINTER, PROP_NONE);
@@ -457,7 +484,7 @@ static void rna_def_depsgraph_instance(BlenderRNA *brna)
prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_ui_text(prop, "Parent", "Evaluated parent object of the duplication list");
+ RNA_def_property_ui_text(prop, "Parent", "If the object is an instance, the parent object that generated it");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
RNA_def_property_pointer_funcs(prop, "rna_DepsgraphObjectInstance_parent_get", NULL, NULL, NULL);
@@ -476,7 +503,7 @@ static void rna_def_depsgraph_instance(BlenderRNA *brna)
prop = RNA_def_property(srna, "random_id", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Dupli random id", "Random id for this dupli object");
+ RNA_def_property_ui_text(prop, "Dupli random id", "Random id for this instance, typically for randomized shading");
RNA_def_property_int_funcs(prop, "rna_DepsgraphObjectInstance_random_id_get", NULL, NULL);
prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);