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