Fix review comments #51

Merged
Bogdan Nagirniak merged 15 commits from BLEN-430 into hydra-render 2023-06-08 18:10:55 +02:00
6 changed files with 26 additions and 38 deletions
Showing only changes of commit d2e8ff041f - Show all commits

View File

@ -69,17 +69,16 @@ void CurvesData::update()
pxr::VtValue CurvesData::get_data(pxr::SdfPath const &id, pxr::TfToken const &key) const
{
pxr::VtValue ret;
if (key == pxr::HdTokens->points) {
ret = vertices_;
return pxr::VtValue(vertices_);
}
else if (key == pxr::HdPrimvarRoleTokens->textureCoordinate) {
ret = uvs_;
return pxr::VtValue(uvs_);
}
else if (key == pxr::HdTokens->widths) {
ret = widths_;
return pxr::VtValue(widths_);
}
return ret;
return pxr::VtValue();
}
bool CurvesData::update_visibility()

View File

@ -102,11 +102,10 @@ void InstancerData::update()
pxr::VtValue InstancerData::get_data(pxr::TfToken const &key) const
{
ID_LOG(3, "%s", key.GetText());
pxr::VtValue ret;
if (key == pxr::HdInstancerTokens->instanceTransform) {
ret = mesh_transforms_;
return pxr::VtValue(mesh_transforms_);
}
return ret;
return pxr::VtValue();
}
bool InstancerData::update_visibility()

View File

@ -138,23 +138,22 @@ void LightData::update()
pxr::VtValue LightData::get_data(pxr::TfToken const &key) const
{
pxr::VtValue ret;
auto it = data_.find(key);
if (it != data_.end()) {
ret = it->second;
return pxr::VtValue(it->second);
}
else {
std::string n = key.GetString();
if (boost::algorithm::contains(n, "object:visibility:")) {
if (boost::algorithm::ends_with(n, "camera") || boost::algorithm::ends_with(n, "shadow")) {
ret = false;
return pxr::VtValue(false);
}
else {
ret = true;
return pxr::VtValue(true);
}
}
}
return ret;
return pxr::VtValue();
}
bool LightData::update_visibility()
@ -169,38 +168,32 @@ bool LightData::update_visibility()
pxr::TfToken LightData::prim_type(Light *light)
{
pxr::TfToken ret;
switch (light->type) {
case LA_LOCAL:
case LA_SPOT:
ret = pxr::HdPrimTypeTokens->sphereLight;
break;
return pxr::TfToken(pxr::HdPrimTypeTokens->sphereLight);
case LA_SUN:
ret = pxr::HdPrimTypeTokens->distantLight;
break;
return pxr::TfToken(pxr::HdPrimTypeTokens->distantLight);
case LA_AREA:
switch (light->area_shape) {
case LA_AREA_SQUARE:
case LA_AREA_RECT:
ret = pxr::HdPrimTypeTokens->rectLight;
break;
return pxr::TfToken(pxr::HdPrimTypeTokens->rectLight);
case LA_AREA_DISK:
case LA_AREA_ELLIPSE:
ret = pxr::HdPrimTypeTokens->diskLight;
break;
return pxr::TfToken(pxr::HdPrimTypeTokens->diskLight);
default:
ret = pxr::HdPrimTypeTokens->rectLight;
return pxr::TfToken(pxr::HdPrimTypeTokens->rectLight);
}
break;
default:
ret = pxr::HdPrimTypeTokens->sphereLight;
return pxr::TfToken(pxr::HdPrimTypeTokens->sphereLight);
}
return ret;
}
} // namespace blender::render::hydra

View File

@ -74,14 +74,13 @@ void MaterialData::update()
pxr::VtValue MaterialData::get_data(pxr::TfToken const &key) const
{
pxr::VtValue ret;
if (key == scene_delegate_->settings.mx_filename_key) {
if (!mtlx_path_.GetResolvedPath().empty()) {
ret = mtlx_path_;
}
ID_LOG(3, "%s", key.GetText());
if (!mtlx_path_.GetResolvedPath().empty()) {
return pxr::VtValue(mtlx_path_);
}
}
return ret;
return pxr::VtValue();
}
pxr::VtValue MaterialData::get_material_resource() const

View File

@ -86,17 +86,16 @@ void MeshData::update()
pxr::VtValue MeshData::get_data(pxr::SdfPath const &id, pxr::TfToken const &key) const
{
pxr::VtValue ret;
if (key == pxr::HdTokens->points) {
ret = vertices_;
return pxr::VtValue(vertices_);
}
else if (key == pxr::HdTokens->normals) {
ret = submesh(id).normals;
return pxr::VtValue(submesh(id).normals);
}
else if (key == pxr::HdPrimvarRoleTokens->textureCoordinate) {
ret = submesh(id).uvs;
return pxr::VtValue(submesh(id).uvs);
}
return ret;
return pxr::VtValue();
}
bool MeshData::update_visibility()

View File

@ -131,12 +131,11 @@ void WorldData::update(World *world)
pxr::VtValue WorldData::get_data(pxr::TfToken const &key) const
{
pxr::VtValue ret;
auto it = data_.find(key);
if (it != data_.end()) {
ret = it->second;
return pxr::VtValue(it->second);
}
return ret;
return pxr::VtValue();
}
void WorldData::write_transform()