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 <UT/UT_BoundingBox.h>
25 #include <UT/UT_StringMap.h>
26 #include <UT/UT_StringArray.h>
27 #include <UT/UT_UniquePtr.h>
28 #include <UT/UT_VectorTypes.h>
29 #include <pxr/pxr.h>
30 #include <vector>
31 
33 
34 class XUSD_PathSet;
35 class XUSD_PathPattern;
36 
38 
39 class HUSD_TimeCode;
40 
42 {
43 public:
47  bool find_point_instancer_ids = false);
48  // Simple constructors when you just want to operate
49  // on one or an array of primitives and you know the
50  // paths.
52  const UT_StringRef &primpath,
56  const UT_StringArray &primpaths,
60  const std::vector<std::string> &primpaths,
63  // Copy constructor that evaluates the source's
64  // expanded path set, and uses that as our own
65  // base path set. Also inherits other source
66  // settings like demands, base type, etc.
68  ~HUSD_FindPrims();
69 
74  BBOX_PARTIALLY_OUTSIDE
75  };
76 
77  const PXR_NS::XUSD_PathSet &getExpandedPathSet() const;
78  const PXR_NS::XUSD_PathSet &getCollectionAwarePathSet() const;
79  const PXR_NS::XUSD_PathSet &getExcludedPathSet(bool skipdescendants) const;
80 
81  void setBaseTypeName(const UT_StringRef &base_type_name);
82  void setTraversalDemands(HUSD_PrimTraversalDemands demands);
83  void setAssumeWildcardsAroundPlainTokens(bool assume);
84  bool addPattern(const UT_StringArray &pattern_tokens);
85  bool addPattern(const UT_StringRef &pattern,
86  int nodeid,
87  const HUSD_TimeCode &timecode);
88  bool addPrimitiveType(const UT_StringRef &primtype);
89  bool addPrimitiveKind(const UT_StringRef &primkind);
90  bool addPrimitivePurpose(const UT_StringRef &primpurpose);
91  bool addVexpression(const UT_StringRef &vexpression,
92  int nodeid,
93  const HUSD_TimeCode &timecode) const;
94  bool addBoundingBox(const UT_BoundingBox &bbox,
95  const HUSD_TimeCode &t,
96  const UT_StringArray &purposes,
97  BBoxContainment containment);
98  bool addDescendants();
99  bool addAncestors();
100 
101  const UT_StringMap<UT_Int64Array> &getPointInstancerIds() const;
102  bool getExcludedPointInstancerIds(
103  UT_StringMap<UT_Int64Array> &excludedids,
104  const HUSD_TimeCode &timecode) const;
105  // Returns the array of string from getExpandedPathSet.
106  void getExpandedPaths(UT_StringArray &paths) const;
107  // Returns the array of string from getCollectionAwarePathSet.
108  void getCollectionAwarePaths(UT_StringArray &paths) const;
109  // Returns the array of string from getExcludedPathSet.
110  void getExcludedPaths(UT_StringArray &paths,
111  bool skipdescendants) const;
112  bool getIsEmpty() const;
113  bool getFindPointInstancerIds() const;
114  bool getIsTimeVarying() const;
115  bool allowInstanceProxies() const;
116 
117  /// Returns a collection path, if only a single collection was added.
118  /// Returns an empty string, if primitive target consists of more than
119  /// a single collection.
120  UT_StringHolder getSingleCollectionPath() const;
121 
122  /// Returns the path to the most nested primitive that is the shared
123  /// root primitive of every primitive in our expanded set. If the shared
124  /// root prim is the absolute root, we return an empty string.
125  UT_StringHolder getSharedRootPrim() const;
126 
127  /// Return a string describing the last error generated by a failed
128  /// call to this object's methods.
130  { return myLastError; }
131 
132 private:
133  bool addPattern(const PXR_NS::XUSD_PathPattern &pattern);
134 
135  class husd_FindPrimsPrivate;
136 
138  HUSD_AutoAnyLock &myAnyLock;
139  HUSD_PrimTraversalDemands myDemands;
140  UT_StringHolder myLastError;
141  bool myFindPointInstancerIds;
142  bool myAssumeWildcardsAroundPlainTokens;
143 };
144 
145 #endif
146 
GLenum src
Definition: glew.h:2410
#define HUSD_API
Definition: HUSD_API.h:32
HUSD_PrimTraversalDemands
Definition: HUSD_Utils.h:28
const UT_StringHolder & getLastError() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1245
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:83
GLubyte * pattern
Definition: glew.h:5711
GLdouble GLdouble t
Definition: glew.h:1398
GLenum const void * paths
Definition: glew.h:13589