PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6.04k stars 1.2k forks source link

UsdGeomMesh has no member "GetPrimvar" #3149

Closed msf567 closed 1 month ago

msf567 commented 3 months ago

VtArray<GfVec2f> uvs;
auto uvAttr = mesh.GetPrimvar(TfToken("primvars:st")).GetAttr();

'GetPrimvar': is not a member of 'pxrInternal_v0_24__pxrReserved__::UsdGeomMesh'    

This is not properly linking against the method defined on line 202 of primvarAPI.h

The file is definitely included in my headers.

Interestingly, if I pull the function itself via UsdGeomPrimvarsAPI::GetPrimvar(), the compiler will recognize the function but of course will complain because it is not a static function.

What is going on?

How can I pull the UVs from a UseGeomMesh?

asluk commented 3 months ago

The API was deprecated in v19.05 and removed in v22.08 --

https://github.com/PixarAnimationStudios/OpenUSD/blob/v22.08/CHANGELOG.md#usd

"Removed Primvar API on UsdGeomImageable which was deprecated in v19.03. All remaining uses of this API have been updated to use UsdGeomPrimvarsAPI."

Here is an example of the new API--

https://docs.omniverse.nvidia.com/kit/docs/kit-manual/105.1/guide/migration.html#usdgeom-imageable

PXR_NS::UsdStageRefPtr stage = PXR_NS::UsdStage::Open(boxUrl); PXR_NS::UsdPrim prim = stage->GetPrimAtPath(PXR_NS::SdfPath(“/Cube”)); PXR_NS::UsdGeomPrimvarsAPI primvarsAPI(prim); primvarsAPI.HasPrimvar(name); primvarsAPI.GetPrimvar(name); primvarsAPI.CreatePrimvar(name, PXR_NS::SdfValueTypeNames->Float);

jesschimein commented 2 months ago

Filed as internal issue #USD-9830

nvmkuruc commented 1 month ago

@jesschimein @asluk I'm wondering if this should be closed as not a bug.

jesschimein commented 1 month ago

See @asluk's helpful explanation for this question!