HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_GEOAttributeFilter.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GT_GEOAttributeFilter.h ( GEO Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_GEOAttributeFilter__
12 #define __GT_GEOAttributeFilter__
13 
14 #include "GT_API.h"
15 #include <GA/GA_Attribute.h>
16 #include <UT/UT_StringSet.h>
17 
18 /// Class to filter attributes when building GT_AttributeLists
20 {
21 public:
23  virtual ~GT_GEOAttributeFilter();
24 
25  /// Sub-classes should likely call the base class filtering
26  virtual bool isValid(const GA_Attribute &attrib) const
27  {
28  if (attrib.getScope() != GA_SCOPE_PUBLIC)
29  return false;
30  return attrib.getAIFTuple() ||
31  attrib.getAIFNumericArray() ||
32  attrib.getAIFStringTuple() ||
33  attrib.getAIFSharedStringArray() ||
34  attrib.getAIFSharedDictTuple() ||
35  attrib.getAIFSharedDictArray();
36  }
37 private:
38 };
39 
40 /// Quadrics don't want to pick up either P or N if the attributes exist
42 {
43 public:
45  const GA_Attribute *N)
46  : myP(P)
47  , myN(N)
48  {}
50 
51  bool isValid(const GA_Attribute &a) const override
52  {
53  if (&a == myP || &a == myN)
54  return false;
56  }
57 protected:
58  const GA_Attribute *myP, *myN;
59 };
60 
61 /// Viewer doesn't want duplicated attributes in different classes.
62 /// Calling setHandledAttribs() will prevent those atribs from being added
63 /// to other lists of lower priority.
65 {
66 public:
69 
70  /// Sub-classes should likely call the base class filtering
71  bool isValid(const GA_Attribute &a) const override
72  {
73  if(myHandledAttribs.contains(a.getName()))
74  return false;
76  }
77  void setHandledAttrib(const UT_StringRef &attr_name);
78  void setHandledAttribs(const UT_StringArray &attr_names);
79 private:
80  UT_StringSet myHandledAttribs;
81 };
82 
83 /// Only pick up floating point attributes which have a tuple size that matches
84 /// the standard VEX types (i.e. 1, 3, 4, 9 or 16 floats).
86 {
87 public:
90 
91  bool isValid(const GA_Attribute &a) const override
92  {
93  if (a.getScope() != GA_SCOPE_PUBLIC)
94  return false;
95 
97  return false;
98 
99  int tsize = a.getTupleSize();
100  return tsize == 1 ||
101  tsize == 3 ||
102  tsize == 4 ||
103  tsize == 9 ||
104  tsize == 16;
105  }
106 };
107 
108 #endif
109 
Definition of a geometry attribute.
Definition: GA_Attribute.h:198
Quadrics don't want to pick up either P or N if the attributes exist.
int getTupleSize() const
Size of the AIFTuple, if it exists. If it doesn't, 1.
virtual const GA_AIFStringTuple * getAIFStringTuple() const
Return the attribute's string tuple interface or NULL.
Class to filter attributes when building GT_AttributeLists.
#define GT_API
Definition: GT_API.h:13
virtual const GA_AIFTuple * getAIFTuple() const
Return the attribute's tuple interface or NULL.
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
SYS_FORCE_INLINE GA_AttributeScope getScope() const
Definition: GA_Attribute.h:212
Standard user attribute level.
Definition: GA_Types.h:148
SYS_FORCE_INLINE const UT_StringHolder & getName() const
Definition: GA_Attribute.h:283
GT_GEOQuadricAttributeFilter(const GA_Attribute *P, const GA_Attribute *N)
bool isValid(const GA_Attribute &a) const override
Sub-classes should likely call the base class filtering.
GA_StorageClass getStorageClass() const
Returns the approximate type of the attribute.
bool isValid(const GA_Attribute &a) const override
Sub-classes should likely call the base class filtering.
virtual const GA_AIFSharedStringArray * getAIFSharedStringArray() const
Return the attribute's shared string array interface or NULL.
virtual bool isValid(const GA_Attribute &attrib) const
Sub-classes should likely call the base class filtering.
GA_API const UT_StringHolder N
bool isValid(const GA_Attribute &a) const override
Sub-classes should likely call the base class filtering.
virtual const GA_AIFSharedDictTuple * getAIFSharedDictTuple() const
Return the attribute's shared options tuple interface or NULL.
virtual const GA_AIFSharedDictArray * getAIFSharedDictArray() const
Return the attribute's shared options tuple interface or NULL.
virtual const GA_AIFNumericArray * getAIFNumericArray() const
Return the attribute's arraydata interface or NULL.