HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
skeletonResolvingSceneIndex.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_USD_IMAGING_USD_SKEL_IMAGING_SKELETON_RESOLVING_SCENE_INDEX_H
8 #define PXR_USD_IMAGING_USD_SKEL_IMAGING_SKELETON_RESOLVING_SCENE_INDEX_H
9 
11 
13 
15 
17 
18 /// \class UsdSkelImagingSkeletonResolvingSceneIndex
19 ///
20 /// For each skeleton prim in the input scene index, populate the
21 /// UsdSkelImagingResolvedSkeletonSchema. It also changes the prim type
22 /// to mesh and populates the necessary data for the mesh to serve as guide.
23 ///
26 {
27 public:
29  static
30  UsdSkelImagingSkeletonResolvingSceneIndexRefPtr
31  New(HdSceneIndexBaseRefPtr const &inputSceneIndex);
32 
34  HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
35 
37  SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
38 
39 protected:
40  void _PrimsAdded(
41  const HdSceneIndexBase&,
42  const HdSceneIndexObserver::AddedPrimEntries &entries) override;
43  void _PrimsDirtied(
44  const HdSceneIndexBase&,
45  const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
46  void _PrimsRemoved(
47  const HdSceneIndexBase&,
48  const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
49 
50 private:
52  HdSceneIndexBaseRefPtr const &inputSceneIndex);
53 
54  // Helper to process dirtied prim entries.
55  void _ProcessDirtyLocators(
56  const SdfPath &skelPath,
57  const TfToken &dirtiedPrimType,
58  const HdDataSourceLocatorSet &dirtyLocators,
60 
61  // Prim data source returned by this scene index for a skeleton prim.
62  using _DsHandle =
63  std::shared_ptr<class UsdSkelImagingDataSourceResolvedSkeletonPrim>;
64 
65  // See whether prim at path is a skeleton. If yes, add the resolved
66  // skeleton data source to internal data structures including its
67  /// dependencies - and return true.
68  bool _AddResolvedSkeleton(
69  const SdfPath &path);
70  // Add dependencies for skeleton at given path with given data source.
71  void _AddDependenciesForResolvedSkeleton(
72  const SdfPath &skeletonPath,
73  _DsHandle const &resolvedSkeleton);
74 
75  // See whether there was a skeleton registered at given path. If yes,
76  // remove it including its dependencies - and return true.
77  bool _RemoveResolvedSkeleton(
78  const SdfPath &path);
79  // Remove dependencies.
80  void _RemoveDependenciesForResolvedSkeleton(
81  const SdfPath &skeletonPath,
82  _DsHandle const &resolvedSkeleton);
83 
84  // Refreshes data source without updating dependencies.
85  //
86  // Note that this repulls the data sources from the dependencies
87  // but does not update the paths we depend on.
88  //
89  void _RefreshResolvedSkeletonDataSource(
90  const SdfPath &skeletonPath);
91 
92  // For each skeleton in input scene, the resolved data source.
93  // The scene index overlays it with the input data source.
94  std::map<SdfPath, _DsHandle> _pathToResolvedSkeleton;
95  // Prims targeted as animation by skeletons to skeletons.
96  std::map<SdfPath, SdfPathSet> _skelAnimPathToSkeletonPaths;
97 };
98 
100 
101 #endif
void _PrimsAdded(const HdSceneIndexBase &, const HdSceneIndexObserver::AddedPrimEntries &entries) override
USDSKELIMAGING_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
void _PrimsDirtied(const HdSceneIndexBase &, const HdSceneIndexObserver::DirtiedPrimEntries &entries) override
Definition: token.h:70
std::vector< class SdfPath > SdfPathVector
Definition: path.h:273
void _PrimsRemoved(const HdSceneIndexBase &, const HdSceneIndexObserver::RemovedPrimEntries &entries) override
#define USDSKELIMAGING_API
Definition: api.h:23
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
USDSKELIMAGING_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_REF_PTRS(UsdSkelImagingSkeletonResolvingSceneIndex)
static USDSKELIMAGING_API UsdSkelImagingSkeletonResolvingSceneIndexRefPtr New(HdSceneIndexBaseRefPtr const &inputSceneIndex)