7 #ifndef PXR_USD_USD_PRIM_DATA_H
8 #define PXR_USD_USD_PRIM_DATA_H
86 return *_primTypeInfo;
189 return !_nextSiblingOrParent.
BitsAs<
bool>() ?
190 _nextSiblingOrParent.
Get() :
nullptr;
197 return _nextSiblingOrParent.
BitsAs<
bool>() ?
198 _nextSiblingOrParent.
Get() :
nullptr;
252 void _ComposeAndCacheFlags(
270 _nextSiblingOrParent.
Set(sibling,
false);
274 _nextSiblingOrParent.
Set(parent,
true);
281 _primIndex =
nullptr;
289 void _SetMayHaveOpinionsInClips(
bool hasClips) {
306 mutable std::atomic<int64_t> _refCount;
311 prim->_refCount.fetch_add(1, std::memory_order_relaxed);
314 if (prim->_refCount.fetch_sub(1, std::memory_order_release) == 1)
360 return _underlyingIterator == other._underlyingIterator;
364 return _underlyingIterator != other._underlyingIterator;
372 : _underlyingIterator(i) {}
378 _UnderylingIterator _underlyingIterator =
nullptr;
382 Usd_PrimData::_ChildrenBegin()
const
388 Usd_PrimData::_ChildrenEnd()
const
422 return _underlyingIterator == other._underlyingIterator;
426 return _underlyingIterator != other._underlyingIterator;
435 : _underlyingIterator(i) {}
443 _UnderlyingIterator _underlyingIterator =
nullptr;
447 Usd_PrimData::_SubtreeBegin()
const
454 Usd_PrimData::_SubtreeEnd()
const
463 template <
class PrimDataPtr>
467 return !proxyPrimPath.
IsEmpty();
477 template <
class PrimDataPtr>
497 template <
class PrimDataPtr>
503 if (!proxyPrimPath.
IsEmpty()) {
506 if (p && p->IsPrototype()) {
507 p = p->GetPrimDataAtPathOrInPrototype(proxyPrimPath);
508 if (TF_VERIFY(p,
"No prim at <%s>", proxyPrimPath.
GetText()) &&
509 p->GetPath() == proxyPrimPath) {
527 template <
class PrimDataPtr>
537 PrimDataPtr next = p->GetNextSibling();
538 while (next && next != end &&
539 !Usd_EvalPredicate(pred, next, isInstanceProxy)) {
541 next = p->GetNextSibling();
543 p = next ? next : p->GetParentLink();
545 if (!proxyPrimPath.
IsEmpty()) {
549 else if (p == next) {
555 if (p && p->IsPrototype()) {
556 p = p->GetPrimDataAtPathOrInPrototype(proxyPrimPath);
557 if (TF_VERIFY(p,
"No prim at <%s>", proxyPrimPath.
GetText()) &&
558 p->GetPath() == proxyPrimPath) {
570 template <
class PrimDataPtr>
576 PrimDataPtr(
nullptr), pred);
584 template <
class PrimDataPtr>
593 if (src->IsInstance()) {
594 src = src->GetPrototype();
595 isInstanceProxy =
true;
598 if (PrimDataPtr child = src->GetFirstChild()) {
599 if (isInstanceProxy) {
600 proxyPrimPath = proxyPrimPath.
IsEmpty() ?
601 p->GetPath().AppendChild(child->GetName()) :
607 if (Usd_EvalPredicate(pred, p, isInstanceProxy) ||
616 template <
class PrimDataPtr>
626 #endif // PXR_USD_USD_PRIM_DATA_H
USD_API bool IsSubComponent() const
SDF_API const char * GetText() const
Usd_PrimDataSiblingIterator operator++(int)
void Usd_MoveToParent(PrimDataPtr &p, SdfPath &proxyPrimPath)
USD_API Usd_PrimDataConstPtr GetParent() const
Return this prim's parent prim. Return nullptr if this is a root prim.
bool IsPseudoRoot() const
Returns true if this prim is the pseudoroot.
USD_API const class PcpPrimIndex & GetPrimIndex() const
Usd_PrimFlagsPredicate Usd_CreatePredicateForTraversal(const PrimDataPtr &p, const SdfPath &proxyPrimPath, Usd_PrimFlagsPredicate pred)
Usd_PrimDataPtr GetFirstChild() const
Return this prim's parent prim. Return nullptr if this is a root prim.
std::forward_iterator_tag iterator_category
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_PTRS(UsdStage)
Usd_PrimDataPtr GetParentLink() const
Return this prim's parent prim. Return nullptr if this is a root prim.
GLsizei const GLchar *const * path
USD_API SdfSpecifier GetSpecifier() const
Return this prim's composed specifier.
bool IsEmpty() const noexcept
Returns true if this is the empty path (SdfPath::EmptyPath()).
std::forward_iterator_tag iterator_category
bool operator!=(const Usd_PrimDataSiblingIterator &other) const
bool operator==(const Usd_PrimDataSiblingIterator &other) const
**But if you need a result
Usd_PrimFlagsPredicate & TraverseInstanceProxies(bool traverse)
const UsdPrimDefinition & GetPrimDefinition() const
constexpr T * Get() const noexcept
Retrieve the pointer.
const SdfPath & GetPath() const
bool IsInPrototype() const
bool operator==(const Usd_PrimDataSubtreeIterator &other) const
bool IsPrototype() const
Return true if this prim is a shared prototype prim, false otherwise.
bool MayHaveOpinionsInClips() const
Usd_PrimDataSiblingIterator()=default
USD_API const class PcpPrimIndex & GetSourcePrimIndex() const
USD_API Usd_PrimDataConstPtr GetPrimDataAtPathOrInPrototype(const SdfPath &path) const
Return this prim's parent prim. Return nullptr if this is a root prim.
UsdStage * GetStage() const
Usd_PrimDataPtr GetNextPrim() const
Return this prim's parent prim. Return nullptr if this is a root prim.
SDF_API SdfPath AppendChild(TfToken const &childName) const
friend void TfDelegatedCountIncrement(const Usd_PrimData *prim) noexcept
Return this prim's parent prim. Return nullptr if this is a root prim.
bool Usd_IsInstanceProxy(const PrimDataPtr &p, const SdfPath &proxyPrimPath)
friend std::string Usd_DescribePrimData(const Usd_PrimData *p, SdfPath const &proxyPrimPath)
Return this prim's parent prim. Return nullptr if this is a root prim.
bool IncludeInstanceProxiesInTraversal() const
const UsdPrimDefinition & GetPrimDefinition() const
Returns the prim definition for this prim.
constexpr Integral BitsAs() const noexcept
Retrieve the stored bits as the integral type Integral.
std::vector< TfToken > TfTokenVector
Convenience types.
bool HasDefiningSpecifier() const
Usd_PrimDataSubtreeIterator operator++(int)
reference operator*() const
std::ptrdiff_t difference_type
SDF_API const TfToken & GetNameToken() const
bool Usd_MoveToChild(PrimDataPtr &p, SdfPath &proxyPrimPath, PrimDataPtr end, const Usd_PrimFlagsPredicate &pred)
bool operator!=(const Usd_PrimDataSubtreeIterator &other) const
std::ptrdiff_t difference_type
bool IsAbstract() const
Return true if this prim or any of its ancestors is a class.
friend void TfDelegatedCountDecrement(const Usd_PrimData *prim) noexcept
Return this prim's parent prim. Return nullptr if this is a root prim.
USD_API friend void Usd_ThrowExpiredPrimAccessError(Usd_PrimData const *p)
Return this prim's parent prim. Return nullptr if this is a root prim.
void Set(T *ptr) noexcept
Set the pointer value to ptr.
Usd_PrimDataSiblingIterator & operator++()
friend bool Usd_IsDead(Usd_PrimData const *p)
Return this prim's parent prim. Return nullptr if this is a root prim.
bool HasPayload() const
Return true if this prim has one or more payload composition arcs.
const TfToken & GetTypeName() const
Returns the concrete prim type name.
reference operator*() const
const TfToken & GetName() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
bool Usd_MoveToNextSiblingOrParent(PrimDataPtr &p, SdfPath &proxyPrimPath, PrimDataPtr end, const Usd_PrimFlagsPredicate &pred)
SDF_API bool IsRootPrimPath() const
#define PXR_NAMESPACE_CLOSE_SCOPE
SDF_API SdfPath GetParentPath() const
USD_API Usd_PrimDataConstPtr GetPrototype() const
const TfToken & GetTypeName() const
std::bitset< Usd_PrimNumFlags > Usd_PrimFlagBits
Usd_PrimDataPtr GetNextSibling() const
Return this prim's parent prim. Return nullptr if this is a root prim.
Usd_PrimDataSubtreeIterator()=default
Usd_PrimDataSubtreeIterator & operator++()
const UsdPrimTypeInfo & GetPrimTypeInfo() const
Returns the full type info for the prim.