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
2 changed files with 11 additions and 4 deletions
Showing only changes of commit 54aa648ee2 - Show all commits

View File

@ -108,10 +108,6 @@ pxr::VtValue VolumeData::get_data(pxr::TfToken const &key) const
if (key == pxr::HdVolumeFieldSchemaTokens->filePath) { if (key == pxr::HdVolumeFieldSchemaTokens->filePath) {
return pxr::VtValue(pxr::SdfAssetPath(filepath_, filepath_)); return pxr::VtValue(pxr::SdfAssetPath(filepath_, filepath_));
} }
if (key == pxr::HdVolumeFieldSchemaTokens->fieldName) {
std::string name = prim_id.GetName();
return pxr::VtValue(pxr::TfToken(name.substr(name.find("VF_") + 3)));
}
if (key == pxr::HdVolumeFieldSchemaTokens->fieldIndex) { if (key == pxr::HdVolumeFieldSchemaTokens->fieldIndex) {
return pxr::VtValue(0); return pxr::VtValue(0);
} }
@ -121,6 +117,16 @@ pxr::VtValue VolumeData::get_data(pxr::TfToken const &key) const
return pxr::VtValue(); return pxr::VtValue();
} }
pxr::VtValue VolumeData::get_data(pxr::SdfPath const &id, pxr::TfToken const &key) const
{
if (key == pxr::HdVolumeFieldSchemaTokens->fieldName) {
std::string name = id.GetName();
return pxr::VtValue(pxr::TfToken(name.substr(name.find("VF_") + 3)));
}
return get_data(key);
}
pxr::SdfPath VolumeData::material_id() const pxr::SdfPath VolumeData::material_id() const
{ {
if (!mat_data_) { if (!mat_data_) {

View File

@ -20,6 +20,7 @@ class VolumeData : public ObjectData {
void update() override; void update() override;
pxr::VtValue get_data(pxr::TfToken const &key) const override; pxr::VtValue get_data(pxr::TfToken const &key) const override;
pxr::VtValue get_data(pxr::SdfPath const &id, pxr::TfToken const &key) const override;
pxr::SdfPath material_id() const override; pxr::SdfPath material_id() const override;
void available_materials(Set<pxr::SdfPath> &paths) const override; void available_materials(Set<pxr::SdfPath> &paths) const override;