7#ifndef PXR_USD_PCP_PRIM_INDEX_H
8#define PXR_USD_PCP_PRIM_INDEX_H
11#include "pxr/usd/pcp/api.h"
13#include "pxr/usd/pcp/dependency.h"
14#include "pxr/usd/pcp/dynamicFileFormatDependencyData.h"
15#include "pxr/usd/pcp/expressionVariablesDependencyData.h"
16#include "pxr/usd/pcp/errors.h"
17#include "pxr/usd/pcp/iterator.h"
18#include "pxr/usd/pcp/node.h"
21#include "pxr/usd/sdf/site.h"
23#include "pxr/base/tf/hashmap.h"
24#include "pxr/base/tf/hashset.h"
26#include <tbb/spin_rw_mutex.h>
31#include <unordered_set>
33PXR_NAMESPACE_OPEN_SCOPE
93 bool IsValid()
const {
return bool(_graph); }
95 void SetGraph(
const PcpPrimIndex_GraphRefPtr& graph) {
108 const PcpArc &arcToParent,
110 PcpErrorBasePtr *error);
112 const PcpPrimIndex_GraphRefPtr &GetGraph()
const {
159 PcpNodeRange
GetNodeRange(PcpRangeType rangeType = PcpRangeTypeAll)
const;
176 PcpPrimRange
GetPrimRange(PcpRangeType rangeType = PcpRangeTypeAll)
const;
198 const SdfLayerHandle& layer,
const SdfPath& path)
const;
207 return _localErrors ? *_localErrors.get() : PcpErrorVector();
222 bool includeInheritOriginInfo =
true,
223 bool includeMaps =
true)
const;
229 const std::string& filename,
230 bool includeInheritOriginInfo =
true,
231 bool includeMaps =
false)
const;
275 const std::string &variantSet)
const;
281 friend struct Pcp_PrimIndexer;
282 friend void Pcp_RescanForSpecs(
288 PcpPrimIndex_GraphRefPtr _graph;
292 Pcp_CompressedSdSiteVector _primStack;
296 std::unique_ptr<PcpErrorVector> _localErrors;
314 IncludedByIncludeSet, ExcludedByIncludeSet,
315 IncludedByPredicate, ExcludedByPredicate };
348 const PcpArc& arcToParent,
349 PcpErrorBasePtr *error);
360 , variantFallbacks(
nullptr)
361 , includedPayloads(
nullptr)
362 , includedPayloadsMutex(
nullptr)
363 , parentIndex(
nullptr)
375 { cache = cache_;
return *
this; }
380 { variantFallbacks = map;
return *
this; }
384 using PayloadSet = std::unordered_set<SdfPath, SdfPath::Hash>;
386 { includedPayloads = payloadSet;
return *
this; }
390 { includedPayloadsMutex = mutex;
return *
this; }
397 std::function<
bool (
const SdfPath &)> predicate)
398 { includePayloadPredicate = predicate;
return *
this; }
403 { cull = doCulling;
return *
this; }
409 { usd = doUSD;
return *
this; }
414 { fileFormatTarget = target;
return *
this; }
420 tbb::spin_rw_mutex *includedPayloadsMutex;
421 std::function<bool (
const SdfPath &)> includePayloadPredicate;
423 std::string fileFormatTarget;
434 const PcpLayerStackPtr& layerStack,
442PcpIsNewDefaultStandinBehaviorEnabled();
450Pcp_NeedToRecomputeDueToAssetPathChange(
const PcpPrimIndex& index);
452PXR_NAMESPACE_CLOSE_SCOPE
Interface for the asset resolution system.
Represents an arc connecting two nodes in the prim index.
Types of changes per cache.
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 void ComputePrimChildNamesInSubtree(const PcpNodeRef &subtreeRootNode, TfTokenVector *nameOrder, PcpTokenSet *prohibitedNameSet) const
Compute the prim child names for this prim when composed from only the subtree starting at subtreeRoo...
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.
PcpNodeRef AddChildPrimIndex(const PcpArc &arcToParent, PcpPrimIndex &&childPrimIndex, PcpErrorBasePtr *error)
Add the nodes in childPrimIndex to this prim index; arcToParent specifies the node in this prim index...
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.