Refactor code after PR #57 #67

Merged
Bogdan Nagirniak merged 9 commits from hydra-object_data-refactor into hydra-render 2023-07-20 22:34:34 +02:00
Showing only changes of commit cfbd8d115d - Show all commits

View File

@ -266,6 +266,10 @@ pxr::SdfPath BlenderSceneDelegate::world_prim_id() const
ObjectData *BlenderSceneDelegate::object_data(pxr::SdfPath const &id) const ObjectData *BlenderSceneDelegate::object_data(pxr::SdfPath const &id) const
{ {
if (id == world_prim_id()) {
return world_data_.get();
}
pxr::SdfPath p_id = (id.GetName().find("SM_") == 0 || id.GetName().find("VF_") == 0) ? pxr::SdfPath p_id = (id.GetName().find("SM_") == 0 || id.GetName().find("VF_") == 0) ?
id.GetParentPath() : id.GetParentPath() :
id; id;
@ -273,6 +277,7 @@ ObjectData *BlenderSceneDelegate::object_data(pxr::SdfPath const &id) const
if (obj_data) { if (obj_data) {
return obj_data->get(); return obj_data->get();
} }
InstancerData *i_data = instancer_data(p_id, true); InstancerData *i_data = instancer_data(p_id, true);
if (i_data) { if (i_data) {
return i_data->object_data(id); return i_data->object_data(id);
@ -297,9 +302,6 @@ VolumeData *BlenderSceneDelegate::volume_data(pxr::SdfPath const &id) const
LightData *BlenderSceneDelegate::light_data(pxr::SdfPath const &id) const LightData *BlenderSceneDelegate::light_data(pxr::SdfPath const &id) const
{ {
if (id == world_prim_id()) {
return world_data_.get();
}
return dynamic_cast<LightData *>(object_data(id)); return dynamic_cast<LightData *>(object_data(id));
} }