HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_VertexGroup.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  * COMMENTS:
7  */
8 
9 #ifndef __HOM_VertexGroup_h__
10 #define __HOM_VertexGroup_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_Module.h"
14 #include "HOM_EnumModules.h"
15 #include "HOM_Vertex.h"
16 #include "HOM_PtrOrNull.h"
17 #include "HOM_IterableList.h"
18 #include <vector>
19 
20 class HOM_AttribDataId;
21 class HOM_Geometry;
23 
24 SWIGOUT(%rename(VertexGroup) HOM_VertexGroup;)
25 
27 {
28 public:
30  { HOM_CONSTRUCT_OBJECT(this) }
32  { HOM_CONSTRUCT_OBJECT(this) }
33  virtual ~HOM_VertexGroup()
34  { HOM_DESTRUCT_OBJECT(this) }
35 
36  virtual bool operator==(HOM_PtrOrNull<HOM_VertexGroup> vertex_group) = 0;
37  virtual bool operator!=(HOM_PtrOrNull<HOM_VertexGroup> vertex_group) = 0;
38 
39  virtual int __hash__() = 0;
40  virtual std::string __repr__() = 0;
41 
42  SWIGOUT(%newobject geometry;)
43  virtual HOM_Geometry *geometry() = 0;
44 
45  virtual std::string name() = 0;
46 
47  SWIGOUT(%newobject iterVertices;)
48  virtual HOM_IterableList<HOM_Vertex> *iterVertices() = 0;
49 
50  virtual std::vector<HOM_ElemPtr<HOM_Vertex> > vertices() = 0;
51 
52  virtual bool contains(HOM_Vertex &vertex) = 0;
53 
54  virtual bool isOrdered() = 0;
55 
56  virtual void add(HOM_Vertex &vertex) = 0;
57 
58  virtual void add(const std::vector<HOM_Vertex *> &vertices) = 0;
59 
60  virtual void add(HOM_VertexGroup &vertex_group) = 0;
61 
62  virtual void remove(HOM_Vertex &vertex) = 0;
63 
64  virtual void remove(const std::vector<HOM_Vertex *> &vertices) = 0;
65 
66  virtual void remove(HOM_VertexGroup &vertex_group) = 0;
67 
68  virtual void clear() = 0;
69 
70  virtual void destroy() = 0;
71 
72 #ifndef SWIG
73  // Helper class necessary for getRawOptions[RO\RW]() calls to manage locks
74  // that must be held for the duration of the reference to the UT_Options
75  // object.
77  {
78  public:
80  {
81  public:
82  virtual ~ImplBase() {}
83  protected:
84  ImplBase() {}
85  };
86 
87  OptionAutoLocks() : myImpl(0) {}
88  ~OptionAutoLocks() { delete myImpl; }
89 
90  void setImpl(ImplBase *impl) { myImpl = impl; }
91  private:
92  ImplBase *myImpl;
93  };
94 #endif
95 
96  // These methods return the UT_Options object associated with the attribute
97  // and are not wrapped by swig. The lock argument is present to ensure the
98  // caller holds the locks necessary to work with a reference to an object
99  // owned by the attribute.
100  SWIGOUT(%ignore getRawOptionsRO;)
101  virtual const GA_AttributeOptions &getRawOptionsRO(OptionAutoLocks &locks) = 0;
102  SWIGOUT(%ignore getRawOptionsRW;)
103  virtual GA_AttributeOptions &getRawOptionsRW(OptionAutoLocks &locks) = 0;
104 
105  // Get the data type of a particular option.
106  // TODO: We could implement here, but we need HOMFoptionTypeToEnumValue().
107  virtual HOM_EnumValue &optionType(const char *option_name) = 0;
108 
109  // Set an option value. The type_hint is used when the value type mapping
110  // to a UT_OptionType is ambiguous.
111  virtual void setOption(const char *name, HOM_UTOptionAny value,
112  HOM_EnumValue &type_hint =HOM_fieldType::NoSuchField) = 0;
113 
114  // Remove an option from the attribute's UT_Options object.
115  virtual void removeOption(const char *name) = 0;
116 
117  SWIGOUT(%newobject dataId;)
118  virtual HOM_AttribDataId *dataId() = 0;
119 
120  virtual void incrementDataId() = 0;
121 
122 #ifdef SWIG
123 %extend
124 {
125  InterpreterObject options()
126  {
128  const GA_AttributeOptions &attriboptions = self->getRawOptionsRO(locks);
129  UT_Options options;
130  attriboptions.buildFullOptions(options);
131  return HOMoptionsToInterpreterObject(options);
132  }
133 
134  InterpreterObject option(const char *option_name)
135  {
137  const GA_AttributeOptions &attriboptions = self->getRawOptionsRO(locks);
138  UT_Options options;
139  attriboptions.buildFullOptions(options);
140  const UT_OptionEntry *entry = options.getOptionEntry(option_name);
141  return entry ? HOMoptionEntryToInterpreterObject(*entry)
142  : SWIG_Py_Void();
143  }
144 }
145 #endif
146 };
147 
148 #endif
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1130
void buildFullOptions(UT_Options &fulloptions) const
GLuint const GLchar * name
Definition: glew.h:1814
HOM_VertexGroup(const HOM_VertexGroup &)
hboost::any HOM_UTOptionAny
Definition: HOM_Defines.h:37
OIIO_API bool rename(string_view from, string_view to, std::string &err)
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
GLuint GLenum option
Definition: glew.h:3288
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:349
#define HOM_API
Definition: HOM_API.h:13
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1129
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:604
bool OIIO_API contains(string_view a, string_view b)
Does 'a' contain the string 'b' within it?
GLsizei const GLchar *const * string
Definition: glew.h:1844
A map of string to various well defined value types.
Definition: UT_Options.h:42
void clear()
Reset to default.
const UT_OptionEntry * getOptionEntry(const UT_StringRef &name) const
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GLsizei const GLfloat * value
Definition: glew.h:1849
virtual ~HOM_VertexGroup()
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:590