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