HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GABC_OOptions.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) COPYRIGHTYEAR
3  * Side Effects Software Inc. All rights reserved.
4  *
5  * Redistribution and use of Houdini Development Kit samples in source and
6  * binary forms, with or without modification, are permitted provided that the
7  * following conditions are met:
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * 2. The name of Side Effects Software may not be used to endorse or
11  * promote products derived from this software without specific prior
12  * written permission.
13  *
14  * THIS SOFTWARE IS PROVIDED BY SIDE EFFECTS SOFTWARE `AS IS' AND ANY EXPRESS
15  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17  * NO EVENT SHALL SIDE EFFECTS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  *----------------------------------------------------------------------------
26  */
27 
28 #ifndef __GABC_OOptions__
29 #define __GABC_OOptions__
30 
31 #include "GABC_API.h"
32 #include "GABC_Include.h"
33 #include <UT/UT_String.h>
34 #include <UT/UT_StringHolder.h>
35 #include <GA/GA_Types.h>
38 
39 namespace GABC_NAMESPACE
40 {
41 
42 /// This class specifies the options used during Alembic archive export.
43 /// In practice, these options are passed by reference to const, so they are
44 /// set once during setup and never modified during the entrie output process.
46 {
47 public:
49 
50  GABC_OOptions();
51  virtual ~GABC_OOptions() {};
52 
53  /// Method to return the time sampling pointer for output
54  virtual const TimeSamplingPtr &timeSampling() const = 0;
55 
56  /// @{
57  /// The first frame of output
58  exint firstFrame() const { return myFirstFrame; }
59  void setFirstFrame(exint f) { myFirstFrame = f; }
60  /// @}
61  /// @{
62  /// Whether to cook full bounding boxes for all nodes
63  bool fullBounds() const { return myFullBounds; }
64  void setFullBounds(bool f) { myFullBounds = f; }
65  /// @}
66 
67  /// @{
68  /// Set path attribute for writing geometry to a specific hierarchy.
69  const char *pathAttribute() const { return myPathAttribute.buffer(); }
70  void setPathAttribute(const char *s) { myPathAttribute.harden(s); }
71  /// @}
72 
73  /// @{
74  /// Group name to identify subdivision surfaces
75  const char *subdGroup() const { return mySubdGroup.buffer(); }
76  void setSubdGroup(const char *g) { mySubdGroup.harden(g); }
77  /// @}
78 
79  /// @{
80  /// Set attribute masks and compare attributes against the masks
81  bool matchAttribute(Alembic::AbcGeom::GeometryScope scope,
82  const char *name) const;
83  bool matchAttribute(GA_AttributeOwner own, const char *name) const;
84  const char *getAttributePattern(GA_AttributeOwner own) const
85  { return myAttributePatterns[own].buffer(); }
86  void setAttributePattern(GA_AttributeOwner own, const char *pattern)
87  {
88  myAttributePatterns[own].harden(pattern);
89  }
90  /// @}
91 
92  /// @{
93  /// Pattern of uniform attributes to convert into detail/constant attributes
94  const char *primToDetailPattern() const
95  { return myPrimToDetailPattern; }
96  void setPrimToDetailPattern(const char *s)
97  { myPrimToDetailPattern.harden(s); }
98  /// @}
99 
100  /// @{
101  /// Check whether uniform attributes are constant value before coalescing
102  bool forcePrimToDetail() const
103  { return myForcePrimToDetail; }
105  { myForcePrimToDetail = v; }
106  /// @}
107 
108  /// @{
109  /// Pattern of attributes to save as arrays instead of scalars
110  bool matchArrayAttribPattern(const char *name) const;
111  const char *arrayAttribPattern() const
112  { return myArrayAttribPattern; }
113  void setArrayAttribPattern(const char *s)
114  { myArrayAttribPattern.harden(s); }
115  /// @}
116 
117  /// @{
118  /// Pattern matching for multiple uv sets
119  const char *uvAttribPattern() const { return myUVAttribPattern.buffer(); }
120  void setUVAttribPattern(const char *pattern) { myUVAttribPattern.harden(pattern); }
121  /// @}
122 
123 private:
124  UT_String mySubdGroup;
125  UT_String myPathAttribute;
126  UT_String myAttributePatterns[GA_ATTRIB_OWNER_N];
127  UT_String myPrimToDetailPattern;
128  UT_String myArrayAttribPattern;
129  UT_String myUVAttribPattern;
130  exint myFirstFrame;
131  bool myFullBounds;
132  bool myForcePrimToDetail;
133 };
134 
135 } // end GABC_NAMESPACE
136 
137 #endif
void setSubdGroup(const char *g)
Definition: GABC_OOptions.h:76
const GLdouble * v
Definition: glcorearb.h:836
const char * uvAttribPattern() const
GLboolean GLboolean g
Definition: glcorearb.h:1221
const char * primToDetailPattern() const
Definition: GABC_OOptions.h:94
void setUVAttribPattern(const char *pattern)
Alembic::AbcCoreAbstract::TimeSamplingPtr TimeSamplingPtr
Definition: GABC_OOptions.h:48
const char * subdGroup() const
Definition: GABC_OOptions.h:75
#define GABC_NAMESPACE
Definition: GABC_API.h:42
Alembic::Util::shared_ptr< TimeSampling > TimeSamplingPtr
Definition: TimeSampling.h:137
GLfloat f
Definition: glcorearb.h:1925
void setAttributePattern(GA_AttributeOwner own, const char *pattern)
Definition: GABC_OOptions.h:86
int64 exint
Definition: SYS_Types.h:115
const char * pathAttribute() const
Definition: GABC_OOptions.h:69
GLuint const GLchar * name
Definition: glcorearb.h:785
const char * getAttributePattern(GA_AttributeOwner own) const
Definition: GABC_OOptions.h:84
void setArrayAttribPattern(const char *s)
void setPrimToDetailPattern(const char *s)
Definition: GABC_OOptions.h:96
GA_AttributeOwner
Definition: GA_Types.h:33
const char * arrayAttribPattern() const
#define GABC_API
Definition: GABC_API.h:37
void setPathAttribute(const char *s)
Definition: GABC_OOptions.h:70