Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMichael Kowalski <makowalski@nvidia.com>2022-11-02 21:30:00 +0300
committerMichael Kowalski <makowalski@nvidia.com>2022-11-02 21:30:00 +0300
commitf428fe774bf88bdf56bc86a4df2462739fd482a6 (patch)
tree3d5853a7134f5098a6c3e459cb51b2042c700c78 /source
parent7e0fb88a68c22135200ce9770c03023e050ea974 (diff)
USD import: replace deprecated shape import code.
The static functions GetMeshPoints() and GetTopology() have been removed from the adapter classes in USD 22.11. In anticipation of this change, the code was updated to call the corresponding virtual functions instead. Change authored by Charles Wardlaw.
Diffstat (limited to 'source')
-rw-r--r--source/blender/io/usd/intern/usd_reader_shape.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/io/usd/intern/usd_reader_shape.cc b/source/blender/io/usd/intern/usd_reader_shape.cc
index 3e6170e51c8..7f32c12029d 100644
--- a/source/blender/io/usd/intern/usd_reader_shape.cc
+++ b/source/blender/io/usd/intern/usd_reader_shape.cc
@@ -65,19 +65,30 @@ void USDShapeReader::read_object_data(Main *bmain, double motionSampleTime)
USDXformReader::read_object_data(bmain, motionSampleTime);
}
+
template<typename Adapter>
void USDShapeReader::read_values(const double motionSampleTime,
pxr::VtVec3fArray &positions,
pxr::VtIntArray &face_indices,
pxr::VtIntArray &face_counts)
{
- pxr::VtValue meshPoints = Adapter::GetMeshPoints(prim_, motionSampleTime);
- positions = meshPoints.template Get<pxr::VtArray<pxr::GfVec3f>>();
- pxr::HdMeshTopology meshTopologyValue = Adapter::GetMeshTopology().template Get<pxr::HdMeshTopology>();
- face_counts = meshTopologyValue.GetFaceVertexCounts();
- face_indices = meshTopologyValue.GetFaceVertexIndices();
+ Adapter adapter;
+ pxr::VtValue points_val = adapter.GetPoints(prim_, motionSampleTime);
+
+ if (points_val.template IsHolding<pxr::VtVec3fArray>()) {
+ positions = points_val.template Get<pxr::VtVec3fArray>();
+ }
+
+ pxr::VtValue topology_val = adapter.GetTopology(prim_, pxr::SdfPath(), motionSampleTime);
+
+ if (topology_val.template IsHolding<pxr::HdMeshTopology>()) {
+ const pxr::HdMeshTopology &topology = topology_val.template Get<pxr::HdMeshTopology>();
+ face_counts = topology.GetFaceVertexCounts();
+ face_indices = topology.GetFaceVertexIndices();
+ }
}
+
struct Mesh *USDShapeReader::read_mesh(struct Mesh *existing_mesh,
double motionSampleTime,
int /* read_flag */,