24#ifndef PXR_USD_PCP_PRIM_INDEX_H
25#define PXR_USD_PCP_PRIM_INDEX_H
28#include "pxr/usd/pcp/api.h"
30#include "pxr/usd/pcp/dependency.h"
31#include "pxr/usd/pcp/dynamicFileFormatDependencyData.h"
32#include "pxr/usd/pcp/expressionVariablesDependencyData.h"
33#include "pxr/usd/pcp/errors.h"
34#include "pxr/usd/pcp/iterator.h"
35#include "pxr/usd/pcp/node.h"
38#include "pxr/usd/sdf/site.h"
40#include "pxr/base/tf/hashmap.h"
41#include "pxr/base/tf/hashset.h"
43#include <tbb/spin_rw_mutex.h>
48#include <unordered_set>
50PXR_NAMESPACE_OPEN_SCOPE
111 void SetGraph(
const PcpPrimIndex_GraphRefPtr& graph) {
115 const PcpPrimIndex_GraphRefPtr &GetGraph()
const {
162 PcpNodeRange
GetNodeRange(PcpRangeType rangeType = PcpRangeTypeAll)
const;
179 PcpPrimRange
GetPrimRange(PcpRangeType rangeType = PcpRangeTypeAll)
const;
201 const SdfLayerHandle& layer,
const SdfPath& path)
const;
210 return _localErrors ? *_localErrors.get() : PcpErrorVector();
225 bool includeInheritOriginInfo =
true,
226 bool includeMaps =
true)
const;
232 const std::string& filename,
233 bool includeInheritOriginInfo =
true,
234 bool includeMaps =
false)
const;
270 const std::string &variantSet)
const;
276 friend struct Pcp_PrimIndexer;
278 bool updateHasSpecs);
281 PcpPrimIndex_GraphRefPtr _graph;
285 Pcp_CompressedSdSiteVector _primStack;
289 std::unique_ptr<PcpErrorVector> _localErrors;
307 IncludedByIncludeSet, ExcludedByIncludeSet,
308 IncludedByPredicate, ExcludedByPredicate };
341 const PcpArc& arcToParent,
342 PcpErrorBasePtr *error);
353 , variantFallbacks(
nullptr)
354 , includedPayloads(
nullptr)
355 , includedPayloadsMutex(
nullptr)
356 , parentIndex(
nullptr)
368 { cache = cache_;
return *
this; }
373 { variantFallbacks = map;
return *
this; }
377 using PayloadSet = std::unordered_set<SdfPath, SdfPath::Hash>;
379 { includedPayloads = payloadSet;
return *
this; }
383 { includedPayloadsMutex = mutex;
return *
this; }
390 std::function<
bool (
const SdfPath &)> predicate)
391 { includePayloadPredicate = predicate;
return *
this; }
396 { cull = doCulling;
return *
this; }
402 { usd = doUSD;
return *
this; }
407 { fileFormatTarget = target;
return *
this; }
413 tbb::spin_rw_mutex *includedPayloadsMutex;
414 std::function<bool (
const SdfPath &)> includePayloadPredicate;
416 std::string fileFormatTarget;
427 const PcpLayerStackPtr& layerStack,
435PcpIsNewDefaultStandinBehaviorEnabled();
447Pcp_NeedToRecomputeDueToAssetPathChange(
const PcpPrimIndex& index);
449PXR_NAMESPACE_CLOSE_SCOPE
Interface for the asset resolution system.
Represents an arc connecting two nodes in the prim index.
PcpCache is the context required to make requests of the Pcp composition algorithm and cache the resu...
Captures the expression variables used by an associated prim index during composition.
Represents a stack of layers that contribute opinions to composition.
Object used to iterate over nodes in the prim index graph in strong-to-weak order.
PcpNode represents a node in an expression tree for compositing scene description.
PcpPrimIndex is an index of the all sites of scene description that contribute opinions to a specific...
PCP_API bool IsInstanceable() const
Returns true if this prim index is instanceable.
PCP_API std::string DumpToString(bool includeInheritOriginInfo=true, bool includeMaps=true) const
Dump the prim index contents to a string.
PCP_API PcpNodeRange GetNodeSubtreeRange(const PcpNodeRef &node) const
Returns range of iterators that encompass the given node and all of its descendants in strong-to-weak...
PCP_API PcpPrimRange GetPrimRangeForNode(const PcpNodeRef &node) const
Returns range of iterators that encompasses all prims from the site of node.
PcpPrimIndex(PcpPrimIndex &&rhs) noexcept=default
Move-construction.
void swap(PcpPrimIndex &rhs)
Same as Swap(), but standard name.
PCP_API bool HasAnyPayloads() const
Returns true if the prim has any authored payload arcs.
PCP_API PcpPrimIndex()
Default construct an empty, invalid prim index.
PCP_API void ComputePrimPropertyNames(TfTokenVector *nameOrder) const
Compute the prim property names for the given path.
PCP_API PcpNodeRef GetRootNode() const
Returns the root node of the prim index graph.
PCP_API void DumpToDotGraph(const std::string &filename, bool includeInheritOriginInfo=true, bool includeMaps=false) const
Dump the prim index in dot format to the file named filename.
PCP_API void ComputePrimChildNames(TfTokenVector *nameOrder, PcpTokenSet *prohibitedNameSet) const
Compute the prim child names for the given path.
PCP_API PcpNodeRange GetNodeRange(PcpRangeType rangeType=PcpRangeTypeAll) const
Returns range of iterators that encompass all children of the root node with the given arc type as we...
PcpPrimIndex & operator=(const PcpPrimIndex &rhs)
Assignment.
PCP_API SdfVariantSelectionMap ComposeAuthoredVariantSelections() const
Compose the authored prim variant selections.
PCP_API PcpNodeIterator GetNodeIteratorAtNode(const PcpNodeRef &node) const
Returns the node iterator that points to the given node if the node is in the prim index graph.
PCP_API PcpNodeRef GetNodeProvidingSpec(const SdfLayerHandle &layer, const SdfPath &path) const
Returns the node that brings opinions from the Sd prim spec at layer and path into this prim index.
PCP_API PcpNodeRef GetNodeProvidingSpec(const SdfPrimSpecHandle &primSpec) const
Returns the node that brings opinions from primSpec into this prim index.
PcpErrorVector GetLocalErrors() const
Return the list of errors local to this prim.
PCP_API bool IsUsd() const
Returns true if this prim index was composed in USD mode.
PCP_API PcpPrimIndex(const PcpPrimIndex &rhs)
Copy-construct a prim index.
PCP_API bool HasSpecs() const
Returns true if this prim index contains any scene description opinions.
PCP_API const SdfPath & GetPath() const
Returns the path of the prim whose opinions are represented by this prim index.
PCP_API std::string GetSelectionAppliedForVariantSet(const std::string &variantSet) const
Return the variant selection applied for the named variant set.
bool IsValid() const
Return true if this index is valid.
PCP_API void PrintStatistics() const
Prints various statistics about this prim index.
PCP_API PcpPrimRange GetPrimRange(PcpRangeType rangeType=PcpRangeTypeAll) const
Returns range of iterators that encompasses all prims, in strong-to-weak order.
PCP_API void Swap(PcpPrimIndex &rhs)
Swap the contents of this prim index with index.
Outputs of the prim indexing procedure.
PcpExpressionVariablesDependencyData expressionVariablesDependency
Dependencies on expression variables from composition arcs in this prim index.
PayloadState payloadState
Indicates the payload state of this index.
PcpErrorVector allErrors
List of all errors encountered during indexing.
std::vector< PcpCulledDependency > culledDependencies
Site dependencies from nodes in the prim index that have been culled.
PcpDynamicFileFormatDependencyData dynamicFileFormatDependency
A list of names of fields that were composed to generate dynamic file format arguments for a node in ...
PcpPrimIndex primIndex
Prim index describing the composition structure for the associated prim.
PcpNodeRef Append(PcpPrimIndexOutputs &&childOutputs, const PcpArc &arcToParent, PcpErrorBasePtr *error)
Appends the outputs from childOutputs to this object, using arcToParent to connect childOutputs' prim...
PayloadState
Enumerator whose enumerants describe the payload state of this prim index.
Object used to iterate over prim specs in the prim index graph in strong-to-weak order.
A scene description container that can combine with other such containers to form simple component as...
A path value used to locate objects in layers or scenegraphs.
Represents a prim description in an SdfLayer object.
Implementation of a hash set using open-addressing and the robin hood hashing algorithm with backward...
Standard pointer typedefs.
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
std::vector< TfToken > TfTokenVector
Convenience types.
std::map< std::string, std::vector< std::string > > PcpVariantFallbackMap
typedef std::map<std::string, std::vector<std::string>> PcpVariantFallbackMap
std::map< std::string, std::string > SdfVariantSelectionMap
A map of reference variant set names to variants in those sets.