HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_GetAttributes.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_GetAttributes_h__
19 #define __HUSD_GetAttributes_h__
20 
21 #include "HUSD_API.h"
22 #include "HUSD_DataHandle.h"
23 #include "HUSD_TimeCode.h"
24 #include <UT/UT_StringHolder.h>
25 
26 enum class HUSD_TimeSampling;
27 
28 
30 {
31 public:
34 
35  /// @{ Obtains attribute or primvar value.
36  template<typename UtValueType>
37  bool getAttribute(const UT_StringRef &primpath,
38  const UT_StringRef &attribname,
39  UtValueType &value,
40  const HUSD_TimeCode &timecode) const;
41 
42  template<typename UtValueType>
43  bool getPrimvar(const UT_StringRef &primpath,
44  const UT_StringRef &primvarname,
45  UtValueType &value,
46  const HUSD_TimeCode &timecode) const;
47  /// @}
48 
49 
50  /// @{ Obtains attribute or primvar array value.
51  // The following methods perform exactly the same thing as the aboves,
52  // but accept the subclasses from the UT_Array.
53  template<typename UtValueType>
54  bool getAttributeArray(const UT_StringRef &primpath,
55  const UT_StringRef &attribname,
56  UT_Array<UtValueType> &value,
57  const HUSD_TimeCode &timecode) const
58  { return getAttribute(primpath, attribname, value, timecode); }
59 
60  template<typename UtValueType>
61  bool getPrimvarArray(const UT_StringRef &primpath,
62  const UT_StringRef &primvarname,
63  UT_Array<UtValueType> &value,
64  const HUSD_TimeCode &timecode) const
65  { return getPrimvar(primpath, primvarname, value, timecode); }
66  /// @}
67 
68  /// Obtains array value of a flattened primvar.
69  template<typename UtValueType>
70  bool getFlattenedPrimvar(const UT_StringRef &primpath,
71  const UT_StringRef &primvarname,
72  UT_Array<UtValueType> &value,
73  const HUSD_TimeCode &timecode) const;
74 
75  /// Returns true if the primvar is indexed.
76  bool isPrimvarIndexed(const UT_StringRef &primpath,
77  const UT_StringRef &primvarname) const;
78 
79  /// Returns the index array for indexed primvars.
80  bool getPrimvarIndices(const UT_StringRef &primpath,
81  const UT_StringRef &primvarname,
83  const HUSD_TimeCode &timecode) const;
84 
85  /// Returns the interpolation style of a primvar.
86  UT_StringHolder getPrimvarInterpolation(const UT_StringRef &primpath,
87  const UT_StringRef &primvarname) const;
88 
89  /// Returns the exlement size of a primvar.
90  exint getPrimvarElementSize(const UT_StringRef &primpath,
91  const UT_StringRef &primvarname) const;
92 
93 
94  /// Returns true if any attribute we have fetched has many time samples.
95  bool getIsTimeVarying() const;
96 
97  /// Returns ture if any attribute we have fetched has time sample(s).
98  bool getIsTimeSampled() const;
99 
100  /// Returns the overal sampling of fethced attributes.
102  { return myTimeSampling; }
103 
104 private:
105  HUSD_AutoAnyLock &myAnyLock;
106  mutable HUSD_TimeSampling myTimeSampling;
107 };
108 #endif
#define HUSD_API
Definition: HUSD_API.h:32
HUSD_TimeSampling getTimeSampling() const
Returns the overal sampling of fethced attributes.
int64 exint
Definition: SYS_Types.h:120
GLuint GLuint GLsizei GLenum const void * indices
Definition: glew.h:1253
HUSD_TimeSampling
Definition: HUSD_Utils.h:81
bool getPrimvarArray(const UT_StringRef &primpath, const UT_StringRef &primvarname, UT_Array< UtValueType > &value, const HUSD_TimeCode &timecode) const
Obtains attribute or primvar array value.
GLsizei const GLfloat * value
Definition: glew.h:1849
bool getAttributeArray(const UT_StringRef &primpath, const UT_StringRef &attribname, UT_Array< UtValueType > &value, const HUSD_TimeCode &timecode) const
Obtains attribute or primvar array value.