7 #ifndef PXR_USD_PCP_CACHE_H
8 #define PXR_USD_PCP_CACHE_H
29 #include <unordered_set>
37 class Pcp_Dependencies;
93 const std::string& fileFormatTarget = std::string(),
118 return layerStack == _layerStack;
153 using PayloadSet = std::unordered_set<SdfPath, SdfPath::Hash>;
206 const std::vector<std::string>& layersToUnmute,
208 std::vector<std::string>* newLayersMuted =
nullptr,
209 std::vector<std::string>* newLayersUnmuted =
224 bool IsLayerMuted(
const std::string& layerIdentifier)
const;
235 const std::string& layerIdentifier,
236 std::string* canonicalMutedLayerIdentifier
304 template <
class ChildrenPredicate,
class PayloadPredicate>
307 const ChildrenPredicate &childrenPred,
308 const PayloadPredicate &payloadPred) {
310 childrenPred, payloadPred,
311 "Pcp",
"ComputePrimIndexesInParallel");
317 template <
class ChildrenPredicate,
class PayloadPredicate>
320 const ChildrenPredicate &childrenPred,
321 const PayloadPredicate &payloadPred,
322 const char *mallocTag1,
323 const char *mallocTag2) {
325 childrenPred, payloadPred,
326 mallocTag1, mallocTag2);
331 template <
class ChildrenPredicate,
class PayloadPredicate>
334 const ChildrenPredicate &childrenPred,
335 const PayloadPredicate &payloadPred) {
336 _UntypedIndexingChildrenPredicate cp(&childrenPred);
337 _UntypedIndexingPayloadPredicate pp(&payloadPred);
338 _ComputePrimIndexesInParallel(paths, allErrors, cp, pp,
339 "Pcp",
"ComputePrimIndexesInParallel");
345 template <
class ChildrenPredicate,
class PayloadPredicate>
348 const ChildrenPredicate &childrenPred,
349 const PayloadPredicate &payloadPred,
350 const char *mallocTag1,
351 const char *mallocTag2) {
352 _UntypedIndexingChildrenPredicate cp(&childrenPred);
353 _UntypedIndexingPayloadPredicate pp(&payloadPred);
354 _ComputePrimIndexesInParallel(paths, allErrors, cp, pp,
355 mallocTag1, mallocTag2);
366 template <
class Callback>
371 _ForEachPrimIndex(fn);
401 const SdfSpecHandle &stopProperty,
402 bool includeStopProperty,
420 const SdfSpecHandle &stopProperty,
421 bool includeStopProperty,
447 const PcpLayerStackPtrVector&
453 template <
class Callback>
458 _ForEachLayerStack(fn);
481 bool filterForExistingCachesOnly)
const;
499 bool filterForExistingCachesOnly)
const;
511 const SdfLayerHandle&
layer,
512 SdfPath* allowedPathInLayer)
const;
560 const TfToken &attributeName)
const;
569 const SdfPath &primIndexPath)
const;
575 const PcpLayerStackPtr &layerStack)
const;
580 const std::unordered_set<std::string>&
583 const PcpLayerStackPtr &layerStack)
const;
651 struct _ParallelIndexer;
666 struct _UntypedIndexingChildrenPredicate {
667 _UntypedIndexingChildrenPredicate() : pred(nullptr),
invoke(nullptr) {}
668 template <
class Pred>
669 explicit _UntypedIndexingChildrenPredicate(
const Pred *pred)
670 : pred(pred),
invoke(_Invoke<Pred>) {}
674 return invoke(pred, index, childNamesToCompose);
677 template <
class Pred>
680 return (*static_cast<const Pred *>(pred))(
index, namesToCompose);
688 struct _UntypedIndexingPayloadPredicate {
689 template <
class Pred>
690 explicit _UntypedIndexingPayloadPredicate(
const Pred *pred)
691 : pred(pred),
invoke(_Invoke<Pred>) {}
693 inline bool operator()(
const SdfPath &
path)
const {
694 return invoke(pred, path);
697 template <
class Pred>
698 static bool _Invoke(
const void *pred,
const SdfPath &
path) {
699 return (*static_cast<const Pred *>(pred))(
path);
707 _ComputePrimIndexWithCompatibleInputs(
720 void _ComputePrimIndexesInParallel(
723 _UntypedIndexingChildrenPredicate childrenPred,
724 _UntypedIndexingPayloadPredicate payloadPred,
725 const char *mallocTag1,
726 const char *mallocTag2);
729 void _RemovePrimAndPropertyCaches(
const SdfPath& root,
743 void _ForEachPrimIndex(
747 void _ForEachLayerStack(
748 const TfFunctionRef<
void(
const PcpLayerStackPtr&)>& fn)
const;
767 const std::string _fileFormatTarget;
772 PcpLayerStackRefPtr _layerStack;
785 typedef Pcp_LayerStackRegistryRefPtr _LayerStackCache;
790 _LayerStackCache _layerStackCache;
791 _PrimIndexCache _primIndexCache;
792 _PropertyIndexCache _propertyIndexCache;
793 std::unique_ptr<Pcp_Dependencies> _primDependencies;
796 std::unique_ptr<_ParallelIndexer> _parallelIndexer;
801 #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 * 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
std::vector< class SdfPath > SdfPathVector
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
PCP_API const PcpPrimIndexInputs & GetPrimIndexInputs() const
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 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)