All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
USD_CustomTraverse.h
1 //
2 // Copyright 2017 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef _GUSD_USD_CUSTOMTRAVERSE_H_
25 #define _GUSD_USD_CUSTOMTRAVERSE_H_
26 
27 #include "pxr/pxr.h"
28 
29 #include "USD_Traverse.h"
30 
31 #include <UT/UT_StringMMPattern.h>
32 
33 PXR_NAMESPACE_OPEN_SCOPE
34 
38 {
39 public:
40  enum TriState
41  {
42  TRUE_STATE,
43  FALSE_STATE,
44  ANY_STATE
45  };
46 
47  struct Opts : public GusdUSD_Traverse::Opts
48  {
49  Opts() : GusdUSD_Traverse::Opts() {}
50  virtual ~Opts() {}
51 
52  virtual void Reset();
53  virtual bool Configure(OP_Parameters& parms, fpreal t);
54 
59  bool SetKindsByPattern(const char* pattern,
60  bool caseSensitive=true,
61  std::string* err=nullptr);
62 
63  bool SetPurposesByPattern(const char* pattern,
64  bool caseSensitive=true,
65  std::string* err=nullptr);
66 
67  bool SetTypesByPattern(const char* pattern,
68  bool caseSensitive=true,
69  std::string* err=nullptr);
70 
71  void SetNamePattern(const char* pattern,
72  bool caseSensitive=true);
73 
74  void SetPathPattern(const char* pattern,
75  bool caseSensitive=true);
80  Usd_PrimFlagsPredicate MakePredicate() const;
81 
82 
83  TriState active, visible, imageable, defined, abstract,
84  model, group, instance, master, clips;
85  bool traverseMatched;
86  UT_Array<TfToken> purposes, kinds;
87  UT_Array<TfType> types;
88  UT_StringMMPattern namePattern, pathPattern;
89  };
90 
91  virtual Opts* CreateOpts() const { return new Opts; }
92 
93  virtual bool FindPrims(const UsdPrim& root,
94  UsdTimeCode time,
95  GusdPurposeSet purposes,
96  UT_Array<UsdPrim>& prims,
97  bool skipRoot=true,
98  const GusdUSD_Traverse::Opts* opts=nullptr) const;
99 
100  virtual bool FindPrims(const UT_Array<UsdPrim>& roots,
101  const GusdDefaultArray<UsdTimeCode>& times,
102  const GusdDefaultArray<GusdPurposeSet>& purposes,
103  UT_Array<PrimIndexPair>& prims,
104  bool skipRoot=true,
105  const GusdUSD_Traverse::Opts* opts=nullptr) const;
106 
107  static void Initialize();
108 };
109 
110 PXR_NAMESPACE_CLOSE_SCOPE
111 
112 #endif /*_GUSD_USD_CUSTOMTRAVERSE_H_*/
virtual bool FindPrims(const UsdPrim &root, UsdTimeCode time, GusdPurposeSet purposes, UT_Array< UsdPrim > &prims, bool skipRoot=true, const GusdUSD_Traverse::Opts *opts=nullptr) const
Find prims beneath the given root.
Base class for custom stage traversal.
Definition: USD_Traverse.h:57
Base class that can be derived to provide configuration options to the traversal. ...
Definition: USD_Traverse.h:96
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:85
Methods for USD scene traversal.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a &quot;Prim&quot; as ...
Definition: prim.h:131
A traversal implementation offering users full configuration over many aspects of traversal...