24 #ifndef PXR_USD_PCP_CACHE_H
25 #define PXR_USD_PCP_CACHE_H
46 #include <unordered_set>
54 class Pcp_Dependencies;
135 return layerStack == _layerStack;
170 using PayloadSet = std::unordered_set<SdfPath, SdfPath::Hash>;
223 const std::vector<std::string>& layersToUnmute,
225 std::vector<std::string>* newLayersMuted =
nullptr,
226 std::vector<std::string>* newLayersUnmuted =
316 template <
class ChildrenPredicate,
class PayloadPredicate>
319 const ChildrenPredicate &childrenPred,
320 const PayloadPredicate &payloadPred) {
322 childrenPred, payloadPred,
323 "Pcp",
"ComputePrimIndexesInParallel");
329 template <
class ChildrenPredicate,
class PayloadPredicate>
332 const ChildrenPredicate &childrenPred,
333 const PayloadPredicate &payloadPred,
334 const char *mallocTag1,
335 const char *mallocTag2) {
337 childrenPred, payloadPred,
338 mallocTag1, mallocTag2);
343 template <
class ChildrenPredicate,
class PayloadPredicate>
346 const ChildrenPredicate &childrenPred,
347 const PayloadPredicate &payloadPred) {
348 _UntypedIndexingChildrenPredicate cp(&childrenPred);
349 _UntypedIndexingPayloadPredicate pp(&payloadPred);
350 _ComputePrimIndexesInParallel(paths, allErrors, cp, pp,
351 "Pcp",
"ComputePrimIndexesInParallel");
357 template <
class ChildrenPredicate,
class PayloadPredicate>
360 const ChildrenPredicate &childrenPred,
361 const PayloadPredicate &payloadPred,
362 const char *mallocTag1,
363 const char *mallocTag2) {
364 _UntypedIndexingChildrenPredicate cp(&childrenPred);
365 _UntypedIndexingPayloadPredicate pp(&payloadPred);
366 _ComputePrimIndexesInParallel(paths, allErrors, cp, pp,
367 mallocTag1, mallocTag2);
378 template <
class Callback>
383 _ForEachPrimIndex(fn);
413 const SdfSpecHandle &stopProperty,
414 bool includeStopProperty,
432 const SdfSpecHandle &stopProperty,
433 bool includeStopProperty,
459 const PcpLayerStackPtrVector&
465 template <
class Callback>
470 _ForEachLayerStack(fn);
493 bool filterForExistingCachesOnly)
const;
511 bool filterForExistingCachesOnly)
const;
523 const SdfLayerHandle&
layer,
524 SdfPath* allowedPathInLayer)
const;
572 const TfToken &attributeName)
const;
581 const SdfPath &primIndexPath)
const;
587 const PcpLayerStackPtr &layerStack)
const;
592 const std::unordered_set<std::string>&
595 const PcpLayerStackPtr &layerStack)
const;
663 struct _ParallelIndexer;
678 struct _UntypedIndexingChildrenPredicate {
679 _UntypedIndexingChildrenPredicate() : pred(nullptr),
invoke(nullptr) {}
680 template <
class Pred>
681 explicit _UntypedIndexingChildrenPredicate(
const Pred *pred)
682 : pred(pred),
invoke(_Invoke<Pred>) {}
686 return invoke(pred, index, childNamesToCompose);
689 template <
class Pred>
692 return (*static_cast<const Pred *>(pred))(
index, namesToCompose);
700 struct _UntypedIndexingPayloadPredicate {
701 template <
class Pred>
702 explicit _UntypedIndexingPayloadPredicate(
const Pred *pred)
703 : pred(pred),
invoke(_Invoke<Pred>) {}
705 inline bool operator()(
const SdfPath &
path)
const {
706 return invoke(pred, path);
709 template <
class Pred>
710 static bool _Invoke(
const void *pred,
const SdfPath &
path) {
711 return (*static_cast<const Pred *>(pred))(
path);
719 _ComputePrimIndexWithCompatibleInputs(
732 void _ComputePrimIndexesInParallel(
735 _UntypedIndexingChildrenPredicate childrenPred,
736 _UntypedIndexingPayloadPredicate payloadPred,
737 const char *mallocTag1,
738 const char *mallocTag2);
741 void _RemovePrimAndPropertyCaches(
const SdfPath& root,
755 void _ForEachPrimIndex(
759 void _ForEachLayerStack(
760 const TfFunctionRef<
void(
const PcpLayerStackPtr&)>& fn)
const;
784 PcpLayerStackRefPtr _layerStack;
793 typedef Pcp_LayerStackRegistryRefPtr _LayerStackCache;
798 _LayerStackCache _layerStackCache;
799 _PrimIndexCache _primIndexCache;
800 _PropertyIndexCache _propertyIndexCache;
801 std::unique_ptr<Pcp_Dependencies> _primDependencies;
804 std::unique_ptr<_ParallelIndexer> _parallelIndexer;
809 #endif // PXR_USD_PCP_CACHE_H
PCP_API bool CanHaveOpinionForSite(const SdfPath &localPcpSitePath, const SdfLayerHandle &layer, SdfPath *allowedPathInLayer) const
std::vector< PcpDependency > PcpDependencyVector
void ComputePrimIndexesInParallel(const SdfPathVector &paths, PcpErrorVector *allErrors, const ChildrenPredicate &childrenPred, const PayloadPredicate &payloadPred)
PCP_API bool IsPayloadIncluded(const SdfPath &path) const
Return true if the payload is included for the given path.
PCP_API void Reload(PcpChanges *changes)
PCP_API bool IsLayerMuted(const std::string &layerIdentifier) const
PCP_API bool HasAnyDynamicFileFormatArgumentFieldDependencies() const
PCP_API const PcpPropertyIndex & ComputePropertyIndex(const SdfPath &propPath, PcpErrorVector *allErrors)
GLsizei const GLchar *const * string
GLsizei const GLchar *const * path
PCP_API const std::string & GetFileFormatTarget() const
Returns the file format target this cache is configured for.
PCP_API PcpDependencyVector FindSiteDependencies(const PcpLayerStackPtr &siteLayerStack, const SdfPath &sitePath, PcpDependencyFlags depMask, bool recurseOnSite, bool recurseOnIndex, bool filterForExistingCachesOnly) const
PCP_API SdfLayerHandleSet GetUsedRootLayers() const
Returns set of all root layers used by this cache.
std::set< SdfHandleTo< SdfLayer >::Handle > SdfLayerHandleSet
PCP_API bool IsUsd() const
Return true if the cache is configured in Usd mode.
PCP_API bool HasAnyDynamicFileFormatArgumentAttributeDependencies() const
PCP_API const std::vector< std::string > & GetMutedLayers() const
PCP_API const PcpPrimIndex & ComputePrimIndex(const SdfPath &primPath, PcpErrorVector *allErrors)
PCP_API std::vector< std::string > GetInvalidSublayerIdentifiers() const
void ComputePrimIndexesInParallel(const SdfPath &path, PcpErrorVector *allErrors, const ChildrenPredicate &childrenPred, const PayloadPredicate &payloadPred, const char *mallocTag1, const char *mallocTag2)
PCP_API const PcpDynamicFileFormatDependencyData & GetDynamicFileFormatArgumentDependencyData(const SdfPath &primIndexPath) const
GLenum GLuint GLint GLint layer
PCP_API bool IsInvalidAssetPath(const std::string &resolvedAssetPath) const
friend const PcpPrimIndex & Pcp_ComputePrimIndexWithCompatibleInputs(PcpCache &cache, const SdfPath &path, const PcpPrimIndexInputs &inputs, PcpErrorVector *allErrors)
void ComputePrimIndexesInParallel(const SdfPathVector &paths, PcpErrorVector *allErrors, const ChildrenPredicate &childrenPred, const PayloadPredicate &payloadPred, const char *mallocTag1, const char *mallocTag2)
PCP_API const SdfPathVector & GetPrimsUsingExpressionVariablesFromLayerStack(const PcpLayerStackPtr &layerStack) const
PCP_API void ComputeAttributeConnectionPaths(const SdfPath &attributePath, SdfPathVector *paths, bool localOnly, const SdfSpecHandle &stopProperty, bool includeStopProperty, SdfPathVector *deletedPaths, PcpErrorVector *allErrors)
PCP_API const PcpPropertyIndex * FindPropertyIndex(const SdfPath &propPath) const
PCP_API size_t GetUsedLayersRevision() const
PCP_API void Apply(const PcpCacheChanges &changes, PcpLifeboat *lifeboat)
std::unordered_set< SdfPath, SdfPath::Hash > PayloadSet
Returns the payloads requested for inclusion.
PCP_API PcpLayerStackRefPtr ComputeLayerStack(const PcpLayerStackIdentifier &identifier, PcpErrorVector *allErrors)
PCP_API void RequestPayloads(const SdfPathSet &pathsToInclude, const SdfPathSet &pathsToExclude, PcpChanges *changes=NULL)
std::vector< TfToken > TfTokenVector
Convenience types.
PCP_API void ReloadReferences(PcpChanges *changes, const SdfPath &primPath)
friend class Pcp_Statistics
PCP_API const PcpLayerStackPtrVector & FindAllLayerStacksUsingLayer(const SdfLayerHandle &layer) const
Returns every computed & cached layer stack that includes layer.
PCP_API bool IsInvalidSublayerIdentifier(const std::string &identifier) const
SDF_DECLARE_HANDLES(SdfSpec)
PCP_API PcpLayerStackPtr GetLayerStack() const
PCP_API const std::unordered_set< std::string > & GetExpressionVariablesFromLayerStackUsedByPrim(const SdfPath &primIndexPath, const PcpLayerStackPtr &layerStack) const
PCP_API PcpLayerStackPtr FindLayerStack(const PcpLayerStackIdentifier &identifier) const
std::vector< class SdfPath > SdfPathVector
A vector of SdfPaths.
std::vector< PcpErrorBasePtr > PcpErrorVector
PCP_API const PcpPrimIndex * FindPrimIndex(const SdfPath &primPath) const
PCP_API void SetVariantFallbacks(const PcpVariantFallbackMap &map, PcpChanges *changes=NULL)
std::set< class SdfPath > SdfPathSet
A set of SdfPaths.
PCP_API std::map< SdfPath, std::vector< std::string >, SdfPath::FastLessThan > GetInvalidAssetPaths() const
friend class Pcp_Dependencies
TF_DECLARE_WEAK_AND_REF_PTRS(PcpLayerStack)
void ForEachPrimIndex(const Callback &callback) const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
PCP_API PcpVariantFallbackMap GetVariantFallbacks() const
PCP_API SdfLayerHandleSet GetUsedLayers() const
Returns set of all layers used by this cache.
bool HasRootLayerStack(PcpLayerStackRefPtr const &layerStack) const
#define PXR_NAMESPACE_CLOSE_SCOPE
PCP_API PcpPrimIndexInputs GetPrimIndexInputs()
PCP_API const PcpLayerStackIdentifier & GetLayerStackIdentifier() const
Get the identifier of the layerStack used for composition.
PCP_API bool IsPossibleDynamicFileFormatArgumentField(const TfToken &field) const
void ComputePrimIndexesInParallel(const SdfPath &path, PcpErrorVector *allErrors, const ChildrenPredicate &childrenPred, const PayloadPredicate &payloadPred)
PCP_API void RequestLayerMuting(const std::vector< std::string > &layersToMute, const std::vector< std::string > &layersToUnmute, PcpChanges *changes=nullptr, std::vector< std::string > *newLayersMuted=nullptr, std::vector< std::string > *newLayersUnmuted=nullptr)
void ForEachLayerStack(const Callback &callback) const
PCP_API void ComputeRelationshipTargetPaths(const SdfPath &relationshipPath, SdfPathVector *paths, bool localOnly, const SdfSpecHandle &stopProperty, bool includeStopProperty, SdfPathVector *deletedPaths, PcpErrorVector *allErrors)
PCP_API bool IsPossibleDynamicFileFormatArgumentAttribute(const TfToken &attributeName) const
PCP_API PayloadSet const & GetIncludedPayloads() const
Returns the payloads requested for inclusion.
unsigned int PcpDependencyFlags
A typedef for a bitmask of flags from PcpDependencyType.
PCP_API void PrintStatistics() const
Prints various statistics about the data stored in this cache.
std::map< std::string, std::vector< std::string > > PcpVariantFallbackMap
PCP_API bool UsesLayerStack(const PcpLayerStackPtr &layerStack) const
int invoke(const Func &taskFunc1, Rest...taskFuncN)