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
Showing only changes of commit 5b0747e763 - Show all commits

View File

@ -88,7 +88,6 @@ void InstancerData::remove()
void InstancerData::update()
{
ID_LOG(2, "");
Object *object = (Object *)id;
if (id->recalc & ID_RECALC_GEOMETRY ||
(object->data && ((ID *)object->data)->recalc & ID_RECALC_GEOMETRY) ||
@ -215,7 +214,7 @@ void InstancerData::check_update(Object *object)
if (l_inst) {
if (!is_instance_visible(object)) {
l_inst->transforms.clear();
update_light_instance(l_it->second);
update_light_instance(*l_inst);
light_instances_.erase(path);
return;
}
@ -231,19 +230,19 @@ void InstancerData::check_update(Object *object)
/* Checking if object wasn't added to instances before */
if (is_supported(object) && is_instance_visible(object)) {
bool do_set_instances = false;
bool do_write_instances = false;
ListBase *lb = object_duplilist(
scene_delegate_->depsgraph, scene_delegate_->scene, (Object *)id);
LISTBASE_FOREACH (DupliObject *, dupli, lb) {
if (dupli->ob == object) {
do_set_instances = true;
do_write_instances = true;
break;
}
}
free_object_duplilist(lb);
if (do_set_instances) {
set_instances();
if (do_write_instances) {
write_instances();
if (!mesh_instances_.empty()) {
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkInstancerDirty(
prim_id, pxr::HdChangeTracker::AllDirty);