forked from blender/blender
Fix visibility of instancer object #43
@ -38,16 +38,23 @@ bool InstancerData::is_supported(Object *object)
|
||||
|
||||
bool InstancerData::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);
|
||||
bool ret = vis & OB_VISIBLE_INSTANCES;
|
||||
if (deg_mode == DAG_EVAL_VIEWPORT) {
|
||||
ret = BKE_object_is_visible_in_viewport(scene_delegate->view3d, object) &&
|
||||
(vis & OB_VISIBLE_INSTANCES);
|
||||
ret &= BKE_object_is_visible_in_viewport(scene_delegate->view3d, object);
|
||||
}
|
||||
else {
|
||||
vis = BKE_object_visibility(object, deg_mode);
|
||||
ret = vis & (OB_VISIBLE_SELF | OB_VISIBLE_INSTANCES);
|
||||
if (ret) {
|
||||
/* If some of parent object is instancer, then currenct object as instancer
|
||||
* is invisible in Final render */
|
||||
for (Object *ob = object->parent; ob != nullptr; ob = ob->parent) {
|
||||
if (ob->transflag & OB_DUPLI) {
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -261,31 +268,8 @@ void InstancerData::update_double_sided(MaterialData *mat_data)
|
||||
|
||||
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 = vis & OB_VISIBLE_SELF;
|
||||
//if (ret && object->transflag & OB_DUPLI) {
|
||||
// ret = object->duplicator_visibility_flag & OB_DUPLI_FLAG_VIEWPORT;
|
||||
//}
|
||||
}
|
||||
else {
|
||||
ret = vis & OB_VISIBLE_SELF;
|
||||
if (ret && object->transflag & OB_DUPLI) {
|
||||
ret = object->duplicator_visibility_flag & OB_DUPLI_FLAG_RENDER;
|
||||
}
|
||||
//if (ret) {
|
||||
// /* If some of parent object is instacer, then object is invisible in Final render */
|
||||
// for (Object *ob = object->parent; ob != nullptr; ob = ob->parent) {
|
||||
// if (ob->transflag & OB_DUPLI) {
|
||||
// ret = false;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
return ret;
|
||||
int vis = BKE_object_visibility(object, DEG_get_mode(scene_delegate_->depsgraph));
|
||||
return vis & OB_VISIBLE_SELF;
|
||||
}
|
||||
|
||||
pxr::SdfPath InstancerData::object_prim_id(Object *object) const
|
||||
|
@ -62,23 +62,16 @@ bool ObjectData::is_supported(Object *object)
|
||||
|
||||
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);
|
||||
bool ret = vis & OB_VISIBLE_SELF;
|
||||
if (deg_mode == DAG_EVAL_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;
|
||||
//}
|
||||
ret &= BKE_object_is_visible_in_viewport(scene_delegate->view3d, object);
|
||||
}
|
||||
else {
|
||||
ret = vis & OB_VISIBLE_SELF;
|
||||
if (ret && object->transflag & OB_DUPLI) {
|
||||
ret = object->duplicator_visibility_flag & OB_DUPLI_FLAG_RENDER;
|
||||
}
|
||||
if (ret) {
|
||||
/* If some of parent object is instacer, then object is invisible in Final render */
|
||||
/* If some of parent object is instancer, then currenct object
|
||||
* is invisible in Final render */
|
||||
for (Object *ob = object->parent; ob != nullptr; ob = ob->parent) {
|
||||
if (ob->transflag & OB_DUPLI) {
|
||||
ret = false;
|
||||
|
Loading…
Reference in New Issue
Block a user