HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_Parm.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_Parm_h__
10 #define __HOM_Parm_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_Defines.h"
14 #include "HOM_Errors.h"
15 #include "HOM_BaseKeyframe.h"
16 #include "HOM_PtrOrNull.h"
17 #include <string>
18 #include <map>
19 #include <vector>
20 class HOM_Color;
21 class HOM_ParmTemplate;
22 class HOM_ParmTuple;
23 class HOM_Track;
24 class HOM_Ramp;
25 class HOM_Geometry;
26 class UT_WorkBuffer;
27 
28 SWIGOUT(%rename(Parm) HOM_Parm;)
29 
31 {
32 public:
34  { HOM_CONSTRUCT_OBJECT(this) }
35  HOM_Parm(const HOM_Parm &parm)
36  { HOM_CONSTRUCT_OBJECT(this) }
37  virtual ~HOM_Parm()
38  { HOM_DESTRUCT_OBJECT(this) }
39 
40  // We compare against a pointer instead of a reference because we want
41  // to be able to compare against None.
42  virtual bool operator==(HOM_PtrOrNull<HOM_Parm> parm) = 0;
43  virtual bool operator!=(HOM_PtrOrNull<HOM_Parm> parm) = 0;
44  SWIGOUT(%ignore operator<(HOM_Parm *parm);)
45  virtual bool operator<(HOM_Parm *parm) = 0;
46 
47  virtual int __hash__() = 0;
48  virtual std::string __repr__() = 0;
49 
50  SWIGOUT(%newobject node;)
51  virtual HOM_Node *node() = 0;
52 
53  SWIGOUT(%newobject tuple;)
54  SWIGOUT(%warnfilter(321) tuple;)
55  virtual HOM_ParmTuple *tuple() = 0;
56 
57  SWIGOUT(%newobject parmTemplate;)
58  virtual HOM_ParmTemplate *parmTemplate() = 0;
59 
60  virtual std::string name() = 0;
61  virtual std::string path() = 0;
62  virtual std::string description() = 0;
63  virtual int componentIndex() = 0;
64 
65  virtual std::vector<std::string> menuLabels() = 0;
66  virtual std::vector<std::string> menuItems() = 0;
67 
68  SWIGOUT(%kwargs pressButton;)
69  virtual void pressButton(std::map<std::string, hboost::any> const & arguments=std::map<std::string, hboost::any>()) = 0;
70 
71  virtual void _set(double float_value) = 0;
72  virtual void _setPending(double float_value) = 0;
73  virtual void _set(int int_value) = 0;
74  virtual void _setPending(int int_value) = 0;
75  virtual void _set(const char *string_value) = 0;
76  virtual void _setPending(const char *string_value) = 0;
77  virtual void _set(HOM_Geometry *geo) = 0;
78  virtual void _setPending(HOM_Geometry *geo) = 0;
79  virtual void _set(const std::map<std::string, std::string> &map) = 0;
80  virtual void _setPending(const std::map<std::string, std::string> &map) = 0;
81  virtual void _set(HOM_Ramp *ramp_value) = 0;
82  virtual void _setPending(HOM_Ramp *ramp_value) = 0;
83 
84  virtual void _set(
85  HOM_Parm &parm, HOM_EnumValue *language=nullptr,
86  bool follow_parm_reference=true) = 0;
87 
88  virtual void setFromParm(HOM_Parm &src) = 0;
89  virtual void setFromParmDefaults(HOM_Parm &src) = 0;
90 
91  virtual void revertToDefaults() = 0;
92  virtual void revertToAndRestorePermanentDefaults() = 0;
93  virtual bool hasTemporaryDefaults() = 0;
94  SWIGOUT(%kwargs isAtDefault;)
95  virtual bool isAtDefault(bool compare_temporary_defaults=true,
96  bool compare_expressions=true) = 0;
97 
98  SWIGOUT(%kwargs setExpression;)
99  virtual void setExpression(const char *expression,
100  HOM_EnumValue *language = NULL,
101  bool replace_expression=true) = 0;
102  virtual std::string expression() = 0;
103 
104  virtual HOM_EnumValue *expressionLanguage() = 0;
105 
106  virtual std::string rawValue() = 0;
107 
108  virtual bool isShowingExpression() = 0;
109  virtual void showExpression(bool value) = 0;
110 
111  virtual void setKeyframe(HOM_BaseKeyframe &keyframe) = 0;
112  virtual void setKeyframes(const std::vector<HOM_BaseKeyframe *> &keyframes) = 0;
113 
114  virtual std::vector<HOM_ElemPtr<HOM_BaseKeyframe> > keyframes() = 0;
115 
116  virtual std::vector<HOM_ElemPtr<HOM_BaseKeyframe> >
117  keyframesInRange(double start_frame, double end_frame) = 0;
118 
119  virtual std::vector<HOM_ElemPtr<HOM_BaseKeyframe> > keyframesBefore(double frame) = 0;
120  virtual std::vector<HOM_ElemPtr<HOM_BaseKeyframe> > keyframesAfter(double frame) = 0;
121 
122  virtual double evalAsFloat() = 0;
123  virtual double evalAsFloatAtFrame(double frame) = 0;
124  virtual int evalAsInt() = 0;
125  virtual int evalAsIntAtFrame(double frame) = 0;
126  virtual std::string evalAsString() = 0;
127  virtual std::string evalAsStringAtFrame(double frame) = 0;
128  virtual HOM_Geometry *evalAsGeometry() = 0;
129  virtual HOM_Geometry *evalAsGeometryAtFrame(double frame) = 0;
130  virtual std::map<std::string, std::string> evalAsJSONMap() = 0;
131  virtual std::map<std::string, std::string>
132  evalAsJSONMapAtFrame(double frame) = 0;
133  SWIGOUT(%newobject evalAsRamp;)
134  virtual HOM_Ramp *evalAsRamp() = 0;
135  SWIGOUT(%newobject evalAsRampAtFrame;)
136  virtual HOM_Ramp *evalAsRampAtFrame(double frame) = 0;
137  SWIGOUT(%newobject evalAsNode;)
138  virtual HOM_Node *evalAsNode() = 0;
139  SWIGOUT(%newobject evalAsNodeAtFrame;)
140  virtual HOM_Node *evalAsNodeAtFrame(double frame) = 0;
141  virtual std::vector<HOM_ElemPtr<HOM_Node> > evalAsNodes() = 0;
142  virtual std::vector<HOM_ElemPtr<HOM_Node> > evalAsNodesAtFrame(double frame) = 0;
143  virtual std::string evalAsNodePath() = 0;
144  virtual std::string evalAsNodePathAtFrame(double frame) = 0;
145  virtual std::vector<std::string> evalAsNodePaths() = 0;
146  virtual std::vector<std::string> evalAsNodePathsAtFrame(double frame) = 0;
147 
148  virtual std::string unexpandedString() = 0;
149 
150  virtual void deleteKeyframeAtFrame(double frame) = 0;
151 
152  virtual void deleteAllKeyframes() = 0;
153 
154  // TODO: Rename this to referencedParm()!
155  SWIGOUT(%newobject getReferencedParm;)
156  virtual HOM_Parm *getReferencedParm() = 0;
157 
158  virtual std::vector<HOM_ElemPtr<HOM_Parm> > parmsReferencingThis() = 0;
159 
160  virtual bool isLocked() = 0;
161  virtual void lock(bool on) = 0;
162 
163  virtual bool isAutoscoped() = 0;
164  virtual void setAutoscope(bool on) = 0;
165 
166  virtual bool isScoped() = 0;
167  virtual void setScope(bool on) = 0;
168 
169  virtual bool isAutoSelected() = 0;
170  virtual void setAutoSelect(bool on) = 0;
171 
172  virtual bool isSelected() = 0;
173  virtual void setSelect(bool on) = 0;
174 
175  virtual std::string alias() = 0;
176  virtual void setAlias(const char *alias_name) = 0;
177 
178  virtual bool isSpare() = 0;
179 
180  virtual bool isTimeDependent() = 0;
181 
182  virtual bool isMultiParmInstance() = 0;
183  virtual bool isMultiParmParent() = 0;
184  SWIGOUT(%newobject parentMultiParm;)
185  virtual HOM_Parm *parentMultiParm() = 0;
186  virtual std::vector<int> multiParmInstanceIndices() = 0;
187 
188  virtual int multiParmInstancesPerItem() = 0;
189  virtual int multiParmInstancesCount() = 0;
190  virtual int multiParmStartOffset() = 0;
191 
192  virtual std::vector<HOM_ElemPtr<HOM_Parm> > multiParmInstances() = 0;
193 
194  virtual void insertMultiParmInstance(int inst_index) = 0;
195 
196  virtual void removeMultiParmInstance(int inst_index) = 0;
197 
198  virtual std::vector<std::string> containingFolders() = 0;
199  virtual std::vector<int> containingFolderIndices() = 0;
200  virtual std::vector<HOM_ElemPtr<HOM_ParmTuple> >
201  containingFolderSetParmTuples() = 0;
202 
203  SWIGOUT(%kwargs asCode;)
204  virtual std::string asCode(
205  bool brief = false,
206  bool save_values = true,
207  bool save_keyframes = true,
208  bool save_keys_in_frames=false,
209  bool save_flag_values=true,
210  bool save_aliases=true,
211  const char *function_name = NULL) = 0;
212 
213  // You can get the parm data type with parmTemplate().dataType().
214  // However, we need a way to get the parm data type's enum value
215  // from C++ code without creating a temporary ParmTemplate object,
216  // so that's why parmDataTypeEnumId() exists.
217  SWIGOUT(%ignore parmDataTypeEnumId;)
218  virtual int parmDataTypeEnumId() = 0;
219 
220  // For data parameters only.
221  // You can get the data parm type with parmTemplate().dataParmType().
222  // However, we need a way to get the data parm type's enum value
223  // from C++ code without creating a temporary ParmTemplate object,
224  // so that's why dataParmTypeEnumId() exists.
225  SWIGOUT(%ignore dataParmTypeEnumId;)
226  virtual int dataParmTypeEnumId() = 0;
227 
228  SWIGOUT(%newobject createClip;)
229  virtual HOM_Node *createClip(HOM_Node &parent_node,
230  const char *name,
231  bool create_new,
232  bool apply_immediately,
233  bool current_value_only=false,
234  bool create_locked=false,
235  bool set_value_to_default=false) = 0;
236 
237  virtual void appendClip(HOM_Node &chop_node,
238  bool apply_immediately,
239  bool current_value_only=false,
240  bool create_locked=false,
241  bool set_value_to_default=false) = 0;
242 
243  virtual HOM_BinaryString _clipData(double start,
244  double end,
245  bool binary = true,
246  bool use_blosc_compression = true,
247  double sample_rate = 0) = 0;
248 
249  SWIGOUT(%kwargs _setClipData;)
250  virtual void _setClipData(HOM_BinaryString data,
251  bool binary = true,
252  bool blosc_compressed = true,
253  double sample_rate = 0,
254  double start = HOM_MIN_NEGATIVE_DOUBLE) = 0;
255 
256  virtual void _saveClip(std::string file_name,
257  double start,
258  double end,
259  double sample_rate = 0) = 0;
260 
261  SWIGOUT(%kwargs _loadClip;)
262  virtual void _loadClip(std::string file_name,
263  double sample_rate = 0,
264  double start = HOM_MIN_NEGATIVE_DOUBLE) = 0;
265 
266  SWIGOUT(%newobject overrideTrack;)
267  virtual HOM_Track *overrideTrack() = 0;
268  virtual bool isOverrideTrackActive() = 0;
269 
270  virtual void copyToParmClipboard() = 0;
271 
272  virtual bool isDisabled() = 0;
273 
274  virtual void disable(bool on) = 0;
275 
276  virtual bool isHidden() = 0;
277 
278  virtual void hide(bool on) = 0;
279 
280  virtual bool isVisible() = 0;
281 
282  virtual bool isConstrained() = 0;
283 
284  virtual HOM_EnumValue &keyframeExtrapolation( bool before ) = 0;
285 
286  virtual void setKeyframeExtrapolation( bool before, HOM_EnumValue &e ) = 0;
287 
288  virtual void keyframesRefit(
289  bool refit, double refit_tol, bool refit_preserve_extrema,
290  bool refit_bezier, bool resample, double resample_rate, double resample_tol,
291  bool range, double range_start, double range_end, HOM_EnumValue &bake_chop, const char *expression="") = 0;
292 
293  SWIGOUT(%newobject uiBackgroundColor;)
294  virtual HOM_Color *uiBackgroundColor() = 0;
295 
296  virtual void _moveKeyframes(const std::vector<int> &keyframe_ids,
297  const std::vector<double> &time_offsets,
298  const std::vector<double> &value_offsets) = 0;
299 
300  virtual void _deleteKeyframes(const std::vector<int> &keyframe_ids) = 0;
301 
302  virtual void _moveAllKeyframes( double time_offset, double value_offset)=0;
303 
304 #ifdef SWIG
305 %extend
306 {
307  %warnfilter(321) eval;
308  InterpreterObject eval()
309  {
310  return HOMevalParm(*self);
311  }
312 
313  InterpreterObject evalAtFrame(double frame)
314  {
315  return HOMevalParmAtFrame(*self, frame);
316  }
317 
318  InterpreterObject evalAtTime(double time)
319  {
320  return HOMevalParmAtFrame(*self, HOM().timeToFrame(time));
321  }
322 }
323 #endif
324 };
325 
326 #endif
virtual ~HOM_Parm()
Definition: HOM_Parm.h:37
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1238
GT_API const UT_StringHolder time
GLuint start
Definition: glcorearb.h:474
OIIO_API bool rename(string_view from, string_view to, std::string &err)
const GLuint GLenum const void * binary
Definition: glcorearb.h:1923
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:353
GLuint const GLchar * name
Definition: glcorearb.h:785
GLenum src
Definition: glcorearb.h:1792
PUGI__FN xpath_string string_value(const xpath_node &na, xpath_allocator *alloc)
Definition: pugixml.cpp:7757
#define HOM_API
Definition: HOM_API.h:13
GLuint GLuint end
Definition: glcorearb.h:474
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1237
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:570
char * lock(exint offset=0, exint reserve_bytes=0)
#define HOM_MIN_NEGATIVE_DOUBLE
Definition: HOM_Defines.h:46
HUSD_API bool eval(VtValue &val, T &ret_val)
GLboolean * data
Definition: glcorearb.h:130
HOM_Parm(const HOM_Parm &parm)
Definition: HOM_Parm.h:35
HOM_Parm()
Definition: HOM_Parm.h:33
GLsizei const GLfloat * value
Definition: glcorearb.h:823
GLenum GLint * range
Definition: glcorearb.h:1924
ImageBuf OIIO_API resample(const ImageBuf &src, bool interpolate=true, ROI roi={}, int nthreads=0)
HOM_API HOM_Module & HOM()
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:556