Hello everyone,
Everytime I am debugging USD code in C++ I struggle to see the value of SdfPath variables which are everyone.
Is there any plugin or trick to be able to see the value in the Watch window in the Visual Studio Debugger?
That PR is slightly outdated with 24.05 I think - at least for the Usd_PrimDataHandle which should be changed to the following since Boost was removed:
But more sadly, I haven’t found a way to make that PR work with the build of USD I have locally. The .natvis wants to access usd_sdf.dll which doesn’t exist in my build, and replacing it with the binary that does exist still results in errors.
Edit the file and change usd_sdf.dll to the actual name of the Sdf library you have in your bin folder. The cmake options allows adding a prefix to all DLL names and it looks like the team that provided you with that NatViz file uses “usd_” as prefix in their build pipeline.
Ideally that file should be generated by the build process in order to have the correct namespace and DLL prefix always present.
I’ve already tried to use our usd_ms.dll there. I get the following 3 errors:
Natvis: C:\Users\jesse\Documents\Visual Studio 2022\Visualizers\USD-24.natvis(212,6): Error: identifier "pxrInternal_v0_24__pxrReserved__" is undefined
Error while evaluating 'usd_ms.dll!pxrInternal_v0_24__pxrReserved__::Sdf_Pool<pxrInternal_v0_24__pxrReserved__::Sdf_PathPrimTag,24,8,16384>::_regionStarts[GetRegion()] + (GetIndex() * 24)' in the context of type 'blender.exe!pxrInternal_v0_24__pxrReserved__::Sdf_Pool<pxrInternal_v0_24__pxrReserved__::Sdf_PathPrimTag,24,8,16384>::Handle'.
Natvis: C:\Users\jesse\Documents\Visual Studio 2022\Visualizers\USD-24.natvis(213,6): Error: Side effects are not supported in this context.
Error while evaluating '(pxrInternal_v0_24__pxrReserved__::Sdf_PathNode*)GetPtr()' in the context of type 'blender.exe!pxrInternal_v0_24__pxrReserved__::Sdf_Pool<pxrInternal_v0_24__pxrReserved__::Sdf_PathPrimTag,24,8,16384>::Handle'.
Natvis: C:\Users\jesse\Documents\Visual Studio 2022\Visualizers\USD-24.natvis(214,6): Error: identifier "GetPathNode" is undefined
Error while evaluating '(pxrInternal_v0_24__pxrReserved__::Sdf_PathNode::NodeType)GetPathNode()->_nodeType' in the context of type 'blender.exe!pxrInternal_v0_24__pxrReserved__::Sdf_Pool<pxrInternal_v0_24__pxrReserved__::Sdf_PathPrimTag,24,8,16384>::Handle'.
The other types seem ok. It’s just the critical one above the prevents all the path/string visualizations from working.
Replacing usd_sdf.dll with usd_ms.dll ist totally fine. But it also requires that your usd_ms.dll comes with debugging information (usd_ms.pdb). I was facing the same problem and that solved it for me.
As mentioned by @deadpin, the change from boost intrusive pointers to TfDelegatedCountPtr requires doing a global search and replace in the .natvis file to change all “.px” into “._pointer”. With that change I can see SdfPath again in the MS debugger. Thanks @deadpin!