Loading...
Searching...
No Matches
skeletonResolvingSceneIndex.h
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
10#include "pxr/usdImaging/usdSkelImaging/api.h"
11
12#include "pxr/imaging/hd/filteringSceneIndex.h"
13
14PXR_NAMESPACE_OPEN_SCOPE
15
17
26{
27public:
28 USDSKELIMAGING_API
29 static
30 UsdSkelImagingSkeletonResolvingSceneIndexRefPtr
31 New(HdSceneIndexBaseRefPtr const &inputSceneIndex);
32
33 USDSKELIMAGING_API
34 HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
35
36 USDSKELIMAGING_API
37 SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
38
39protected:
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
50private:
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
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 // Instancer to skeletons it instances that are in a prototype
98 // with skelBinding:hasSkelRoot.
99 std::map<SdfPath, SdfPathSet> _instancerPathToSkeletonPaths;
100};
101
102PXR_NAMESPACE_CLOSE_SCOPE
103
104#endif
Represents a set of data source locators closed under descendancy.
Abstract interface to scene data.
Definition: sceneIndex.h:54
An abstract base class for a filtering scene index that observes a single input scene index.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
For each skeleton prim in the input scene index, populate the UsdSkelImagingResolvedSkeletonSchema.
USDSKELIMAGING_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
Returns the paths of all scene index prims located immediately below primPath.
USDSKELIMAGING_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
Returns a pair of (prim type, datasource).
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
Definition: declarePtrs.h:58
Small struct representing a 'prim' in the Hydra scene index.
Definition: sceneIndex.h:35