28 #ifndef _GUSD_USD_TRAVERSE_H_
29 #define _GUSD_USD_TRAVERSE_H_
32 #include <PRM/PRM_Name.h>
33 #include <UT/UT_Array.h>
34 #include <UT/UT_Error.h>
35 #include <UT/UT_NonCopyable.h>
36 #include <UT/UT_String.h>
37 #include <UT/UT_StringMap.h>
40 #include "gusd/defaultArray.h"
41 #include "gusd/purpose.h"
42 #include "gusd/USD_Utils.h"
45 #include "pxr/usd/usd/prim.h"
51 PXR_NAMESPACE_OPEN_SCOPE
61 typedef std::pair<UsdPrim,exint> PrimIndexPair;
65 virtual Opts* CreateOpts()
const {
return nullptr; }
70 GusdPurposeSet purposes,
71 UT_Array<UsdPrim>& prims,
73 const Opts* opts=
nullptr)
const = 0;
80 virtual bool FindPrims(
const UT_Array<UsdPrim>& roots,
83 UT_Array<PrimIndexPair>& prims,
85 const Opts* opts=
nullptr)
const = 0;
87 bool FindPrims(
const UT_Array<UsdPrim>& roots,
90 UT_Array<UsdPrim>& prims,
92 const Opts* opts=
nullptr)
const;
104 virtual bool Configure(OP_Parameters& parms, fpreal t) = 0;
110 class GusdUSD_TraverseType
116 const PRM_Template* templates=
nullptr,
117 const char* help=
nullptr);
119 const PRM_Name& GetName()
const {
return _name; }
120 const PRM_Template* GetTemplates()
const {
return _templates; }
121 const char* GetHelp()
const {
return _help; }
128 const PRM_Name _name;
129 const PRM_Template*
const _templates;
130 const UT_String _help;
139 bool GetVisitChildren()
const {
return _visitChildren; }
140 void SetVisitChildren(
bool tf) { _visitChildren = tf; }
141 void PruneChildren() { SetVisitChildren(
false); }
152 typedef UT_StringMap<const GusdUSD_TraverseType*> Map;
153 typedef Map::const_iterator const_iterator;
154 typedef Map::iterator iterator;
160 void Register(
const GusdUSD_TraverseType* type);
163 const GusdUSD_TraverseType* Find(
const char* name)
const;
168 const char* GetDefault()
const
171 void SetDefault(
const char* name)
172 { _default.harden(name); }
174 iterator begin() {
return _map.begin(); }
175 const_iterator begin()
const {
return _map.begin(); }
177 iterator end() {
return _map.end(); }
178 const_iterator end()
const {
return _map.end(); }
185 PXR_NAMESPACE_CLOSE_SCOPE
Table for registering custom stage traversals.
virtual bool FindPrims(const UsdPrim &root, UsdTimeCode time, GusdPurposeSet purposes, UT_Array< UsdPrim > &prims, bool skipRoot=true, const Opts *opts=nullptr) const =0
Find prims beneath the given root.
Base class for custom stage traversal.
Helper to provide control over traversal through children.
Base class that can be derived to provide configuration options to the traversal. ...
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
virtual void Reset()
Reset options back to defaults.