Fix visibility of instancer object #43

Merged
Bogdan Nagirniak merged 16 commits from BLEN-405_1 into hydra-render 2023-05-24 13:44:35 +02:00
2 changed files with 15 additions and 12 deletions
Showing only changes of commit aec4f0a192 - Show all commits

View File

@ -40,11 +40,13 @@ bool InstancerData::is_visible(BlenderSceneDelegate *scene_delegate, Object *obj
{
bool ret = true;
eEvaluationMode deg_mode = DEG_get_mode(scene_delegate->depsgraph);
int vis = BKE_object_visibility(object, deg_mode);
if (deg_mode == DAG_EVAL_VIEWPORT) {
ret = BKE_object_is_visible_in_viewport(scene_delegate->view3d, object);
ret = BKE_object_is_visible_in_viewport(scene_delegate->view3d, object) &&
(vis & OB_VISIBLE_INSTANCES);
}
else {
int vis = BKE_object_visibility(object, deg_mode);
vis = BKE_object_visibility(object, deg_mode);
ret = vis & (OB_VISIBLE_SELF | OB_VISIBLE_INSTANCES);
}
return ret;
@ -261,14 +263,14 @@ bool InstancerData::is_instance_visible(Object *object)
{
bool ret = true;
eEvaluationMode deg_mode = DEG_get_mode(scene_delegate_->depsgraph);
int vis = BKE_object_visibility(object, deg_mode);
if (deg_mode == DAG_EVAL_VIEWPORT) {
ret = BKE_object_is_visible_in_viewport(scene_delegate_->view3d, object);
if (ret && object->transflag & OB_DUPLI) {
ret = object->duplicator_visibility_flag & OB_DUPLI_FLAG_VIEWPORT;
}
ret = vis & OB_VISIBLE_SELF;
//if (ret && object->transflag & OB_DUPLI) {
// ret = object->duplicator_visibility_flag & OB_DUPLI_FLAG_VIEWPORT;
//}
}
else {
int vis = BKE_object_visibility(object, deg_mode);
ret = vis & OB_VISIBLE_SELF;
if (ret && object->transflag & OB_DUPLI) {
ret = object->duplicator_visibility_flag & OB_DUPLI_FLAG_RENDER;

View File

@ -64,14 +64,15 @@ bool ObjectData::is_visible(BlenderSceneDelegate *scene_delegate, Object *object
{
bool ret = true;
eEvaluationMode deg_mode = DEG_get_mode(scene_delegate->depsgraph);
int vis = BKE_object_visibility(object, deg_mode);
if (deg_mode == DAG_EVAL_VIEWPORT) {
ret = BKE_object_is_visible_in_viewport(scene_delegate->view3d, object);
if (ret && object->transflag & OB_DUPLI) {
ret = object->duplicator_visibility_flag & OB_DUPLI_FLAG_VIEWPORT;
}
ret = BKE_object_is_visible_in_viewport(scene_delegate->view3d, object) &&
(vis & OB_VISIBLE_SELF);
//if (ret && object->transflag & OB_DUPLI) {
// ret = object->duplicator_visibility_flag & OB_DUPLI_FLAG_VIEWPORT;
//}
}
else {
int vis = BKE_object_visibility(object, deg_mode);
ret = vis & OB_VISIBLE_SELF;
if (ret && object->transflag & OB_DUPLI) {
ret = object->duplicator_visibility_flag & OB_DUPLI_FLAG_RENDER;