HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_ui.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_ui_h__
10 #define __HOM_ui_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_Defines.h"
14 #include "HOM_Module.h"
15 #include "HOM_Attrib.h"
16 #include "HOM_EnumValue.h"
17 #include "HOM_EnumModules.h"
18 #include "HOM_Color.h"
19 #include "HOM_Errors.h"
20 #include <PY/PY_Callback.h>
21 #include <PY/PY_Python.h>
22 #include <UT/UT_StringHolder.h>
23 #include <UT/UT_Tuple.h>
24 #include <vector>
25 
26 class HOM_ShellIO;
27 class HOM_Desktop;
28 class HOM_Pane;
29 class HOM_PaneTab;
30 class HOM_FloatingPanel;
31 class HOM_NodeType;
32 class HOM_Node;
33 class HOM_RadialMenu;
34 class HOM_RopNode;
35 class HOM_Dialog;
38 class HOM_SopNodeType;
39 
40 SWIGOUT(%rename(ui) HOM_ui;)
42 {
43 public:
44  virtual ~HOM_ui()
45  {}
46 
47  virtual std::string __repr__() = 0;
48 
49  virtual HOM_ShellIO &shellIO() = 0;
50 
51  SWIGOUT(%newobject curDesktop;)
52  virtual HOM_Desktop* curDesktop() = 0;
53  SWIGOUT(%newobject desktop;)
54  virtual HOM_Desktop* desktop(const char *name) = 0;
55 
56  virtual std::vector<HOM_ElemPtr<HOM_Desktop> > desktops() = 0;
57 
58  virtual HOM_RadialMenu* radialMenu(const std::string &name) = 0;
59  virtual std::vector<HOM_ElemPtr<HOM_RadialMenu> > radialMenus() = 0;
60  virtual HOM_RadialMenu* createRadialMenu(const std::string &name,
61  const char *label) = 0;
62 
63  virtual std::vector<HOM_ElemPtr<HOM_Pane> > panes() = 0;
64  virtual std::vector<HOM_ElemPtr<HOM_PaneTab> > paneTabs() = 0;
65 
66  virtual std::vector<HOM_ElemPtr<HOM_PaneTab> > currentPaneTabs() = 0;
67 
68  SWIGOUT(%newobject paneTabOfType;)
69  virtual HOM_PaneTab *paneTabOfType(HOM_EnumValue &type, int index=0) = 0;
70 
71  SWIGOUT(%newobject findPane;)
72  virtual HOM_Pane *findPane(int pane_id) = 0;
73 
74  SWIGOUT(%newobject findPaneTab;)
75  virtual HOM_PaneTab *findPaneTab(const char *name) = 0;
76 
77  virtual std::vector<HOM_ElemPtr<HOM_PaneTab> > floatingPaneTabs() = 0;
78 
79  virtual std::vector<HOM_ElemPtr<HOM_FloatingPanel> > floatingPanels() = 0;
80 
81  SWIGOUT(%newobject paneUnderCursor;)
82  virtual HOM_Pane *paneUnderCursor() = 0;
83  SWIGOUT(%newobject paneTabUnderCursor;)
84  virtual HOM_PaneTab *paneTabUnderCursor() = 0;
85 
86  virtual HOM_EnumValue &orientationUpAxis() = 0;
87  virtual HOM_EnumValue &handleOrientToNormalAxis() = 0;
88 
89  SWIGOUT(%kwargs displayConfirmation;)
90  virtual bool displayConfirmation(
91  const char *text,
92  HOM_EnumValue &severity = HOM_severityType::Message,
93  const char *help = NULL,
94  const char *title = NULL,
95  const char *details = NULL,
96  const char *details_label = NULL,
97  HOM_EnumValue &suppress = HOM_confirmType::OverwriteFile) = 0;
98 
99  SWIGOUT(%kwargs displayMessage;)
100  virtual int displayMessage(
101  const char *text,
102  const std::vector<std::string> &buttons =
103  std::vector<std::string>(1, "OK"),
104  HOM_EnumValue &severity = HOM_severityType::Message,
105  int default_choice = 0,
106  int close_choice = -1,
107  const char *help = NULL,
108  const char *title = NULL,
109  const char *details = NULL,
110  const char *details_label = NULL,
111  bool details_expanded = false) = 0;
112 
113  SWIGOUT(%kwargs readInput;)
114  virtual std::pair<int, std::string> readInput(
115  const char *message,
116  const std::vector<std::string> &buttons =
117  std::vector<std::string>(1, "OK"),
118  HOM_EnumValue &severity = HOM_severityType::Message,
119  int default_choice = 0,
120  int close_choice = -1,
121  const char *help = NULL,
122  const char *title = NULL,
123  const char *initial_contents = NULL) = 0;
124 
125  SWIGOUT(%kwargs readMultiInput;)
126  virtual std::pair<int, std::vector<std::string> > readMultiInput(
127  const char *message,
128  const std::vector<std::string> &input_labels,
129  const std::vector<int> &password_input_indices = std::vector<int>(),
130  const std::vector<std::string> &buttons =
131  std::vector<std::string>(1, "OK"),
132  HOM_EnumValue &severity = HOM_severityType::Message,
133  int default_choice = 0,
134  int close_choice = -1,
135  const char *help = NULL,
136  const char *title = NULL,
137  const std::vector<std::string> &initial_contents =
138  std::vector<std::string>() ) = 0;
139 
140  SWIGOUT(%kwargs selectFromList;)
141  virtual std::vector<int> selectFromList(
142  const std::vector<std::string> &choices,
143  const std::vector<int> &default_choices = std::vector<int>(),
144  bool exclusive = false,
145  const char *message = NULL,
146  const char *title = NULL,
147  const char *column_header = "Choices",
148  int num_visible_rows = 10,
149  bool clear_on_cancel = false) = 0;
150 
151  SWIGOUT(%kwargs selectFromTree;)
152  virtual std::vector<std::string> selectFromTree(
153  const std::vector<std::string> &choices,
154  const std::vector<std::string> &picked = std::vector<std::string>(),
155  bool exclusive = false,
156  const char *message = NULL,
157  const char *title = NULL,
158  bool clear_on_cancel = false) = 0;
159 
160  SWIGOUT(%kwargs selectFile;)
161  virtual std::string selectFile(
162  const char *start_directory = NULL,
163  const char *title = NULL,
164  bool collapse_sequences = false,
165  HOM_EnumValue &file_type = HOM_fileType::Any,
166  const char *pattern = NULL,
167  const char *default_value = NULL,
168  bool multiple_select = false,
169  bool image_chooser = false,
170  HOM_EnumValue &chooser_mode = HOM_fileChooserMode::ReadAndWrite) = 0;
171 
172  SWIGOUT(%kwargs selectNode;)
173  SWIGOUT(%newobject selectNode;)
174  virtual char *selectNode(
175  HOM_Node *relative_to_node = NULL,
176  HOM_Node *initial_node = NULL,
177  HOM_EnumValue *node_type_filter = NULL) = 0;
178 
179  SWIGOUT(%kwargs selectMultipleNodes;)
180  virtual std::vector<std::string> selectMultipleNodes(
181  HOM_Node *relative_to_node = NULL,
182  HOM_Node *initial_node = NULL,
183  HOM_EnumValue *node_type_filter = NULL) = 0;
184 
185  SWIGOUT(%ignore _selectNodeDataInternal;)
186  virtual std::vector<std::string> _selectNodeDataInternal(
187  const char *title = NULL,
188  const char *message = NULL,
189  int width = 0,
190  int height = 0,
191  const std::vector<std::string> &
192  initial_selection = std::vector<std::string>(),
193  HOM_EnumValue *node_type_filter = nullptr,
194  bool multiple_select = false,
195  bool include_data_type_headers = true,
196  bool include_parms=true,
197  bool include_object_transforms=true,
198  bool include_geometry_bounding_boxes=true,
199  bool include_geometry_attributes=true,
200  bool expand_components=true,
201  void *custom_data_callback=nullptr,
202  const char *help_url=nullptr) = 0;
203 
204  SWIGOUT(%kwargs selectParmTag;)
205  virtual std::vector<std::string> selectParmTag() = 0;
206 
207  SWIGOUT(%kwargs selectParm;)
208  virtual std::vector<std::string> selectParm(
210  bool bound_parms_only = false,
211  HOM_Node *relative_to_node = NULL,
212  const char *message = NULL,
213  const char *title = NULL,
214  const std::vector<std::string> &
215  initial_parms = std::vector<std::string>(),
216  bool multiple_select = true) = 0;
217 
218  SWIGOUT(%kwargs selectParmTuple;)
219  virtual std::vector<std::string> selectParmTuple(
221  bool bound_parms_only = false,
222  HOM_Node *relative_to_node = NULL,
223  const char *message = NULL,
224  const char *title = NULL,
225  const std::vector<std::string> &
226  initial_parm_tuples = std::vector<std::string>(),
227  bool multiple_select = true) = 0;
228 
229  SWIGOUT(%kwargs selectColor;)
230  SWIGOUT(%newobject selectColor;)
231  virtual HOM_Color *selectColor(HOM_Color *initial_color = NULL) = 0;
232 
233  SWIGOUT(%kwargs _openColorEditor;)
234  virtual void _openColorEditor(
235  void *color_changed_callback, bool include_alpha=false,
236  HOM_Color *initial_color=nullptr, float initial_alpha=1.0f) = 0;
237 
238  virtual std::vector<HOM_Color> loadPaletteFile(const char *file) = 0;
239  virtual void savePaletteFile(const char *file,
240  const std::vector<HOM_Color> &colors) = 0;
241 
242  SWIGOUT(%ignore _openValueLadder;)
243  SWIGOUT(%kwargs _openValueLadder;)
244  virtual void _openValueLadder(
245  float initial_value, void *value_changed_callback,
246  HOM_EnumValue &type=HOM_valueLadderType::Generic,
247  HOM_EnumValue &data_type=HOM_valueLadderDataType::Float) = 0;
248  virtual void updateValueLadder(
249  int cursor_x, int cursor_y, bool alt_key, bool shift_key) = 0;
250  virtual void closeValueLadder() = 0;
251 
252  SWIGOUT(%kwargs displayFileDependencyDialog;)
253  virtual UT_Tuple<bool,
254  std::vector<std::pair<HOM_ElemPtr<HOM_Parm>, std::string> > >
255  displayFileDependencyDialog(
256  HOM_Node *rop_node = NULL,
257  const std::vector<std::string> &uploaded_files =
258  std::vector<std::string>(),
259  const std::vector<std::string> &forced_unselected_patterns =
260  std::vector<std::string>(),
261  const char *project_dir_variable="HIP",
262  bool is_standalone=true) = 0;
263 
264  virtual void displayNodeHelp(HOM_NodeType &node_type) = 0;
265  virtual void openTypePropertiesDialog(
266  HOM_Node &node, bool promote_spare_parms=false,
267  bool immediately_save=false) = 0;
268  virtual void openTypePropertiesDialog(
269  HOM_NodeType &node_type, bool promote_spare_parms=false,
270  bool immediately_save=false) = 0;
271 
272  virtual void openRenderDialog(HOM_RopNode &rop) = 0;
273 
274  virtual void openRenameSelectedDialog(HOM_Node &network) = 0;
275 
276  virtual HOM_EnumValue &updateMode() = 0;
277 
278  virtual void setUpdateMode(HOM_EnumValue &mode) = 0;
279  virtual void triggerUpdate() = 0;
280  virtual void reloadViewportColorSchemes() = 0;
281 
282  virtual std::vector<int> _getTabMenuIconSize() = 0;
283 
284  SWIGOUT(%ignore addOpaqueSelectionCallback;)
285  virtual void addOpaqueSelectionCallback(void *py_callback) = 0;
286  SWIGOUT(%ignore removeOpaqueSelectionCallback;)
287  virtual void removeOpaqueSelectionCallback(void *py_callback) = 0;
288  virtual void removeAllSelectionCallbacks() = 0;
289  SWIGOUT(%ignore opaqueSelectionCallbacks;)
290  virtual std::vector<void *> opaqueSelectionCallbacks() = 0;
291 
292  SWIGOUT(%ignore addOpaqueEventLoopCallback;)
293  virtual void addOpaqueEventLoopCallback(void *callback) = 0;
294  SWIGOUT(%ignore removeOpaqueEventLoopCallback;)
295  virtual void removeOpaqueEventLoopCallback(void *callback) = 0;
296  SWIGOUT(%ignore opaqueEventLoopCallbacks;)
297  virtual std::vector<void *> opaqueEventLoopCallbacks() = 0;
298 
299  SWIGOUT(%newobject createDialog;)
300  virtual HOM_Dialog *createDialog(const char *ui_file_name) = 0;
301  SWIGOUT(%newobject findDialog;)
302  virtual HOM_Dialog *findDialog(const char *ui_file_name) = 0;
303  virtual std::vector<HOM_ElemPtr<HOM_Dialog> > dialogs() = 0;
304 
305  SWIGOUT(%ignore opaqueWaitUntil;)
306  virtual void opaqueWaitUntil(void *condition_callback) = 0;
307 
308  SWIGOUT(%kwargs writePythonShellHistoryFile;)
309  virtual void writePythonShellHistoryFile(const char *filename=NULL) = 0;
310 
311  SWIGOUT(%kwargs readPythonShellHistoryFile;)
312  virtual void readPythonShellHistoryFile(const char *filename=NULL) = 0;
313 
314  SWIGOUT(%kwargs setStatusMessage;)
315  virtual void setStatusMessage(
316  const char *message,
317  HOM_EnumValue &severity=HOM_severityType::Message) = 0;
318 
319  virtual void openAssetUploadDialog(
320  HOM_Node *uploading_node, const char *session_key,
321  HOM_Node *containing_node) = 0;
322 
323  virtual void openAssetDependenciesDialog(
324  const std::vector<HOM_Node *> &uploading_nodes,
325  const std::vector<HOM_Node *> &uploaded_nodes,
326  const char *session_key,
327  HOM_Node *containing_node) = 0;
328 
329  virtual bool hasDragSourceData(const char *label) = 0;
330  virtual HOM_DDSourceAny getDragSourceData(const char *label, int index) = 0;
331 
332  virtual std::string resourceValueFromName(const char *name) = 0;
333  virtual HOM_Color colorFromName(const char *name) = 0;
334 
335  virtual double globalScaleFactor() = 0;
336  virtual int scaledSize(int size) = 0;
337 
338  virtual double inchesToPixels(double inches) = 0;
339  virtual double pixelsToInches(double pixels) = 0;
340 
341  virtual void copyTextToClipboard(const char *text) = 0;
342  virtual std::string getTextFromClipboard() = 0;
343 
344  virtual std::vector<std::string> hotkeys(const char *hotkey_symbol) = 0;
345  virtual std::string hotkeyDescription(const char *hotkey_symbol) = 0;
346  virtual bool isKeyMatch(const char *key, const char *hotkey_symbol) = 0;
347 
348  virtual void openCaptureWeightSpreadsheet(HOM_Node *node,
349  const char *pattern = NULL) = 0;
350 
351  virtual void registerViewerState(HOM_ViewerStateTemplate& vs_templ) = 0;
352  virtual void unregisterViewerState(std::string const& state_typename) = 0;
353  virtual bool isRegisteredViewerState(std::string const& state_name) = 0;
354  virtual void reloadViewerState(std::string const& state_typename) = 0;
355  SWIGOUT(%kwargs reloadViewerStates;)
356  virtual void reloadViewerStates(
357  std::vector<std::string> const& state_names=std::vector<std::string>()) = 0;
358 
359 #ifdef SWIG
360 %extend
361 {
362  SWIGOUT(%kwargs _selectNodeData;)
363  std::vector<std::string> _selectNodeData(
364  const char *title = NULL,
365  const char *message = NULL,
366  int width = 0,
367  int height = 0,
368  const std::vector<std::string> &
369  initial_selection = std::vector<std::string>(),
370  HOM_EnumValue *node_type_filter = nullptr,
371  bool multiple_select = false,
372  bool include_data_type_headers = true,
373  bool include_parms=true,
374  bool include_object_transforms=true,
375  bool include_geometry_bounding_boxes=true,
376  bool include_geometry_attributes=true,
377  bool expand_components=true,
378  InterpreterObject custom_data_callback=nullptr,
379  const char *help_url=nullptr)
380  {
381  if (custom_data_callback && custom_data_callback == Py_None)
382  custom_data_callback = nullptr;
383 
384  return self->_selectNodeDataInternal(
385  title,
386  message,
387  width,
388  height,
389  initial_selection,
390  node_type_filter,
391  multiple_select,
392  include_data_type_headers,
393  include_parms,
394  include_object_transforms,
395  include_geometry_bounding_boxes,
396  include_geometry_attributes,
397  expand_components,
398  custom_data_callback,
399  help_url
400  );
401  }
402 
403  SWIGOUT(%kwargs openColorEditor;)
404  void openColorEditor(
405  InterpreterObject color_changed_callback,
406  bool include_alpha=false,
407  HOM_Color *initial_color=nullptr, float initial_alpha=1.0f)
408  { self->_openColorEditor(
409  color_changed_callback, include_alpha, initial_color, initial_alpha); }
410 
411  SWIGOUT(%kwargs openValueLadder;)
412  void openValueLadder(
413  float initial_value,
414  InterpreterObject value_changed_callback,
415  HOM_EnumValue &type=HOM_valueLadderType::Generic,
416  HOM_EnumValue &data_type=HOM_valueLadderDataType::Float)
417  { self->_openValueLadder(
418  initial_value, value_changed_callback, type, data_type); }
419 
420  void addEventLoopCallback(InterpreterObject callback)
421  { self->addOpaqueEventLoopCallback(callback); }
422 
423  void removeEventLoopCallback(InterpreterObject callback)
424  { self->removeOpaqueEventLoopCallback(callback); }
425 
426  // Note that we return a vector of borrowed references because swig
427  // will increment the reference counts.
428  std::vector<InterpreterObject> eventLoopCallbacks()
429  {
430  std::vector<void *> opaque_callbacks(self->opaqueEventLoopCallbacks());
431 
432  std::vector<InterpreterObject> callbacks;
433  for (int i=0; i< opaque_callbacks.size(); ++i)
434  callbacks.push_back((InterpreterObject)opaque_callbacks[i]);
435  return callbacks;
436  }
437 
438  void waitUntil(InterpreterObject callback)
439  { self->opaqueWaitUntil(callback); }
440 
441  void addSelectionCallback(InterpreterObject callback)
442  { self->addOpaqueSelectionCallback(callback); }
443 
444  void removeSelectionCallback(InterpreterObject callback)
445  { self->removeOpaqueSelectionCallback(callback); }
446 
447  std::vector<InterpreterObject> selectionCallbacks()
448  {
449  std::vector<void *> opaque_callbacks = self->opaqueSelectionCallbacks();
450  std::vector<InterpreterObject> callbacks;
451 
452  for (int i = 0, n = opaque_callbacks.size(); i < n; i++)
453  callbacks.push_back((InterpreterObject)opaque_callbacks[i]);
454 
455  return callbacks;
456  }
457 }
458 #endif
459 
460 };
461 
462 #endif
virtual ~HOM_ui()
Definition: HOM_ui.h:44
GT_API const UT_StringHolder filename
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2544
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:344
GLint GLint GLsizei GLint GLenum GLenum const void * pixels
Definition: glcorearb.h:107
std::tuple< Types...> UT_Tuple
Definition: UT_Tuple.h:53
png_uint_32 i
Definition: png.h:2877
GLsizeiptr size
Definition: glcorearb.h:663
GLint GLsizei width
Definition: glcorearb.h:102
GLdouble n
Definition: glcorearb.h:2007
GLfloat f
Definition: glcorearb.h:1925
#define HOM_API
Definition: HOM_API.h:13
Definition: HOM_ui.h:41
GLenum GLenum severity
Definition: glcorearb.h:2538
GLuint const GLchar * name
Definition: glcorearb.h:785
GLenum mode
Definition: glcorearb.h:98
GLint GLsizei GLsizei height
Definition: glcorearb.h:102
hboost::any HOM_DDSourceAny
Definition: HOM_Defines.h:42
GLuint GLsizei const GLchar * message
Definition: glcorearb.h:2542
GLuint index
Definition: glcorearb.h:785
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
virtual HOM_NodeTypeCategory & category()=0