forked from blender/blender
Support instancing for other objects: curves and volumes #74
@ -53,7 +53,7 @@ pxr::GfMatrix4d BlenderSceneDelegate::GetTransform(pxr::SdfPath const &id)
|
|||||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", id.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||||
InstancerData *i_data = instancer_data(id, true);
|
InstancerData *i_data = instancer_data(id, true);
|
||||||
if (i_data) {
|
if (i_data) {
|
||||||
return i_data->get_transform(id);
|
return i_data->transform(id);
|
||||||
}
|
}
|
||||||
ObjectData *obj_data = object_data(id);
|
ObjectData *obj_data = object_data(id);
|
||||||
if (obj_data) {
|
if (obj_data) {
|
||||||
@ -161,12 +161,10 @@ pxr::HdCullStyle BlenderSceneDelegate::GetCullStyle(pxr::SdfPath const &id)
|
|||||||
pxr::SdfPath BlenderSceneDelegate::GetInstancerId(pxr::SdfPath const &prim_id)
|
pxr::SdfPath BlenderSceneDelegate::GetInstancerId(pxr::SdfPath const &prim_id)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", prim_id.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", prim_id.GetText());
|
||||||
if (mesh_data(prim_id)) {
|
|
||||||
InstancerData *i_data = instancer_data(prim_id, true);
|
InstancerData *i_data = instancer_data(prim_id, true);
|
||||||
if (i_data) {
|
if (i_data && mesh_data(prim_id)) {
|
||||||
return i_data->prim_id;
|
return i_data->prim_id;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return pxr::SdfPath();
|
return pxr::SdfPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +187,7 @@ pxr::GfMatrix4d BlenderSceneDelegate::GetInstancerTransform(pxr::SdfPath const &
|
|||||||
{
|
{
|
||||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", instancer_id.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", instancer_id.GetText());
|
||||||
InstancerData *i_data = instancer_data(instancer_id);
|
InstancerData *i_data = instancer_data(instancer_id);
|
||||||
return i_data->get_transform(instancer_id);
|
return i_data->transform(instancer_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
pxr::HdVolumeFieldDescriptorVector BlenderSceneDelegate::GetVolumeFieldDescriptors(
|
pxr::HdVolumeFieldDescriptorVector BlenderSceneDelegate::GetVolumeFieldDescriptors(
|
||||||
|
@ -49,7 +49,7 @@ pxr::VtValue InstancerData::get_data(pxr::TfToken const &key) const
|
|||||||
return pxr::VtValue();
|
return pxr::VtValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
pxr::GfMatrix4d InstancerData::get_transform(pxr::SdfPath const &id) const
|
pxr::GfMatrix4d InstancerData::transform(pxr::SdfPath const &id) const
|
||||||
{
|
{
|
||||||
NonmeshInstance *nm_inst = nonmesh_instance(id);
|
NonmeshInstance *nm_inst = nonmesh_instance(id);
|
||||||
if (nm_inst) {
|
if (nm_inst) {
|
||||||
@ -207,14 +207,14 @@ pxr::SdfPath InstancerData::object_prim_id(Object *object) const
|
|||||||
pxr::SdfPath InstancerData::nonmesh_prim_id(pxr::SdfPath const &prim_id, int index) const
|
pxr::SdfPath InstancerData::nonmesh_prim_id(pxr::SdfPath const &prim_id, int index) const
|
||||||
{
|
{
|
||||||
char name[16];
|
char name[16];
|
||||||
snprintf(name, sizeof(name), "L_%08x", index);
|
snprintf(name, sizeof(name), "NM_%08x", index);
|
||||||
return prim_id.AppendElementString(name);
|
return prim_id.AppendElementString(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InstancerData::nonmesh_prim_id_index(pxr::SdfPath const &id) const
|
int InstancerData::nonmesh_prim_id_index(pxr::SdfPath const &id) const
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
sscanf(id.GetName().c_str(), "L_%x", &index);
|
sscanf(id.GetName().c_str(), "NM_%x", &index);
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class InstancerData : public IdData {
|
|||||||
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(pxr::SdfPath const &id) const;
|
pxr::GfMatrix4d transform(pxr::SdfPath const &id) const;
|
||||||
pxr::HdPrimvarDescriptorVector primvar_descriptors(pxr::HdInterpolation interpolation) const;
|
pxr::HdPrimvarDescriptorVector primvar_descriptors(pxr::HdInterpolation interpolation) const;
|
||||||
pxr::VtIntArray indices(pxr::SdfPath const &id) const;
|
pxr::VtIntArray indices(pxr::SdfPath const &id) const;
|
||||||
ObjectData *object_data(pxr::SdfPath const &id) const;
|
ObjectData *object_data(pxr::SdfPath const &id) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user