This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
parseUtils.h File Reference
+ Include dependency graph for parseUtils.h:

Go to the source code of this file.

Classes

struct  CustomUsdPhysicsTokens
 Token lists for custom physics objects that allow for custom physics objects to be reported by parsing. More...
 

Typedefs

using UsdPhysicsReportFn = std::function< void(UsdPhysicsObjectType type, TfSpan< const SdfPath > primPaths, TfSpan< const UsdPhysicsObjectDesc > objectDescs, const VtValue &userData)>
 UsdPhysicsReportFn - report function that reports parsed data in a batched manner.
 

Functions

USDPHYSICS_API bool LoadUsdPhysicsFromRange (const UsdStageWeakPtr stage, const std::vector< SdfPath > &includePaths, UsdPhysicsReportFn reportFn, const VtValue &userData, const std::vector< SdfPath > *excludePaths=nullptr, const CustomUsdPhysicsTokens *customPhysicsTokens=nullptr, const std::vector< SdfPath > *simulationOwners=nullptr)
 Load USD physics from a given list of paths.
 

Class Documentation

◆ CustomUsdPhysicsTokens

struct CustomUsdPhysicsTokens

Token lists for custom physics objects that allow for custom physics objects to be reported by parsing.

Definition at line 50 of file parseUtils.h.

Class Members
vector< TfToken > instancerTokens Custom physics instancers, these make sure that the subhierarchy is skipped and expected to be parsed individually.
vector< TfToken > jointTokens Custom joints to be reported by parsing.
vector< TfToken > shapeTokens Custom shapes to be reported by parsing.

Typedef Documentation

◆ UsdPhysicsReportFn

using UsdPhysicsReportFn = std::function<void(UsdPhysicsObjectType type, TfSpan<const SdfPath> primPaths, TfSpan<const UsdPhysicsObjectDesc> objectDescs, const VtValue& userData)>

UsdPhysicsReportFn - report function that reports parsed data in a batched manner.

This function is called after all the parsing is done and all the physics descriptors are constructed.

Parameters
[in]typeType of the parsed physics objects
[in]primPathsSpan of prim paths of the reported type
[in]objectDescsCorresponding span of object descriptors of the reported type
[in]userDataUser data provided to the called parsing function

Definition at line 39 of file parseUtils.h.

Function Documentation

◆ LoadUsdPhysicsFromRange()

USDPHYSICS_API bool LoadUsdPhysicsFromRange ( const UsdStageWeakPtr  stage,
const std::vector< SdfPath > &  includePaths,
UsdPhysicsReportFn  reportFn,
const VtValue userData,
const std::vector< SdfPath > *  excludePaths = nullptr,
const CustomUsdPhysicsTokens customPhysicsTokens = nullptr,
const std::vector< SdfPath > *  simulationOwners = nullptr 
)

Load USD physics from a given list of paths.

This helper function traverses the provided USD stage by constructing UsdPrimRanges from given include paths (subhierarchies can be prunes through exclude paths) and returns parsed physics objects through the report function.

See also
UsdPhysicsReportFn

See the parsing utils documentation for more details.

Parameters
[in]stageStage to be traversed and parsed.
[in]includePathsThe vector of SdfPaths that are used to construct UsdPrimRange for traversals. For each path a UsdPrim is found on the stage and UsdRange traversal is constructed from it. All the traversed UsdPrims are parsed and physics descriptors are constructed and reported through the report function.
[in]reportFnReport function that gets parsed USD physics data see
See also
UsdPhysicsReportFn
Parameters
[in]userDataUser data passed to report function, this can be arbitrary data structure, user data acts as a bridge between reportFn and the data structures understood by the Simulator. Implementer of reportFn can use the parsed "objectDesc" to populate these simulator-compatible data structures, which are passed as userData here.
[in]excludePathsThe vector of SdfPaths that are used to prune UsdPrims from the parsing UsdPrimRange traversals constructed from the include paths.
[in]customPhysicsTokensCustom tokens to be reported by the parsing see
See also
CustomUsdPhysicsTokens
Parameters
[in]simulationOwnersList of simulation owners that should be parsed, adding SdfPath() indicates that objects without a simulation owner should be parsed too.
Returns
True if load was successful