forked from blender/blender
Make object visibility and instancing creation to be calculated via depsgraph #57
@ -202,6 +202,15 @@ void InstancerData::write_instances()
|
|||||||
l_inst.transforms.clear();
|
l_inst.transforms.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto is_instance_visible = [&](Object *parent_ob) {
|
||||||
|
eEvaluationMode deg_mode = DEG_get_mode(scene_delegate_->depsgraph);
|
||||||
|
bool ret = BKE_object_visibility(parent_ob, deg_mode) & OB_VISIBLE_INSTANCES;
|
||||||
|
if (deg_mode == DAG_EVAL_VIEWPORT) {
|
||||||
|
ret &= BKE_object_is_visible_in_viewport(scene_delegate_->view3d, parent_ob);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
DEGObjectIterSettings s = {0};
|
DEGObjectIterSettings s = {0};
|
||||||
s.depsgraph = scene_delegate_->depsgraph;
|
s.depsgraph = scene_delegate_->depsgraph;
|
||||||
s.flags = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET |
|
s.flags = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET |
|
||||||
@ -217,17 +226,17 @@ void InstancerData::write_instances()
|
|||||||
Object *,
|
Object *,
|
||||||
object)
|
object)
|
||||||
{
|
{
|
||||||
if (d.dupli_object_current == nullptr) {
|
DupliObject *dupli = d.dupli_object_current;
|
||||||
|
if (dupli == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!is_instance_visible(d.dupli_parent)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DupliObject *dupli = d.dupli_object_current;
|
|
||||||
Object *ob = dupli->ob;
|
Object *ob = dupli->ob;
|
||||||
if (!is_instance_supported(ob)) {
|
if (!is_instance_supported(ob)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!ObjectData::is_visible(scene_delegate_, d.dupli_parent)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!scene_delegate_->shading_settings.use_scene_lights && ob->type == OB_LAMP) {
|
if (!scene_delegate_->shading_settings.use_scene_lights && ob->type == OB_LAMP) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user