HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_LoadOptions.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: GA_LoadOptions.h (GA Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GA_LoadOptions__
12 #define __GA_LoadOptions__
13 
14 #include "GA_API.h"
15 #include <UT/UT_Options.h>
16 
17 /// Class to specify options for loading geometry
19 {
20 public:
22  : UT_Options()
23  {
24  }
25  ~GA_LoadOptions() override;
26 
28  {
30  return *this;
31  }
32 
33 #define BOOL_ACCESSOR(NAME, GET, IMPORT, SET, DEFAULT) \
34  static const char *GET##Name() { return NAME; } \
35  bool IMPORT(bool &v) const { return importOption(NAME, v); } \
36  bool GET() const { \
37  bool v; \
38  if (!importOption(NAME, v)) v = DEFAULT; \
39  return v; \
40  } \
41  void SET(bool v) { setOptionB(UTmakeUnsafeRef(NAME), v); }
42 #define INT_ACCESSOR(NAME, GET, IMPORT, SET, DEFAULT) \
43  static const char *GET##Name() { return NAME; } \
44  bool IMPORT(int32 &v) const { return importOption(NAME, v); } \
45  bool IMPORT(int64 &v) const { return importOption(NAME, v); } \
46  int64 GET() const { \
47  int64 v; \
48  if (!importOption(NAME, v)) v = DEFAULT; \
49  return v; \
50  } \
51  void SET(int64 v) { setOptionI(UTmakeUnsafeRef(NAME), v); }
52 #define REAL_ACCESSOR(NAME, GET, IMPORT, SET, DEFAULT) \
53  static const char *GET##Name() { return NAME; } \
54  bool IMPORT(fpreal32 &v) const { return importOption(NAME, v); } \
55  bool IMPORT(fpreal64 &v) const { return importOption(NAME, v); } \
56  fpreal64 GET() const { \
57  fpreal64 v; \
58  if (!importOption(NAME, v)) v = DEFAULT; \
59  return v; \
60  } \
61  void SET(fpreal64 v) { setOptionI(UTmakeUnsafeRef(NAME), v); }
62 #define STR_ACCESSOR(NAME, GET, IMPORT, SET) \
63  static const char *GET##Name() { return NAME; } \
64  bool IMPORT(UT_StringHolder &v) const { return importOption(NAME, v); } \
65  UT_StringHolder GET() const { return getOptionS(NAME); } \
66  void SET(const UT_StringHolder &v) { setOptionS(UTmakeUnsafeRef(NAME), v); }
67 
68  /// @{
69  /// Tell the loader that the geometry loaded will be read-only (never
70  /// modified - i.e. no new points, no new attributes, no modification of
71  /// data, etc.). This lets the loader perform things like
72  /// on-demand/deferred loading of data.
73  BOOL_ACCESSOR("geo:readonly", readOnly, importReadOnly, setReadOnly, false)
74  /// @}
75 
76  /// @{
77  /// The @c fileversion option is set to the value of the tag in the JSON
78  /// file.
79  STR_ACCESSOR("fileversion", fileversion, importFileVersion, setFileversion)
80  /// @}
81 
82  /// @{
83  /// The @c geo:attributeloadmask is a "mask" to specify which attributes
84  /// should be loaded. The mask is in the form used by
85  /// UT_String::multiMatch()
86  STR_ACCESSOR("geo:attributeloadmask",
87  attributeLoadMask, importAttributeLoadMask, setAttributeLoadMask)
88  /// @}
89 
90  /// @{
91  /// The @c geo:grouploadmask is a "mask" to specify which groups should be
92  /// loaded. The mask is in the form used by UT_String::multiMatch()
93  STR_ACCESSOR("geo:grouploadmask", groupLoadMask,
94  importGroupLoadMask, setGroupLoadMask)
95  /// @}
96 
97  /// @{
98  /// Whether to load primitives, or just load the points for the geometry
99  BOOL_ACCESSOR("geo:loadprimitives", loadPrimitives,
100  importLoadPrimitives, setLoadPrimitives, true)
101  /// @}
102 
103  /// @{
104  /// Whether to disable load warnings
105  BOOL_ACCESSOR("geo:disable_warnings", disableWarnings,
106  importDisableWarnings, setDisableWarnings, false)
107  /// @}
108 
109  /// @{
110  /// When loading classic Houdini files, an attribute translation file can
111  /// be applied. This is normally $HH/GEOclassicXlate.xml, but can be
112  /// overridden by this option.
113  STR_ACCESSOR("geo:classicxlatefile", classicXlateFile,
114  importClassicXlateFile, setClassicXlateFile)
115  /// @}
116 
117  /// @{
118  /// Internal flag to indicate whether this is a delayed load of data
119  BOOL_ACCESSOR("geo:delayload", delayLoad,
120  importDelayLoad, setDelayLoad, false)
121  /// @}
122 
123  /// @{
124  /// When loading packed geometry, you can override the "viewport level of
125  /// detail" by setting the appropriate value here. Note that not all
126  /// packed primitives respect this option.
127  STR_ACCESSOR("geo:overridePackedViewportLOD", overridePackedViewportLOD,
128  importOverridePackedViewportLOD, setOverridePackedViewportLOD)
129  /// @}
130 
131 #undef STR_ACCESSOR
132 #undef INT_ACCESSOR
133 #undef REAL_ACCESSOR
134 #undef BOOL_ACCESSOR
135 };
136 
137 #endif
const UT_Options & operator=(const UT_Options &src)
Assignment operator.
#define GA_API
Definition: GA_API.h:14
#define BOOL_ACCESSOR(NAME, GET, IMPORT, SET, DEFAULT)
A map of string to various well defined value types.
Definition: UT_Options.h:84
#define STR_ACCESSOR(NAME, GET, IMPORT, SET)
GA_LoadOptions & operator=(const UT_Options &opts)
Class to specify options for loading geometry.