HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_FindPrims.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Side Effects Software Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef __HUSD_FindPrims_h__
19 #define __HUSD_FindPrims_h__
20 
21 #include "HUSD_API.h"
22 #include "HUSD_DataHandle.h"
23 #include "HUSD_Utils.h"
24 #include <OP/OP_ItemId.h>
25 #include <UT/UT_BoundingBox.h>
26 #include <UT/UT_StringMap.h>
27 #include <UT/UT_StringArray.h>
28 #include <UT/UT_UniquePtr.h>
29 #include <UT/UT_VectorTypes.h>
30 #include <pxr/pxr.h>
31 #include <vector>
32 
34 class XUSD_PathPattern;
36 
37 class HUSD_PathSet;
38 class HUSD_TimeCode;
39 
41 {
42 public:
46  bool find_point_instancer_ids = false);
47  // Simple constructors when you just want to operate
48  // on one or an array of primitives and you know the
49  // paths.
51  const UT_StringRef &primpath,
55  const UT_StringArray &primpaths,
59  const HUSD_PathSet &primpaths,
62  ~HUSD_FindPrims();
63 
68  BBOX_PARTIALLY_OUTSIDE
69  };
70 
71  const HUSD_PathSet &getExpandedPathSet() const;
72  const HUSD_PathSet &getCollectionAwarePathSet() const;
73  const HUSD_PathSet &getExcludedPathSet(bool skipdescendants) const;
74 
75  void setTraversalDemands(HUSD_PrimTraversalDemands demands);
76  HUSD_PrimTraversalDemands traversalDemands() const;
77  void setAssumeWildcardsAroundPlainTokens(bool assume);
78  bool assumeWildcardsAroundPlainTokens() const;
79  void setCaseSensitive(bool casesensitive);
80  bool caseSensitive() const;
81 
82  // Add a specific set of primitive paths or collection paths to our data.
83  bool addPaths(const HUSD_PathSet &paths);
84  // Evaluate the supplied pattern and add the resulting primitives and
85  // collections to our data.
86  bool addPattern(const UT_StringRef &pattern,
87  int nodeid,
88  const HUSD_TimeCode &timecode);
89  bool addPrimitiveType(const UT_StringRef &primtype);
90  bool addPrimitiveKind(const UT_StringRef &primkind);
91  bool addPrimitivePurpose(const UT_StringRef &primpurpose);
92  bool addVexpression(const UT_StringRef &vexpression,
93  int nodeid,
94  const HUSD_TimeCode &timecode) const;
95  bool addBoundingBox(const UT_BoundingBox &bbox,
96  const HUSD_TimeCode &t,
97  const UT_StringArray &purposes,
98  BBoxContainment containment);
99  bool addDescendants();
100  bool addAncestors();
101 
102  const UT_StringMap<UT_Int64Array> &getPointInstancerIds() const;
103  bool getExcludedPointInstancerIds(
104  UT_StringMap<UT_Int64Array> &excludedids,
105  const HUSD_TimeCode &timecode) const;
106 
107  bool getIsEmpty() const;
108  bool getFindPointInstancerIds() const;
109  bool getIsTimeVarying() const;
110  bool allowInstanceProxies() const;
111 
112  /// Returns a collection path, if only a single collection was added.
113  /// Returns an empty string, if primitive target consists of more than
114  /// a single collection.
115  UT_StringHolder getSingleCollectionPath() const;
116 
117  /// Returns the path to the most nested primitive that is the shared
118  /// root primitive of every primitive in our expanded set. If the shared
119  /// root prim is the absolute root, we return an empty string.
120  UT_StringHolder getSharedRootPrim() const;
121 
122  /// Return a string describing the last error generated by a failed
123  /// call to this object's methods.
125  { return myLastError; }
126 
127 private:
128  bool addPattern(const PXR_NS::XUSD_PathPattern &pattern,
129  int nodeid);
130 
131  class husd_FindPrimsPrivate;
132 
134  HUSD_AutoAnyLock &myAnyLock;
135  HUSD_PrimTraversalDemands myDemands;
136  UT_StringHolder myLastError;
137  bool myFindPointInstancerIds;
138  bool myAssumeWildcardsAroundPlainTokens;
139  bool myCaseSensitive;
140 };
141 
142 #endif
143 
#define HUSD_API
Definition: HUSD_API.h:32
HUSD_PrimTraversalDemands
Definition: HUSD_Utils.h:30
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:33
const UT_StringHolder & getLastError() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
GLubyte * pattern
Definition: glew.h:5711
GLdouble GLdouble t
Definition: glew.h:1398
GLenum const void * paths
Definition: glew.h:13589