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/dynamicFileFormatDependencyData.h"
31 #include "pxr/usd/pcp/errors.h"
32 #include "pxr/usd/pcp/iterator.h"
33 #include "pxr/usd/pcp/node.h"
36 #include "pxr/usd/sdf/site.h"
38 #include "pxr/base/tf/hashmap.h"
39 #include "pxr/base/tf/hashset.h"
41 #include <tbb/spin_rw_mutex.h>
46 #include <unordered_set>
48 PXR_NAMESPACE_OPEN_SCOPE
94 void Swap(PcpPrimIndex& rhs);
97 inline void swap(PcpPrimIndex &rhs) {
Swap(rhs); }
104 void SetGraph(
const PcpPrimIndex_GraphRefPtr& graph);
106 PcpPrimIndex_GraphPtr GetGraph()
const;
151 PcpNodeRange
GetNodeRange(PcpRangeType rangeType = PcpRangeTypeAll)
const;
156 PcpPrimRange
GetPrimRange(PcpRangeType rangeType = PcpRangeTypeAll)
const;
178 const SdfLayerHandle& layer,
const SdfPath& path)
const;
187 return _localErrors ? *_localErrors.get() : PcpErrorVector();
202 bool includeInheritOriginInfo =
true,
203 bool includeMaps =
true)
const;
209 const std::string& filename,
210 bool includeInheritOriginInfo =
true,
211 bool includeMaps =
false)
const;
247 const std::string &variantSet)
const;
253 friend struct Pcp_PrimIndexer;
254 friend void Pcp_RescanForSpecs(PcpPrimIndex*,
bool usd,
255 bool updateHasSpecs);
258 PcpPrimIndex_GraphRefPtr _graph;
262 Pcp_CompressedSdSiteVector _primStack;
266 std::unique_ptr<PcpErrorVector> _localErrors;
284 IncludedByIncludeSet, ExcludedByIncludeSet,
285 IncludedByPredicate, ExcludedByPredicate };
319 const PcpArc& arcToParent,
320 PcpErrorBasePtr *error);
334 , variantFallbacks(
nullptr)
335 , includedPayloads(
nullptr)
336 , includedPayloadsMutex(
nullptr)
337 , parentIndex(
nullptr)
349 { cache = cache_;
return *
this; }
354 { variantFallbacks = map;
return *
this; }
358 using PayloadSet = std::unordered_set<SdfPath, SdfPath::Hash>;
360 { includedPayloads = payloadSet;
return *
this; }
364 { includedPayloadsMutex = mutex;
return *
this; }
371 std::function<
bool (
const SdfPath &)> predicate)
372 { includePayloadPredicate = predicate;
return *
this; }
377 { cull = doCulling;
return *
this; }
383 { usd = doUSD;
return *
this; }
388 { fileFormatTarget = target;
return *
this; }
394 tbb::spin_rw_mutex *includedPayloadsMutex;
395 std::function<bool (const SdfPath &)> includePayloadPredicate;
397 std::string fileFormatTarget;
408 const PcpLayerStackPtr& layerStack,
416 PcpIsNewDefaultStandinBehaviorEnabled();
428 Pcp_NeedToRecomputeDueToAssetPathChange(
const PcpPrimIndex& index);
430 PXR_NAMESPACE_CLOSE_SCOPE
432 #endif // PXR_USD_PCP_PRIM_INDEX_H
void swap(ArAssetInfo &lhs, ArAssetInfo &rhs)
Represents an arc connecting two nodes in the prim index.
A unit of scene description that you combine with other units of scene description to form a shot...
PCP_API void Swap(PcpPrimIndex &rhs)
Swap the contents of this prim index with index.
void swap(PcpPrimIndex &rhs)
Same as Swap(), but standard name.
PCP_API std::string DumpToString(bool includeInheritOriginInfo=true, bool includeMaps=true) const
Dump the prim index contents to a string.
PCP_API bool IsInstanceable() const
Returns true if this prim index is instanceable.
Outputs of the prim indexing procedure.
PcpPrimIndex is an index of the all sites of scene description that contribute opinions to a specific...
PcpPrimIndex primIndex
Prim index describing the composition structure for the associated prim.
Standard pointer typedefs.
PCP_API void ComputePrimChildNames(TfTokenVector *nameOrder, PcpTokenSet *prohibitedNameSet) const
Compute the prim child names for the given path.
Represents a stack of layers that contribute opinions to composition.
PcpNode represents a node in an expression tree for compositing scene description.
PCP_API PcpPrimIndex()
Default construct an empty, invalid prim index.
PcpCache is the context required to make requests of the Pcp composition algorithm and cache the resu...
std::map< std::string, std::string > SdfVariantSelectionMap
A map of reference variant set names to variants in those sets.
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
PCP_API const SdfPath & GetPath() const
Returns the path of the prim whose opinions are represented by this prim index.
PCP_API void ComputePrimPropertyNames(TfTokenVector *nameOrder) const
Compute the prim property names for the given path.
PcpNodeRef Append(PcpPrimIndexOutputs &&childOutputs, const PcpArc &arcToParent, PcpErrorBasePtr *error)
Appends the outputs from childOutputs to this object, using arcToParent to connect childOutputs' prim...
PCP_API bool HasAnyPayloads() const
Returns true if the prim has any authored payload arcs.
bool IsValid() const
Return true if this index is valid.
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...
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.
void swap(UsdStageLoadRules &l, UsdStageLoadRules &r)
Swap the contents of rules l and r.
PcpPrimIndex & operator=(const PcpPrimIndex &rhs)
Assignment.
PCP_API bool HasSpecs() const
Returns true if this prim index contains any scene description opinions.
PCP_API PcpNodeRef GetRootNode() const
Returns the root node of the prim index graph.
PcpErrorVector GetLocalErrors() const
Return the list of errors local to this prim.
std::vector< TfToken > TfTokenVector
Convenience types.
A path value used to locate objects in layers or scenegraphs.
PCP_API PcpPrimRange GetPrimRange(PcpRangeType rangeType=PcpRangeTypeAll) const
Returns range of iterators that encompasses all prims, in strong-to-weak order.
PCP_API PcpPrimRange GetPrimRangeForNode(const PcpNodeRef &node) const
Returns range of iterators that encompasses all prims from the site of node.
Object used to iterate over prim specs in the prim index graph in strong-to-weak order.
PCP_API PcpNodeRef GetNodeProvidingSpec(const SdfPrimSpecHandle &primSpec) const
Returns the node that brings opinions from primSpec into this prim index.
PcpDynamicFileFormatDependencyData dynamicFileFormatDependency
A list of names of fields that were composed to generate dynamic file format arguments for a node in ...
PayloadState payloadState
Indicates the payload state of this index.
PCP_API bool IsUsd() const
Returns true if this prim index was composed in USD mode.
Represents a prim description in an SdfLayer object.
void swap(PcpPrimIndexOutputs &r)
Swap content with r.
PCP_API SdfVariantSelectionMap ComposeAuthoredVariantSelections() const
Compose the authored prim variant selections.
PayloadState
Enumerator whose enumerants describe the payload state of this prim index.
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
PcpErrorVector allErrors
List of all errors encountered during indexing.
This is a space efficient container that mimics the TfHashSet API that uses a vector for storage when...
PCP_API void PrintStatistics() const
Prints various statistics about this prim index.
PCP_API std::string GetSelectionAppliedForVariantSet(const std::string &variantSet) const
Return the variant selection applied for the named variant set.
std::map< std::string, std::vector< std::string > > PcpVariantFallbackMap
typedef std::map<std::string, std::vector<std::string>> PcpVariantFallbackMap
Interface for the asset resolution system.