Support several instancers on one object #24

Merged
Bogdan Nagirniak merged 16 commits from BLEN-383 into hydra-render 2023-04-19 02:46:24 +02:00
2 changed files with 12 additions and 8 deletions
Showing only changes of commit 8359745e42 - Show all commits

View File

@ -414,11 +414,6 @@ pxr::GfMatrix4d BlenderSceneDelegate::GetTransform(pxr::SdfPath const &id)
return world_data->transform();
}
InstancerData *i_data = instancer_data(id);
if (i_data) {
return i_data->transform();
}
return pxr::GfMatrix4d();
}

View File

@ -54,9 +54,6 @@ void InstancerData::init()
{
ID_LOG(2, "");
set_instances();
for (auto &it : instances) {
it.second.obj_data->init();
}
}
pxr::GfMatrix4d InstancerData::transform()
@ -138,6 +135,8 @@ void InstancerData::set_instances()
continue;
}
inst->obj_data = std::make_unique<InstanceMeshData>(scene_delegate, dupli->ob, path);
inst->obj_data->init();
inst->obj_data->insert();
}
else {
inst = &it->second;
@ -148,6 +147,16 @@ void InstancerData::set_instances()
++index;
}
free_object_duplilist(lb);
/* Remove intances without indices */
for (auto it = instances.begin(); it != instances.end(); ++it) {
if (!it->second.indices.empty()) {
continue;
}
it->second.obj_data->remove();
instances.erase(it);
it = instances.begin();
}
}
void InstancerData::insert()