Rename some functions #25

Merged
Bogdan Nagirniak merged 13 commits from BLEN-388 into hydra-render 2023-04-18 09:07:35 +02:00
14 changed files with 90 additions and 90 deletions
Showing only changes of commit 78a399d04c - Show all commits

View File

@ -86,8 +86,8 @@ void BlenderSceneDelegate::populate(Depsgraph *deps, bContext *cont)
} break; } break;
case ID_MA: { case ID_MA: {
MaterialData *mat_data = get_material_data( MaterialData *mat_data = material_data(
MaterialData::get_prim_id(this, (Material *)id)); MaterialData::prim_id(this, (Material *)id));
if (mat_data) { if (mat_data) {
mat_data->update(); mat_data->update();
} }
@ -127,25 +127,25 @@ void BlenderSceneDelegate::clear()
pxr::HdMeshTopology BlenderSceneDelegate::GetMeshTopology(pxr::SdfPath const &id) pxr::HdMeshTopology BlenderSceneDelegate::GetMeshTopology(pxr::SdfPath const &id)
{ {
CLOG_INFO(LOG_BSD, 3, "%s", id.GetText()); CLOG_INFO(LOG_BSD, 3, "%s", id.GetText());
MeshData *m_data = get_mesh_data(id); MeshData *m_data = mesh_data(id);
return m_data->get_mesh_topology(); return m_data->mesh_topology();
} }
pxr::GfMatrix4d BlenderSceneDelegate::GetTransform(pxr::SdfPath const &id) pxr::GfMatrix4d BlenderSceneDelegate::GetTransform(pxr::SdfPath const &id)
{ {
CLOG_INFO(LOG_BSD, 3, "%s", id.GetText()); CLOG_INFO(LOG_BSD, 3, "%s", id.GetText());
ObjectData *obj_data = get_object_data(id); ObjectData *obj_data = object_data(id);
if (obj_data) { if (obj_data) {
return obj_data->get_transform(); return obj_data->transform();
} }
if (id == WorldData::get_prim_id(this)) { if (id == WorldData::prim_id(this)) {
return world_data_->get_transform(); return world_data_->transform();
} }
InstancerData *i_data = get_instancer_data(id); InstancerData *i_data = instancer_data(id);
if (i_data) { if (i_data) {
return i_data->get_transform(); return i_data->transform();
} }
return pxr::GfMatrix4d(); return pxr::GfMatrix4d();
@ -155,17 +155,17 @@ pxr::VtValue BlenderSceneDelegate::Get(pxr::SdfPath const &id, pxr::TfToken cons
{ {
CLOG_INFO(LOG_BSD, 3, "%s, %s", id.GetText(), key.GetText()); CLOG_INFO(LOG_BSD, 3, "%s, %s", id.GetText(), key.GetText());
ObjectData *obj_data = get_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(key);
} }
MaterialData *mat_data = get_material_data(id); MaterialData *mat_data = material_data(id);
if (mat_data) { if (mat_data) {
return mat_data->get_data(key); return mat_data->get_data(key);
} }
InstancerData *i_data = get_instancer_data(id); InstancerData *i_data = instancer_data(id);
if (i_data) { if (i_data) {
return i_data->get_data(key); return i_data->get_data(key);
} }
@ -176,11 +176,11 @@ pxr::VtValue BlenderSceneDelegate::Get(pxr::SdfPath const &id, pxr::TfToken cons
pxr::VtValue BlenderSceneDelegate::GetLightParamValue(pxr::SdfPath const &id, pxr::VtValue BlenderSceneDelegate::GetLightParamValue(pxr::SdfPath const &id,
pxr::TfToken const &key) pxr::TfToken const &key)
{ {
LightData *l_data = get_light_data(id); LightData *l_data = light_data(id);
if (l_data) { if (l_data) {
return l_data->get_data(key); return l_data->get_data(key);
} }
if (id == WorldData::get_prim_id(this)) { if (id == WorldData::prim_id(this)) {
return world_data_->get_data(key); return world_data_->get_data(key);
} }
return pxr::VtValue(); return pxr::VtValue();
@ -191,14 +191,14 @@ pxr::HdPrimvarDescriptorVector BlenderSceneDelegate::GetPrimvarDescriptors(
{ {
CLOG_INFO(LOG_BSD, 3, "%s, %d", id.GetText(), interpolation); CLOG_INFO(LOG_BSD, 3, "%s, %d", id.GetText(), interpolation);
MeshData *m_data = get_mesh_data(id); MeshData *m_data = mesh_data(id);
if (m_data) { if (m_data) {
return m_data->get_primvar_descriptors(interpolation); return m_data->primvar_descriptors(interpolation);
} }
InstancerData *i_data = get_instancer_data(id); InstancerData *i_data = instancer_data(id);
if (i_data) { if (i_data) {
return i_data->get_instancer_primvar_descriptors(interpolation); return i_data->instancer_primvar_descriptors(interpolation);
} }
return pxr::HdPrimvarDescriptorVector(); return pxr::HdPrimvarDescriptorVector();
@ -206,12 +206,12 @@ pxr::HdPrimvarDescriptorVector BlenderSceneDelegate::GetPrimvarDescriptors(
pxr::SdfPath BlenderSceneDelegate::GetMaterialId(pxr::SdfPath const &rprim_id) pxr::SdfPath BlenderSceneDelegate::GetMaterialId(pxr::SdfPath const &rprim_id)
{ {
return get_mesh_data(rprim_id)->get_material_id(); return mesh_data(rprim_id)->material_id();
} }
pxr::VtValue BlenderSceneDelegate::GetMaterialResource(pxr::SdfPath const &id) pxr::VtValue BlenderSceneDelegate::GetMaterialResource(pxr::SdfPath const &id)
{ {
MaterialData *mat_data = get_material_data(id); MaterialData *mat_data = material_data(id);
if (mat_data) { if (mat_data) {
return mat_data->get_material_resource(); return mat_data->get_material_resource();
} }
@ -220,17 +220,17 @@ pxr::VtValue BlenderSceneDelegate::GetMaterialResource(pxr::SdfPath const &id)
bool BlenderSceneDelegate::GetVisible(pxr::SdfPath const &id) bool BlenderSceneDelegate::GetVisible(pxr::SdfPath const &id)
{ {
if (id == WorldData::get_prim_id(this)) { if (id == WorldData::prim_id(this)) {
return true; return true;
} }
return get_object_data(id)->visible; return object_data(id)->visible;
} }
pxr::SdfPath BlenderSceneDelegate::GetInstancerId(pxr::SdfPath const &prim_id) pxr::SdfPath BlenderSceneDelegate::GetInstancerId(pxr::SdfPath const &prim_id)
{ {
CLOG_INFO(LOG_BSD, 3, "%s", prim_id.GetText()); CLOG_INFO(LOG_BSD, 3, "%s", prim_id.GetText());
InstancerData *i_data = get_instancer_data(prim_id, true); InstancerData *i_data = instancer_data(prim_id, true);
if (i_data) { if (i_data) {
return i_data->instancer_id; return i_data->instancer_id;
} }
@ -249,18 +249,18 @@ pxr::VtIntArray BlenderSceneDelegate::GetInstanceIndices(pxr::SdfPath const &ins
pxr::SdfPath const &prototype_id) pxr::SdfPath const &prototype_id)
{ {
CLOG_INFO(LOG_BSD, 3, "%s, %s", instancer_id.GetText(), prototype_id.GetText()); CLOG_INFO(LOG_BSD, 3, "%s, %s", instancer_id.GetText(), prototype_id.GetText());
InstancerData *i_data = get_instancer_data(instancer_id); InstancerData *i_data = instancer_data(instancer_id);
return i_data->get_instance_indices(); return i_data->instance_indices();
} }
pxr::GfMatrix4d BlenderSceneDelegate::GetInstancerTransform(pxr::SdfPath const &instancer_id) pxr::GfMatrix4d BlenderSceneDelegate::GetInstancerTransform(pxr::SdfPath const &instancer_id)
{ {
CLOG_INFO(LOG_BSD, 3, "%s", instancer_id.GetText()); CLOG_INFO(LOG_BSD, 3, "%s", instancer_id.GetText());
InstancerData *i_data = get_instancer_data(instancer_id); InstancerData *i_data = instancer_data(instancer_id);
return i_data->get_transform(); return i_data->transform();
} }
ObjectData *BlenderSceneDelegate::get_object_data(pxr::SdfPath const &id) ObjectData *BlenderSceneDelegate::object_data(pxr::SdfPath const &id)
{ {
auto it = objects_.find(id); auto it = objects_.find(id);
if (it == objects_.end()) { if (it == objects_.end()) {
@ -269,17 +269,17 @@ ObjectData *BlenderSceneDelegate::get_object_data(pxr::SdfPath const &id)
return it->second.get(); return it->second.get();
} }
MeshData *BlenderSceneDelegate::get_mesh_data(pxr::SdfPath const &id) MeshData *BlenderSceneDelegate::mesh_data(pxr::SdfPath const &id)
{ {
return dynamic_cast<MeshData *>(get_object_data(id)); return dynamic_cast<MeshData *>(object_data(id));
} }
LightData *BlenderSceneDelegate::get_light_data(pxr::SdfPath const &id) LightData *BlenderSceneDelegate::light_data(pxr::SdfPath const &id)
{ {
return dynamic_cast<LightData *>(get_object_data(id)); return dynamic_cast<LightData *>(object_data(id));
} }
MaterialData *BlenderSceneDelegate::get_material_data(pxr::SdfPath const &id) MaterialData *BlenderSceneDelegate::material_data(pxr::SdfPath const &id)
{ {
auto it = materials_.find(id); auto it = materials_.find(id);
if (it == materials_.end()) { if (it == materials_.end()) {
@ -288,15 +288,15 @@ MaterialData *BlenderSceneDelegate::get_material_data(pxr::SdfPath const &id)
return it->second.get(); return it->second.get();
} }
InstancerData *BlenderSceneDelegate::get_instancer_data(pxr::SdfPath const &id, bool base_prim) InstancerData *BlenderSceneDelegate::instancer_data(pxr::SdfPath const &id, bool base_prim)
{ {
if (base_prim) { if (base_prim) {
return dynamic_cast<InstancerData *>(get_object_data(id)); return dynamic_cast<InstancerData *>(object_data(id));
} }
return dynamic_cast<InstancerData *>(get_object_data(id.GetParentPath())); return dynamic_cast<InstancerData *>(object_data(id.GetParentPath()));
} }
InstancerData *BlenderSceneDelegate::get_instancer_data(Object *object) InstancerData *BlenderSceneDelegate::instancer_data(Object *object)
{ {
InstancerData *i_data; InstancerData *i_data;
for (auto &it : objects_) { for (auto &it : objects_) {
@ -313,13 +313,13 @@ void BlenderSceneDelegate::add_update_object(Object *object)
if ((object->transflag & OB_DUPLI) && InstancerData::is_supported(object)) { if ((object->transflag & OB_DUPLI) && InstancerData::is_supported(object)) {
add_update_instancer(object); add_update_instancer(object);
} }
InstancerData *i_data = get_instancer_data(object); InstancerData *i_data = instancer_data(object);
if (i_data) { if (i_data) {
i_data->update(); i_data->update();
} }
pxr::SdfPath id = ObjectData::get_prim_id(this, object); pxr::SdfPath id = ObjectData::prim_id(this, object);
ObjectData *obj_data = get_object_data(id); ObjectData *obj_data = object_data(id);
if (obj_data) { if (obj_data) {
obj_data->update(); obj_data->update();
return; return;
@ -328,20 +328,20 @@ void BlenderSceneDelegate::add_update_object(Object *object)
return; return;
} }
objects_[id] = ObjectData::create(this, object); objects_[id] = ObjectData::create(this, object);
obj_data = get_object_data(id); obj_data = object_data(id);
obj_data->update_visibility(view3d_); obj_data->update_visibility(view3d_);
} }
void BlenderSceneDelegate::add_update_instancer(Object *object) void BlenderSceneDelegate::add_update_instancer(Object *object)
{ {
pxr::SdfPath id = InstancerData::get_prim_id(this, object); pxr::SdfPath id = InstancerData::prim_id(this, object);
InstancerData *i_data = get_instancer_data(id, true); InstancerData *i_data = instancer_data(id, true);
if (i_data) { if (i_data) {
i_data->update(); i_data->update();
return; return;
} }
objects_[id] = InstancerData::create(this, object); objects_[id] = InstancerData::create(this, object);
i_data = get_instancer_data(id, true); i_data = instancer_data(id, true);
i_data->update_visibility(view3d_); i_data->update_visibility(view3d_);
} }
@ -397,15 +397,15 @@ void BlenderSceneDelegate::update_collection(bool remove, bool visibility)
continue; continue;
} }
id = ObjectData::get_prim_id(this, object); id = ObjectData::prim_id(this, object);
if (remove) { if (remove) {
available_objects.insert(id); available_objects.insert(id);
if ((object->transflag & OB_DUPLI) && InstancerData::is_supported(object)) { if ((object->transflag & OB_DUPLI) && InstancerData::is_supported(object)) {
available_objects.insert(InstancerData::get_prim_id(this, object)); available_objects.insert(InstancerData::prim_id(this, object));
} }
} }
if (!get_object_data(id)) { if (!object_data(id)) {
add_update_object(object); add_update_object(object);
} }
} }
@ -429,7 +429,7 @@ void BlenderSceneDelegate::update_collection(bool remove, bool visibility)
if (!m_data) { if (!m_data) {
continue; continue;
} }
pxr::SdfPath mat_id = m_data->get_material_id(); pxr::SdfPath mat_id = m_data->material_id();
if (!mat_id.IsEmpty()) { if (!mat_id.IsEmpty()) {
available_materials.insert(mat_id); available_materials.insert(mat_id);
} }

View File

@ -54,12 +54,12 @@ class BlenderSceneDelegate : public pxr::HdSceneDelegate {
EngineType engine_type; EngineType engine_type;
private: private:
ObjectData *get_object_data(pxr::SdfPath const &id); ObjectData *object_data(pxr::SdfPath const &id);
DagerD marked this conversation as resolved Outdated

is get_ prefix required by code style?

is `get_` prefix required by code style?
MeshData *get_mesh_data(pxr::SdfPath const &id); MeshData *mesh_data(pxr::SdfPath const &id);
LightData *get_light_data(pxr::SdfPath const &id); LightData *light_data(pxr::SdfPath const &id);
MaterialData *get_material_data(pxr::SdfPath const &id); MaterialData *material_data(pxr::SdfPath const &id);
InstancerData *get_instancer_data(pxr::SdfPath const &id, bool base_prim = false); InstancerData *instancer_data(pxr::SdfPath const &id, bool base_prim = false);
InstancerData *get_instancer_data(Object *object); InstancerData *instancer_data(Object *object);
void add_update_object(Object *object); void add_update_object(Object *object);
void add_update_instancer(Object *object); void add_update_instancer(Object *object);

View File

@ -13,7 +13,7 @@ InstancerData::InstancerData(BlenderSceneDelegate *scene_delegate, Object *objec
: MeshData(scene_delegate, object), parent_obj_(object) : MeshData(scene_delegate, object), parent_obj_(object)
{ {
id_ = nullptr; id_ = nullptr;
p_id_ = get_prim_id(scene_delegate, object); p_id_ = prim_id(scene_delegate, object);
instancer_id = p_id_.AppendElementString("Instancer"); instancer_id = p_id_.AppendElementString("Instancer");
CLOG_INFO(LOG_BSD, 2, "%s, instancer_id=%s", ((ID *)parent_obj_)->name, instancer_id.GetText()); CLOG_INFO(LOG_BSD, 2, "%s, instancer_id=%s", ((ID *)parent_obj_)->name, instancer_id.GetText());
} }
@ -43,7 +43,7 @@ std::unique_ptr<InstancerData> InstancerData::create(BlenderSceneDelegate *scene
return data; return data;
} }
pxr::SdfPath InstancerData::get_prim_id(BlenderSceneDelegate *scene_delegate, Object *object) pxr::SdfPath InstancerData::prim_id(BlenderSceneDelegate *scene_delegate, Object *object)
{ {
/* Making id of instancer in form like I_<pointer in 16 hex digits format>. Example: /* Making id of instancer in form like I_<pointer in 16 hex digits format>. Example:
* I_000002073e369608 */ * I_000002073e369608 */
@ -121,7 +121,7 @@ pxr::VtValue InstancerData::get_data(pxr::TfToken const &key) const
return MeshData::get_data(key); return MeshData::get_data(key);
} }
pxr::GfMatrix4d InstancerData::get_transform() pxr::GfMatrix4d InstancerData::transform()
{ {
return pxr::GfMatrix4d(1.0); return pxr::GfMatrix4d(1.0);
} }
@ -142,7 +142,7 @@ bool InstancerData::update_visibility(View3D *view3d)
return ret; return ret;
} }
pxr::HdPrimvarDescriptorVector InstancerData::get_instancer_primvar_descriptors( pxr::HdPrimvarDescriptorVector InstancerData::instancer_primvar_descriptors(
pxr::HdInterpolation interpolation) pxr::HdInterpolation interpolation)
{ {
pxr::HdPrimvarDescriptorVector primvars; pxr::HdPrimvarDescriptorVector primvars;
@ -153,7 +153,7 @@ pxr::HdPrimvarDescriptorVector InstancerData::get_instancer_primvar_descriptors(
return primvars; return primvars;
} }
pxr::VtIntArray InstancerData::get_instance_indices() pxr::VtIntArray InstancerData::instance_indices()
{ {
pxr::VtIntArray ret(transforms_.size()); pxr::VtIntArray ret(transforms_.size());
for (size_t i = 0; i < ret.size(); ++i) { for (size_t i = 0; i < ret.size(); ++i) {

View File

@ -16,7 +16,7 @@ class InstancerData : public MeshData {
static bool is_supported(Object *object); static bool is_supported(Object *object);
static std::unique_ptr<InstancerData> create(BlenderSceneDelegate *scene_delegate, static std::unique_ptr<InstancerData> create(BlenderSceneDelegate *scene_delegate,
Object *object); Object *object);
static pxr::SdfPath get_prim_id(BlenderSceneDelegate *scene_delegate, Object *object); static pxr::SdfPath prim_id(BlenderSceneDelegate *scene_delegate, Object *object);
void init() override; void init() override;
void insert() override; void insert() override;
@ -24,12 +24,12 @@ class InstancerData : public MeshData {
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::GfMatrix4d get_transform() override; pxr::GfMatrix4d transform() override;
bool update_visibility(View3D *view3d) override; bool update_visibility(View3D *view3d) override;
pxr::HdPrimvarDescriptorVector get_instancer_primvar_descriptors( pxr::HdPrimvarDescriptorVector instancer_primvar_descriptors(
pxr::HdInterpolation interpolation); pxr::HdInterpolation interpolation);
pxr::VtIntArray get_instance_indices(); pxr::VtIntArray instance_indices();
bool is_base(Object *object) const; bool is_base(Object *object) const;
pxr::SdfPath instancer_id; pxr::SdfPath instancer_id;

View File

@ -79,7 +79,7 @@ void LightData::init()
break; break;
} }
p_type_ = get_prim_type(light); p_type_ = prim_type(light);
/* TODO: temporary value, it should be delivered through Python UI */ /* TODO: temporary value, it should be delivered through Python UI */
data_[pxr::HdLightTokens->exposure] = 1.0f; data_[pxr::HdLightTokens->exposure] = 1.0f;
@ -102,7 +102,7 @@ void LightData::update()
CLOG_INFO(LOG_BSD, 2, "%s", id_->name); CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
Light *light = (Light *)((Object *)id_)->data; Light *light = (Light *)((Object *)id_)->data;
if (get_prim_type(light) != p_type_) { if (prim_type(light) != p_type_) {
remove(); remove();
init(); init();
insert(); insert();
@ -151,7 +151,7 @@ bool LightData::update_visibility(View3D *view3d)
return ret; return ret;
} }
pxr::TfToken LightData::get_prim_type(Light *light) pxr::TfToken LightData::prim_type(Light *light)
{ {
pxr::TfToken ret; pxr::TfToken ret;
switch (light->type) { switch (light->type) {

View File

@ -26,7 +26,7 @@ class LightData : public ObjectData {
bool update_visibility(View3D *view3d) override; bool update_visibility(View3D *view3d) override;
private: private:
pxr::TfToken get_prim_type(Light *light); pxr::TfToken prim_type(Light *light);
std::map<pxr::TfToken, pxr::VtValue> data_; std::map<pxr::TfToken, pxr::VtValue> data_;
pxr::TfToken p_type_; pxr::TfToken p_type_;

View File

@ -23,7 +23,7 @@ namespace blender::render::hydra {
MaterialData::MaterialData(BlenderSceneDelegate *scene_delegate, Material *material) MaterialData::MaterialData(BlenderSceneDelegate *scene_delegate, Material *material)
: IdData(scene_delegate, (ID *)material) : IdData(scene_delegate, (ID *)material)
{ {
p_id_ = get_prim_id(scene_delegate, material); p_id_ = prim_id(scene_delegate, material);
CLOG_INFO(LOG_BSD, 2, "%s, id=%s", id_->name, p_id_.GetText()); CLOG_INFO(LOG_BSD, 2, "%s, id=%s", id_->name, p_id_.GetText());
} }
@ -36,7 +36,7 @@ std::unique_ptr<MaterialData> MaterialData::create(BlenderSceneDelegate *scene_d
return data; return data;
} }
pxr::SdfPath MaterialData::get_prim_id(BlenderSceneDelegate *scene_delegate, Material *material) pxr::SdfPath MaterialData::prim_id(BlenderSceneDelegate *scene_delegate, Material *material)
{ {
/* Making id of material in form like M_<pointer in 16 hex digits format>. /* Making id of material in form like M_<pointer in 16 hex digits format>.
* Example: M_000002074e812088 */ * Example: M_000002074e812088 */

View File

@ -23,7 +23,7 @@ class MaterialData : IdData {
static std::unique_ptr<MaterialData> create(BlenderSceneDelegate *scene_delegate, static std::unique_ptr<MaterialData> create(BlenderSceneDelegate *scene_delegate,
Material *material); Material *material);
static pxr::SdfPath get_prim_id(BlenderSceneDelegate *scene_delegate, Material *material); static pxr::SdfPath prim_id(BlenderSceneDelegate *scene_delegate, Material *material);
void init() override; void init() override;
void insert() override; void insert() override;

View File

@ -126,7 +126,7 @@ bool MeshData::update_visibility(View3D *view3d)
return ret; return ret;
} }
pxr::HdMeshTopology MeshData::get_mesh_topology() pxr::HdMeshTopology MeshData::mesh_topology()
{ {
return pxr::HdMeshTopology(pxr::PxOsdOpenSubdivTokens->none, return pxr::HdMeshTopology(pxr::PxOsdOpenSubdivTokens->none,
pxr::HdTokens->rightHanded, pxr::HdTokens->rightHanded,
@ -134,7 +134,7 @@ pxr::HdMeshTopology MeshData::get_mesh_topology()
face_vertex_indices_); face_vertex_indices_);
} }
pxr::HdPrimvarDescriptorVector MeshData::get_primvar_descriptors( pxr::HdPrimvarDescriptorVector MeshData::primvar_descriptors(
pxr::HdInterpolation interpolation) pxr::HdInterpolation interpolation)
{ {
pxr::HdPrimvarDescriptorVector primvars; pxr::HdPrimvarDescriptorVector primvars;
@ -157,7 +157,7 @@ pxr::HdPrimvarDescriptorVector MeshData::get_primvar_descriptors(
return primvars; return primvars;
} }
pxr::SdfPath MeshData::get_material_id() pxr::SdfPath MeshData::material_id()
{ {
if (!mat_data_) { if (!mat_data_) {
return pxr::SdfPath(); return pxr::SdfPath();
@ -216,11 +216,11 @@ void MeshData::write_material()
mat_data_ = nullptr; mat_data_ = nullptr;
return; return;
} }
pxr::SdfPath id = MaterialData::get_prim_id(scene_delegate_, mat); pxr::SdfPath id = MaterialData::prim_id(scene_delegate_, mat);
mat_data_ = scene_delegate_->get_material_data(id); mat_data_ = scene_delegate_->material_data(id);
if (!mat_data_) { if (!mat_data_) {
scene_delegate_->materials_[id] = MaterialData::create(scene_delegate_, mat); scene_delegate_->materials_[id] = MaterialData::create(scene_delegate_, mat);
mat_data_ = scene_delegate_->get_material_data(id); mat_data_ = scene_delegate_->material_data(id);
} }
} }

View File

@ -25,9 +25,9 @@ class MeshData : public ObjectData {
pxr::VtValue get_data(pxr::TfToken const &key) const override; pxr::VtValue get_data(pxr::TfToken const &key) const override;
bool update_visibility(View3D *view3d) override; bool update_visibility(View3D *view3d) override;
pxr::HdMeshTopology get_mesh_topology(); pxr::HdMeshTopology mesh_topology();
pxr::HdPrimvarDescriptorVector get_primvar_descriptors(pxr::HdInterpolation interpolation); pxr::HdPrimvarDescriptorVector primvar_descriptors(pxr::HdInterpolation interpolation);
pxr::SdfPath get_material_id(); pxr::SdfPath material_id();
protected: protected:
void write_mesh(Mesh *mesh); void write_mesh(Mesh *mesh);

View File

@ -14,7 +14,7 @@ namespace blender::render::hydra {
ObjectData::ObjectData(BlenderSceneDelegate *scene_delegate, Object *object) ObjectData::ObjectData(BlenderSceneDelegate *scene_delegate, Object *object)
: IdData(scene_delegate, (ID *)object), visible(true) : IdData(scene_delegate, (ID *)object), visible(true)
{ {
p_id_ = get_prim_id(scene_delegate, object); p_id_ = prim_id(scene_delegate, object);
} }
bool ObjectData::is_supported(Object *object) bool ObjectData::is_supported(Object *object)
@ -62,7 +62,7 @@ std::unique_ptr<ObjectData> ObjectData::create(BlenderSceneDelegate *scene_deleg
return data; return data;
} }
pxr::SdfPath ObjectData::get_prim_id(BlenderSceneDelegate *scene_delegate, Object *object) pxr::SdfPath ObjectData::prim_id(BlenderSceneDelegate *scene_delegate, Object *object)
{ {
/* Making id of object in form like O_<pointer in 16 hex digits format>. Example: /* Making id of object in form like O_<pointer in 16 hex digits format>. Example:
* O_000002073e369608 */ * O_000002073e369608 */
@ -71,7 +71,7 @@ pxr::SdfPath ObjectData::get_prim_id(BlenderSceneDelegate *scene_delegate, Objec
return scene_delegate->GetDelegateID().AppendElementString(str); return scene_delegate->GetDelegateID().AppendElementString(str);
} }
pxr::GfMatrix4d ObjectData::get_transform() pxr::GfMatrix4d ObjectData::transform()
{ {
return gf_matrix_from_transform(((Object *)id_)->object_to_world); return gf_matrix_from_transform(((Object *)id_)->object_to_world);
} }

View File

@ -20,9 +20,9 @@ class ObjectData : public IdData {
static bool is_supported(Object *object); static bool is_supported(Object *object);
static std::unique_ptr<ObjectData> create(BlenderSceneDelegate *scene_delegate, Object *object); static std::unique_ptr<ObjectData> create(BlenderSceneDelegate *scene_delegate, Object *object);
static pxr::SdfPath get_prim_id(BlenderSceneDelegate *scene_delegate, Object *object); static pxr::SdfPath prim_id(BlenderSceneDelegate *scene_delegate, Object *object);
virtual pxr::GfMatrix4d get_transform(); virtual pxr::GfMatrix4d transform();
virtual bool update_visibility(View3D *view3d); virtual bool update_visibility(View3D *view3d);
bool visible; bool visible;

View File

@ -31,7 +31,7 @@ namespace blender::render::hydra {
WorldData::WorldData(BlenderSceneDelegate *scene_delegate, World *world, bContext *context) WorldData::WorldData(BlenderSceneDelegate *scene_delegate, World *world, bContext *context)
: IdData(scene_delegate, (ID *)world), context_(context) : IdData(scene_delegate, (ID *)world), context_(context)
{ {
p_id_ = get_prim_id(scene_delegate); p_id_ = prim_id(scene_delegate);
CLOG_INFO(LOG_BSD, 2, "%s, id=%s", id_->name, p_id_.GetText()); CLOG_INFO(LOG_BSD, 2, "%s, id=%s", id_->name, p_id_.GetText());
} }
@ -45,7 +45,7 @@ std::unique_ptr<WorldData> WorldData::create(BlenderSceneDelegate *scene_delegat
return data; return data;
} }
pxr::SdfPath WorldData::get_prim_id(BlenderSceneDelegate *scene_delegate) pxr::SdfPath WorldData::prim_id(BlenderSceneDelegate *scene_delegate)
{ {
return scene_delegate->GetDelegateID().AppendElementString("World"); return scene_delegate->GetDelegateID().AppendElementString("World");
} }
@ -150,7 +150,7 @@ void WorldData::update(World *world)
update(); update();
} }
pxr::GfMatrix4d WorldData::get_transform() pxr::GfMatrix4d WorldData::transform()
{ {
pxr::GfMatrix4d transform = pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(1.0, 0.0, 0.0), -90), pxr::GfMatrix4d transform = pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(1.0, 0.0, 0.0), -90),
pxr::GfVec3d()); pxr::GfVec3d());

View File

@ -25,7 +25,7 @@ class WorldData : public IdData {
static std::unique_ptr<WorldData> create(BlenderSceneDelegate *scene_delegate, static std::unique_ptr<WorldData> create(BlenderSceneDelegate *scene_delegate,
World *world, World *world,
bContext *context); bContext *context);
static pxr::SdfPath get_prim_id(BlenderSceneDelegate *scene_delegate); static pxr::SdfPath prim_id(BlenderSceneDelegate *scene_delegate);
void init() override; void init() override;
void insert() override; void insert() override;
@ -33,7 +33,7 @@ class WorldData : public IdData {
void update() override; void update() override;
void update(World *world); void update(World *world);
pxr::GfMatrix4d get_transform(); pxr::GfMatrix4d transform();
pxr::VtValue get_data(pxr::TfToken const &key) const override; pxr::VtValue get_data(pxr::TfToken const &key) const override;
private: private: