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  }
35 private:
36 };
37 
38 /// Quadrics don't want to pick up either P or N if the attributes exist
40 {
41 public:
43  const GA_Attribute *N)
44  : myP(P)
45  , myN(N)
46  {}
48 
49  bool isValid(const GA_Attribute &a) const override
50  {
51  if (&a == myP || &a == myN)
52  return false;
54  }
55 protected:
56  const GA_Attribute *myP, *myN;
57 };
58 
59 /// Viewer doesn't want duplicated attributes in different classes.
60 /// Calling setHandledAttribs() will prevent those atribs from being added
61 /// to other lists of lower priority.
63 {
64 public:
67 
68  /// Sub-classes should likely call the base class filtering
69  bool isValid(const GA_Attribute &a) const override
70  {
71  if(myHandledAttribs.contains(a.getName()))
72  return false;
74  }
75  void setHandledAttrib(const UT_StringRef &attr_name);
76  void setHandledAttribs(const UT_StringArray &attr_names);
77 private:
78  UT_StringSet myHandledAttribs;
79 };
80 
81 /// Only pick up floating point attributes which have a tuple size that matches
82 /// the standard VEX types (i.e. 1, 3, 4, 9 or 16 floats).
84 {
85 public:
88 
89  bool isValid(const GA_Attribute &a) const override
90  {
91  if (a.getScope() != GA_SCOPE_PUBLIC)
92  return false;
93 
95  return false;
96 
97  int tsize = a.getTupleSize();
98  return tsize == 1 ||
99  tsize == 3 ||
100  tsize == 4 ||
101  tsize == 9 ||
102  tsize == 16;
103  }
104 };
105 
106 #endif
107 
Definition of a geometry attribute.
Definition: GA_Attribute.h:197
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:11
virtual const GA_AIFTuple * getAIFTuple() const
Return the attribute's tuple interface or NULL.
Standard user attribute level.
Definition: GA_Types.h:147
const UT_StringHolder & getName() const
Definition: GA_Attribute.h:282
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.
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
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.
GA_AttributeScope getScope() const
Definition: GA_Attribute.h:211
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_AIFNumericArray * getAIFNumericArray() const
Return the attribute's arraydata interface or NULL.