forked from blender/blender
Fix visibility of instancer object #43
@ -370,8 +370,8 @@ void BlenderSceneDelegate::check_updates()
|
||||
DEGIDIterData data = {0};
|
||||
data.graph = depsgraph;
|
||||
data.only_updated = true;
|
||||
ITER_BEGIN (
|
||||
DEG_iterator_ids_begin, DEG_iterator_ids_next, DEG_iterator_ids_end, &data, ID *, id) {
|
||||
ITER_BEGIN (DEG_iterator_ids_begin, DEG_iterator_ids_next, DEG_iterator_ids_end, &data, ID *, id)
|
||||
{
|
||||
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE,
|
||||
2,
|
||||
@ -438,8 +438,7 @@ void BlenderSceneDelegate::add_new_objects()
|
||||
{
|
||||
DEGObjectIterSettings settings = {0};
|
||||
settings.depsgraph = depsgraph;
|
||||
settings.flags = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
|
||||
DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET;
|
||||
settings.flags = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET;
|
||||
DEGObjectIterData data = {0};
|
||||
data.settings = &settings;
|
||||
data.graph = settings.depsgraph;
|
||||
@ -449,7 +448,8 @@ void BlenderSceneDelegate::add_new_objects()
|
||||
DEG_iterator_objects_end,
|
||||
&data,
|
||||
Object *,
|
||||
object) {
|
||||
object)
|
||||
{
|
||||
|
||||
update_objects(object);
|
||||
update_instancers(object);
|
||||
@ -474,7 +474,8 @@ void BlenderSceneDelegate::remove_unused_objects()
|
||||
DEG_iterator_objects_end,
|
||||
&data,
|
||||
Object *,
|
||||
object) {
|
||||
object)
|
||||
{
|
||||
if (ObjectData::is_supported(object)) {
|
||||
available_objects.insert(object_prim_id(object).GetName());
|
||||
}
|
||||
@ -550,7 +551,8 @@ void BlenderSceneDelegate::update_visibility()
|
||||
DEG_iterator_objects_end,
|
||||
&data,
|
||||
Object *,
|
||||
object) {
|
||||
object)
|
||||
{
|
||||
|
||||
if (!object_data(object_prim_id(object))) {
|
||||
update_objects(object);
|
||||
|
@ -43,16 +43,13 @@ bool InstancerData::is_visible(BlenderSceneDelegate *scene_delegate,
|
||||
bool ret = true;
|
||||
eEvaluationMode deg_mode = DEG_get_mode(scene_delegate->depsgraph);
|
||||
ret = BKE_object_visibility(object, deg_mode) & (OB_VISIBLE_SELF | OB_VISIBLE_INSTANCES);
|
||||
if (ret && child_object && child_object->transflag & OB_DUPLI)
|
||||
{
|
||||
if (ret && child_object && child_object->transflag & OB_DUPLI) {
|
||||
int flag = deg_mode == DAG_EVAL_VIEWPORT ? OB_DUPLI_FLAG_VIEWPORT : OB_DUPLI_FLAG_RENDER;
|
||||
|
||||
ret = child_object->duplicator_visibility_flag & flag;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void InstancerData::init()
|
||||
{
|
||||
ID_LOG(2, "");
|
||||
@ -86,7 +83,8 @@ void InstancerData::update()
|
||||
Object *object = (Object *)id;
|
||||
if (id->recalc & ID_RECALC_GEOMETRY ||
|
||||
(object->data && ((ID *)object->data)->recalc & ID_RECALC_GEOMETRY) ||
|
||||
id->recalc & ID_RECALC_TRANSFORM) {
|
||||
id->recalc & ID_RECALC_TRANSFORM)
|
||||
{
|
||||
set_instances();
|
||||
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkInstancerDirty(
|
||||
prim_id, pxr::HdChangeTracker::AllDirty);
|
||||
@ -197,7 +195,8 @@ void InstancerData::check_update(Object *object)
|
||||
if (l_it != light_instances_.end()) {
|
||||
Object *obj = (Object *)l_it->second.data->id;
|
||||
if (obj->id.recalc & (ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY) ||
|
||||
((ID *)obj->data)->recalc & ID_RECALC_GEOMETRY) {
|
||||
((ID *)obj->data)->recalc & ID_RECALC_GEOMETRY)
|
||||
{
|
||||
set_instances();
|
||||
}
|
||||
return;
|
||||
|
@ -27,7 +27,8 @@ void MeshData::init()
|
||||
|
||||
Object *object = (Object *)id;
|
||||
if (object->type == OB_MESH && object->mode == OB_MODE_OBJECT &&
|
||||
BLI_listbase_is_empty(&object->modifiers)) {
|
||||
BLI_listbase_is_empty(&object->modifiers))
|
||||
{
|
||||
write_mesh((Mesh *)object->data);
|
||||
}
|
||||
else {
|
||||
|
@ -60,7 +60,8 @@ bool ObjectData::is_supported(Object *object)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ObjectData::is_visible(BlenderSceneDelegate* scene_delegate, Object* object) {
|
||||
bool ObjectData::is_visible(BlenderSceneDelegate *scene_delegate, Object *object)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
if (DEG_get_mode(scene_delegate->depsgraph) == DAG_EVAL_VIEWPORT) {
|
||||
|
Loading…
Reference in New Issue
Block a user