FnUsdAbstractionLib 0.6.0
|
#include <PrimRange.h>
Classes | |
class | iterator |
Public Types | |
using | const_iterator = iterator |
Public Member Functions | |
PrimRange (const PrimRange::Impl &) | |
Abstraction handle for casting to UsdPrimRange. | |
PrimRange (const Prim &start, const Prim::FlagsPredicate &mask=Prim::DefaultPredicate) | |
Create a PrimRange starting at prim start which will traverse prims matching the mask argument. | |
bool | empty () const |
Return true if range is empty. | |
operator bool () const | |
Prim | front () const |
Return the first element in this range, or an invalid Prim if range is empty. | |
bool | operator== (const PrimRange &b) const |
bool | operator!= (const PrimRange &b) const |
iterator | begin () const |
const_iterator | cbegin () const |
iterator | end () const |
const_iterator | cend () const |
Static Public Member Functions | |
static PrimRange | preAndPostVisit (const Prim &start, const Prim::FlagsPredicate &mask=Prim::DefaultPredicate) |
static PrimRange | allPrims (const Prim &start) |
static PrimRange | allPrimsPreAndPostVisit (const Prim &start) |
static PrimRange | stage (const Stage &stage, const Prim::FlagsPredicate &mask=Prim::DefaultPredicate) |
Protected Attributes | |
std::unique_ptr< PrimRange::Impl, void(*)(PrimRange::Impl *)> | _pImpl |
class PrimRange A forward-iterable 'range' of Prims. In reality this class does not store a list of Prims, it only contains a 'begin' Prim and a 'past-the-end' indicator pseudo-Prim which a PrimRange::iterator can walk through in a depth-first manner (ie it visits all children first before moving back up to the next sibling prim.)
Since it only contains a couple Prim references a PrimRange is cheap to construct and fast to walk through compared to getting a list of Prims via Stage::findPrimsOfType() or Stage::getPrimPaths() since it allows a loop to perform checks on each Prim in turn during traversal.
Example stage traversal loop which finds the first CameraPrim in a stage: Prim firstCamera; const usg::PrimRange traverser(stage->getRootPrim()); for (usg::PrimRange::const_iterator it = traverser.begin(); it != traverser.end(); ++it) { if ((*it).isA<usg::CameraPrim>()) { firstCamera = *it; break; } }
usg::PrimRange::PrimRange | ( | const PrimRange::Impl & | ) |
Abstraction handle for casting to UsdPrimRange.
Create a PrimRange wrapper from a PrimRange::Impl.
©2025 The Foundry Visionmongers, Ltd. All Rights Reserved. |