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 70cd9f9ea4 - Show all commits

View File

@ -68,13 +68,9 @@ pxr::GfMatrix4d BlenderSceneDelegate::GetTransform(pxr::SdfPath const &id)
pxr::VtValue BlenderSceneDelegate::Get(pxr::SdfPath const &id, pxr::TfToken const &key) pxr::VtValue BlenderSceneDelegate::Get(pxr::SdfPath const &id, pxr::TfToken const &key)
{ {
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s, %s", id.GetText(), key.GetText()); CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s, %s", id.GetText(), key.GetText());
MeshData *m_data = mesh_data(id);
if (m_data) {
return m_data->get_data(id, key);
}
ObjectData *obj_data = object_data(id); ObjectData *obj_data = object_data(id);
if (obj_data) { if (obj_data) {
return obj_data->get_data(key); return obj_data->get_data(id, key);
} }
MaterialData *mat_data = material_data(id); MaterialData *mat_data = material_data(id);
if (mat_data) { if (mat_data) {
@ -95,9 +91,6 @@ pxr::VtValue BlenderSceneDelegate::GetLightParamValue(pxr::SdfPath const &id,
if (l_data) { if (l_data) {
return l_data->get_data(key); return l_data->get_data(key);
} }
if (id == world_prim_id()) {
return world_data_->get_data(key);
}
return pxr::VtValue(); return pxr::VtValue();
} }
@ -123,17 +116,9 @@ pxr::HdPrimvarDescriptorVector BlenderSceneDelegate::GetPrimvarDescriptors(
pxr::SdfPath BlenderSceneDelegate::GetMaterialId(pxr::SdfPath const &rprim_id) pxr::SdfPath BlenderSceneDelegate::GetMaterialId(pxr::SdfPath const &rprim_id)
{ {
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", rprim_id.GetText()); CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", rprim_id.GetText());
MeshData *m_data = mesh_data(rprim_id); ObjectData *obj_data = object_data(rprim_id);
if (m_data) { if (obj_data) {
return m_data->material_id(rprim_id); return obj_data->material_id(rprim_id);
}
CurvesData *c_data = curves_data(rprim_id);
if (c_data) {
return c_data->material_id();
}
VolumeData *v_data = volume_data(rprim_id);
if (v_data) {
return v_data->material_id();
} }
return pxr::SdfPath(); return pxr::SdfPath();
} }
@ -312,6 +297,9 @@ 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));
} }