24 #ifndef PXR_USD_USD_PRIM_DATA_H
25 #define PXR_USD_USD_PRIM_DATA_H
43 #include <hboost/intrusive_ptr.hpp>
105 return *_primTypeInfo;
208 return !_nextSiblingOrParent.
BitsAs<
bool>() ?
209 _nextSiblingOrParent.
Get() :
nullptr;
216 return _nextSiblingOrParent.
BitsAs<
bool>() ?
217 _nextSiblingOrParent.
Get() :
nullptr;
271 void _ComposeAndCacheFlags(
289 _nextSiblingOrParent.
Set(sibling,
false);
293 _nextSiblingOrParent.
Set(parent,
true);
300 _primIndex =
nullptr;
308 void _SetMayHaveOpinionsInClips(
bool hasClips) {
325 mutable std::atomic<int64_t> _refCount;
330 prim->_refCount.fetch_add(1, std::memory_order_relaxed);
333 if (prim->_refCount.fetch_sub(1, std::memory_order_release) == 1)
379 return _underlyingIterator == other._underlyingIterator;
383 return _underlyingIterator != other._underlyingIterator;
391 : _underlyingIterator(i) {}
397 _UnderylingIterator _underlyingIterator =
nullptr;
401 Usd_PrimData::_ChildrenBegin()
const
407 Usd_PrimData::_ChildrenEnd()
const
441 return _underlyingIterator == other._underlyingIterator;
445 return _underlyingIterator != other._underlyingIterator;
454 : _underlyingIterator(i) {}
462 _UnderlyingIterator _underlyingIterator =
nullptr;
466 Usd_PrimData::_SubtreeBegin()
const
473 Usd_PrimData::_SubtreeEnd()
const
482 template <
class PrimDataPtr>
486 return !proxyPrimPath.
IsEmpty();
496 template <
class PrimDataPtr>
516 template <
class PrimDataPtr>
522 if (!proxyPrimPath.
IsEmpty()) {
525 if (p && p->IsPrototype()) {
526 p = p->GetPrimDataAtPathOrInPrototype(proxyPrimPath);
527 if (TF_VERIFY(p,
"No prim at <%s>", proxyPrimPath.
GetText()) &&
528 p->GetPath() == proxyPrimPath) {
546 template <
class PrimDataPtr>
556 PrimDataPtr next = p->GetNextSibling();
557 while (next && next != end &&
558 !Usd_EvalPredicate(pred, next, isInstanceProxy)) {
560 next = p->GetNextSibling();
562 p = next ? next : p->GetParentLink();
564 if (!proxyPrimPath.
IsEmpty()) {
568 else if (p == next) {
574 if (p && p->IsPrototype()) {
575 p = p->GetPrimDataAtPathOrInPrototype(proxyPrimPath);
576 if (TF_VERIFY(p,
"No prim at <%s>", proxyPrimPath.
GetText()) &&
577 p->GetPath() == proxyPrimPath) {
589 template <
class PrimDataPtr>
595 PrimDataPtr(
nullptr), pred);
603 template <
class PrimDataPtr>
612 if (src->IsInstance()) {
613 src = src->GetPrototype();
614 isInstanceProxy =
true;
617 if (PrimDataPtr child = src->GetFirstChild()) {
618 if (isInstanceProxy) {
619 proxyPrimPath = proxyPrimPath.
IsEmpty() ?
620 p->GetPath().AppendChild(child->GetName()) :
626 if (Usd_EvalPredicate(pred, p, isInstanceProxy) ||
635 template <
class PrimDataPtr>
645 #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)
GLsizei const GLchar *const * string
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 intrusive_ptr_add_ref(const Usd_PrimData *prim)
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.
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.
friend void intrusive_ptr_release(const Usd_PrimData *prim)
Return this prim's parent prim. Return nullptr if this is a root prim.