HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GOP_VertexGroupParser.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: This class contains a parser for the vertex groups.
7  * The doIt() method returns the number of vertices parsed,
8  * or -1 if an error has occured.
9  *
10  */
11 
12 #ifndef __GOP_VertexGroupParser_h__
13 #define __GOP_VertexGroupParser_h__
14 
15 #include "GOP_API.h"
16 #include "GOP_Parser.h"
17 #include <GA/GA_ElementGroup.h>
18 #include <GA/GA_Types.h>
19 
20 class GEO_Detail;
21 class GOP_Manager;
22 class GA_VertexGroup;
23 
25 {
26 public:
27  GOP_VertexGroupParser(GOP_Manager *manager, const GEO_Detail &gdp,
28  const UT_String &str, bool strict = true,
29  GA_Index prim_offset = GA_Index(0));
30 
31  // Build a string that contains the id's of the vertices in a vertex
32  // group. The offset is the amount to add to the ids of the primitives for
33  // each vertex in the group.
34  static void buildGroupToken(const GA_VertexGroup *vtxgrp,
35  UT_String &token,
36  GA_Index offset = GA_Index(0));
37 
38  // Build a string representing a single vertex element. The offset is the
39  // amount to add to the id of the primitive.
40  static void buildElementToken(const GEO_Detail *gdp,
41  GA_Offset vertex, UT_String &token,
42  GA_Index offset = GA_Index(0));
43 
44 private:
45 
46  void init() override;
47  void finish() override;
48  bool dispatch(char c) override;
49 
50  // State Handlers
51  void handleStart() override;
52  void handleError() override;
53 
54  void handleCollectPrim();
55  void handleCollectPrim1();
56  void handleCollectName();
57  void handleCollectVertex0();
58  void handleCollectVertex1();
59 
60  // State Variables
61  GA_Index myPrimIndex;
62  GA_Index myPrim1;
63  int myVertex0;
64  int myVertex1;
65 
66  // Vertex Specific Methods
67  bool addVertex();
68  bool addAllPrimVertices(GA_Offset primoff = GA_INVALID_OFFSET);
69  bool addVertexRange(int u0, int u1);
70  bool addPrimGroup(const char *name);
71  bool addVertexGroup(const char *name);
72 
73  // Primitive Specific Methods
74  bool addPrimRange(int u0, int u1);
75 
76  // Utility methods
77  GA_Offset getPrim();
78 
79 
80  const GEO_Detail &myGdp;
81  GA_VertexGroupUPtr myGroup;
82  GOP_Manager *myManager;
83  bool myStrictFlag;
84  GA_Index myPrimOffset;
85 };
86 
87 
88 #endif
SIM_API const UT_StringHolder vertex
UT_UniquePtr< GA_VertexGroup > GA_VertexGroupUPtr
virtual bool dispatch(char c)=0
GLdouble u1
Definition: glad.h:2676
virtual void finish()
#define GA_INVALID_OFFSET
Definition: GA_Types.h:678
#define GOP_API
Definition: GOP_API.h:10
GA_Size GA_Offset
Definition: GA_Types.h:641
GLintptr offset
Definition: glcorearb.h:665
virtual void handleError()=0
GLuint const GLchar * name
Definition: glcorearb.h:786
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:635
virtual void init()
virtual void handleStart()=0