HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DT_Plugin.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: DT_Plugin.h ( DT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __DT_Plugin__
12 #define __DT_Plugin__
13 
14 #include "DTUI_API.h"
15 #include "DT_ViewportProvider.h"
16 #include <OP/OP_Output.h>
17 #include <OP/OP_Value.h>
18 #include <GA/GA_Types.h>
19 #include <UT/UT_Array.h>
20 #include <UT/UT_Assert.h>
21 #include <UT/UT_Error.h>
22 #include <UT/UT_NonCopyable.h>
23 #include <UT/UT_SharedPtr.h>
24 #include <UT/UT_Set.h>
25 #include <UT/UT_StringArray.h>
26 #include <UT/UT_StringHolder.h>
27 #include <UT/UT_WorkBuffer.h>
28 #include <SYS/SYS_Math.h>
29 #include <SYS/SYS_Types.h>
30 #include <SYS/SYS_Visibility.h>
31 
32 #include <float.h>
33 #include <hboost/any.hpp>
34 #include <iosfwd>
35 
36 #define DT_LODCHOOSER_PLUGIN_NAME "Object Appearance"
37 #define DT_LIGHTBANK_PLUGIN_NAME "Light Bank"
38 #define DT_STYLER_PLUGIN_NAME "Material Style Sheets"
39 
40 class PRM_Parm;
41 class PRM_Template;
42 class DD_ChoiceList;
43 class DD_Source;
44 class UT_WorkBuffer;
45 
46 // ======================================================================
47 // Menu items
48 
49 /// A single menu item object. A menu item consists of a label, which is used
50 /// for display, and a token, which is used for setting a value, and is not
51 /// user-visible. The token should be globally unique for the top menu and
52 /// all its sub-menus.
53 /// A menu item can also be marked as having sub-menu. This, however, only
54 /// applies to node menus, not parameter menus. For parameter menus, the
55 /// flag is ignored.
57 {
58 public:
59  DT_MenuItem(const UT_StringHolder &token,
60  const UT_StringHolder &label);
61 
62  const UT_StringHolder &token() const;
63  const UT_StringHolder &label() const;
64 
65  bool operator==(const DT_MenuItem &other) const;
66 
67  static int compare(const DT_MenuItem *m1, const DT_MenuItem *m2);
68 
69 private:
70  UT_StringHolder myToken;
71  UT_StringHolder myLabel;
72 };
73 
75 
77  public DT_MenuItem
78 {
79 public:
80  enum Flags
81  {
82  MI_None = 0x00,
83  MI_Disabled = 0x01,
84  MI_ToggleUnchecked = 0x02,
85  MI_ToggleChecked = 0x06,
86  MI_HasSubMenu = 0x08
87  };
88 
89  DT_NodeMenuItem(const UT_StringHolder &token,
90  const UT_StringHolder &label,
91  const UT_StringHolder &hotkey_base = UT_StringHolder(),
92  Flags flags = MI_None);
93 
94  const UT_StringHolder &hotkey() const;
95  bool enabled() const;
96  bool isToggle() const;
97  bool toggledOn() const;
98  bool hasSubmenu() const;
99 
100 private:
101  Flags myFlags;
102  UT_StringHolder myHotkey;
103 };
104 
105 static inline DT_NodeMenuItem::Flags
107  { return DT_NodeMenuItem::Flags((int)a | (int)b); }
108 
110 
111 // ======================================================================
112 // Type definitions
113 
114 /// Opaque data type to pass values of any type across boundaries.
115 class DT_Value : private hboost::any
116 {
117 public:
118  /// Create a new, empty DT_Value object. A value can be assigned to it
119  /// later using the assignment operator.
120  DT_Value() {}
121 
122  /// Create a new DT_Value from the given value. A copy of the incoming
123  /// value will be stored, rather than a reference to it.
124  template<typename T>
125  DT_Value(const T &value) : hboost::any(value) {}
126 
127  /// Assign a new value to this DT_Value. Any previous value will be
128  /// destroyed, and a copy made of the incoming value.
129  template<typename T>
131  {
132  hboost::any::operator=(value);
133  return *this;
134  }
135 
136  /// An explicit copy function to copy in a new DT_Value. The call is
137  /// explicit, rather than using the implicit assignment operator, to avoid
138  /// arbitrary copying, which can get expensive for large objects.
139  void copy(const DT_Value &v)
140  { hboost::any::operator=(static_cast<const hboost::any &>(v)); }
141 
142  /// Reset the DT_Value object to be empty.
143  void clear()
144  { hboost::any::operator=(hboost::any()); }
145 
146  /// Return the std::type_info for the stored value. This can be used
147  /// to verify the type contained within. E.g.:
148  /// \code
149  /// DT_Value foo(2);
150  /// if (foo.type() == typeid(int)) print("Yep. That's an int alright.");
151  /// \endcode
152  using hboost::any::type;
153 
154  /// Return a reference to the value contained within. It is important
155  /// that the type matches, otherwise an exception is thrown.
156  template<typename T>
157  const T &get() const { return hboost::any_cast<const T &>(*this); }
158 
159 private:
160  DT_Value(const DT_Value &);
161  DT_Value &operator=(const DT_Value &);
162 };
163 
164 // ======================================================================
165 // Parameter definitions
166 
167 /// The base class for a parameter definition. Parameter definitions are used
168 /// to construct parameters for either tree values or plugin options.
169 ///
170 /// \note This class cannot be instantiated directly, use the derived types to
171 /// create specific parameter types.
172 ///
173 /// \sa DT_ParmDefToggle, DT_ParmDefInteger, DT_ParmDefFloat, DT_ParmDefColor,
174 /// DT_ParmDefString, DT_ParmDefMenu, DT_ParmDefPath, DT_ParmDefButton,
175 /// DT_ParmDefGrouped
177 {
178 public:
179  /// Create a new DT_ParmDef object from a PRM_Template object.
180  /// Note that not all types of operator parameters can be converted, or
181  /// represented, by DT_ParmDef. In that case it returns NULL.
182  static DT_ParmDef *createFromTemplate(int id, const PRM_Template &tpl);
183 
184  /// Returns a list of menu items from a PRM_Template object. This can be
185  /// used in case the menu is dynamically generated based on the parameter
186  /// it is being evaluated for.
187  static bool getMenuItemsFromTemplate(const PRM_Template &tpl,
188  PRM_Parm &parm,
189  DT_MenuItemList &items);
190 
191  virtual ~DT_ParmDef() {}
192 
193  enum Type
194  {
195  T_TOGGLE, /// Toggle type. \c DT_ParmDefToggle
196  T_INTEGER, /// Integer type. \c DT_ParmDefInteger
197  T_FLOAT, /// Floating point type. \c DT_ParmDefFloat
198  T_COLOR, /// Color type. \c DT_ParmDefColor
199  T_STRING, /// String type. \c DT_ParmDefString
200  T_MENU, /// Menu type. \c DT_ParmDefMenu
201  T_PATH, /// Path type. \c DT_ParmDefPath
202  T_BUTTON, /// Button type. \c DT_ParmDefButton
203  T_GROUPED /// Grouped parms type. \c DT_ParmDefGrouped
204  };
205 
207  {
208  OT_OPTION_ONLY, /// Only show plugin option in dialog (default)
209  OT_OPTION_AND_TOOLBAR, /// Show option in both toolbar and dialog.
210  OT_TOOLBAR_ONLY, /// Only show option in toolbar.
211  };
212 
213  /// Return the unique id used for this parameter definition. This id is
214  /// passed to DT_Plugin::getParameterValue, DT_Plugin::setParameterValue,
215  /// DT_Plugin::getOptionValue and DT_Plugin::setOptionValue.
216  int id() const { return myId; }
217 
218  /// Returns the type id of the parameter definition. See the derived
219  /// definition classes for details on each type.
220  Type type() const { return myType; }
221 
222  /// Returns a string version of the type. Used mostly for debugging
223  /// purposes.
224  const char *typeName() const;
225 
226  /// Set a name for this parameter definition.
227  DT_ParmDef *setName(const UT_StringHolder &name);
228 
229  /// Returns the name of the parameter definition.
230  const UT_StringHolder &name() const { return myName; }
231 
232  /// Show an icon, instead of a headet text / label.
233  DT_ParmDef *setIcon(const UT_StringHolder &icon);
234  const UT_StringHolder &icon() const { return myIcon; }
235 
236  /// Set the tooltip to show on the header column, for parameters, or on
237  /// the label/input for options.
238  DT_ParmDef *setTooltip(const UT_StringHolder &str);
239  const UT_StringHolder &tooltip() const { return myTooltip; }
240 
241  /// This parameter is read-only and cannot be edited. The plugin does not
242  /// have to handle it in DT_Plugin::setParameterValue or
243  /// DT_Plugin::setOptionValue.
244  DT_ParmDef *setReadOnly();
245  bool readOnly() const { return myReadOnly; }
246 
247  DT_ParmDef *setOptionType(OptionType opt_type);
248  OptionType optionType() const { return myOptionType; }
249 
250  /// Set an alternative name to use on this parameter's label in the toolbar,
251  /// if this parameter definition is used for both the option dialog and
252  /// the toolbar. This should ideally be a more compact version of the more
253  /// descriptive name used in the dialog.
254  DT_ParmDef *setToolbarName(const UT_StringHolder &toolbar_name);
255  const UT_StringHolder &toolbarName() const;
256 
257  /// The parameter can be in an indeterminate state. Ignored for options.
258  DT_ParmDef *setCanBeIndeterminate();
259  bool canBeIndeterminate() const
260  { return myCanBeIndeterminate; }
261 
262  /// Returns true if multiple selected rows can set this column value at
263  /// the same time.
264  virtual bool allowsMultiValueSet() const
265  { return !readOnly(); }
266 
267  virtual bool operator==(const DT_ParmDef &other) const = 0;
268 
269 protected:
270  DT_ParmDef(int id, const UT_StringHolder &name, Type parm_type);
271 
272  int myId;
281 };
282 
285 
286 
287 /// Defines a boolean parameter, represented by a toggle.
288 ///
289 /// When used with DT_Plugin::setParameterValue, DT_Plugin::getParameterValue,
290 /// DT_Plugin::setOptionValue, and DT_Plugin::getOptionValue, the \c value
291 /// argument should be of type \c bool.
293 {
294  DT_ParmDefToggle(int id, const UT_StringHolder &name);
295 public:
296  /// Create a new DT_ParmDefToggle type with a given id and name.
297  static DT_ParmDefToggle *create(int id, const UT_StringHolder &name);
298 
299  /// Automatically cast the base class definition to this type.
300  static const DT_ParmDefToggle &get(const DT_ParmDef &def)
301  {
302  UT_ASSERT(def.type() == T_TOGGLE);
303  return static_cast<const DT_ParmDefToggle &>(def);
304  }
305 
306  /// This toggle acts like a radio button. In that case, multi-selection
307  /// parameter change does not apply and the toggle is drawn like a radio
308  /// button.
309  DT_ParmDefToggle *setRadio();
310  bool isRadio() const;
311 
312  /// Sets the icon to use for the toggle button itself instead of the
313  /// standard UI toggle. For indeterminate states, the icon will be drawn
314  /// slightly grayed out.
315  /// \note Ignored for radio buttons.
316  DT_ParmDefToggle *setToggleIcon(const UT_StringHolder &icon);
317 
318  /// Return the value of the toggle icon.
319  const char *toggleIcon() const;
320 
321  /// Copy a value from a concrete type to an opaque DT_Value object.
322  void copyValue(bool src, DT_Value &dst) const;
323 
324  /// Copy a value from DT_Value opaque type to a concrete type.
325  void copyValue(const DT_Value &src, bool &dst) const;
326 
327  /// Dont allow triggering multiple radio buttons with one click.
328  virtual bool allowsMultiValueSet() const
329  {
330  if (isRadio())
331  return false;
333  }
334 
335  virtual bool operator==(const DT_ParmDef &other) const;
336 
337 private:
338  bool myIsRadio;
339  UT_StringHolder myToggleIcon;
340 };
341 
342 
343 /// Defines an integer vector parameter, represented by an input field. The
344 /// integer vector can range from a single entry, to four.
345 ///
346 /// When used with DT_Plugin::setParameterValue, DT_Plugin::getParameterValue,
347 /// DT_Plugin::setOptionValue, and DT_Plugin::getOptionValue, the \c value
348 /// argument type is according to the following table:
350 {
351  DT_ParmDefInteger(int id, const UT_StringHolder &name);
352 
353 public:
354  /// Create a new integer vector parameter definition with a given id and
355  /// a name.
356  ///
357  static DT_ParmDefInteger *create(int id, const UT_StringHolder &name);
358 
359  /// Automatically cast the base class definition to this type.
360  static const DT_ParmDefInteger &get(const DT_ParmDef &def)
361  {
362  UT_ASSERT(def.type() == T_INTEGER);
363  return static_cast<const DT_ParmDefInteger &>(def);
364  }
365 
366  /// @{
367  /// Set/get the vector size of the integer. Valid values are 1-4.
368  /// Invalid values are clamped.
369  DT_ParmDefInteger *setVectorSize(int32 size);
370  int32 vectorSize() const;
371  /// @}
372 
373  /// @{
374  /// Set get the allowed range for all entries of the integer vector.
375  /// The min/max values are inclusive.
376  DT_ParmDefInteger *setRange(int32 min, int32 max);
377  void getRange(int32 &min, int32 &max) const;
378  /// @}
379 
380  /// @{
381  /// Specify whether the range should be locked at either, or both, ends.
382  /// A locked range will clamp on the locked side.
383  DT_ParmDefInteger *setRangeLock(bool min, bool max);
384  void getRangeLock(bool &min, bool &max) const;
385  /// @}
386 
387  /// Set display label names for each vector component (e.g. "X"/"Y"/"Z" or
388  /// "U"/"V"). The size of the label array should equal to the size of the
389  /// vector size of the parameter. Therefore, it's important to call
390  /// setVectorSize prior to this call.
391  DT_ParmDefInteger *setLabelNames(const UT_StringArray &labels);
392 
393  /// Return the list of label names for the vector components. If no labels
394  /// were added, returns the empty array.
395  const UT_StringArray &labelNames() const;
396 
397  /// Copy a value from a concrete type to an opaque DT_Value object.
398  /// The number of entries passed should match the return value of
399  /// vectorSize().
400  void copyValue(const int *src, DT_Value &dst) const;
401 
402  /// Copy a value from DT_Value opaque type to a concrete type.
403  /// The number of entries in the dst storage should match the return value
404  /// of vectorSize().
405  void copyValue(const DT_Value &src, int *dst) const;
406 
407 
408  virtual bool operator==(const DT_ParmDef &other) const;
409 
410 private:
411  int32 myVectorSize;
412  int32 myRangeMin, myRangeMax;
413  bool myRangeLockMin, myRangeLockMax;
414  UT_StringArray myLabelNames;
415 };
416 
417 
419 {
420  DT_ParmDefFloat(int id, const UT_StringHolder &name);
421 
422 public:
423  static DT_ParmDefFloat *create(int id, const UT_StringHolder &name);
424 
425  /// Automatically cast the base class definition to this type.
426  static const DT_ParmDefFloat &get(const DT_ParmDef &def)
427  {
428  UT_ASSERT(def.type() == T_FLOAT);
429  return static_cast<const DT_ParmDefFloat &>(def);
430  }
431 
432  /// Set the vector size of the float. Valid values are 1-4.
433  /// Invalid values are clamped.
434  DT_ParmDefFloat *setVectorSize(int32 size);
435  int32 vectorSize() const;
436 
437  DT_ParmDefFloat *setRange(fpreal min, fpreal max);
438  void getRange(fpreal &min, fpreal &max) const;
439 
440  DT_ParmDefFloat *setRangeLock(bool min, bool max);
441  void getRangeLock(bool &min, bool &max) const;
442 
443  /// Set display label names for each vector component (e.g. "X"/"Y"/"Z" or
444  /// "U"/"V"). The size of the label array should equal to the size of the
445  /// vector size of the parameter. Therefore, it's important to call
446  /// setVectorSize prior to this call.
447  DT_ParmDefFloat *setLabelNames(const UT_StringArray &labels);
448 
449  /// Return the list of label names for the vector components. If no labels
450  /// were added, returns the empty array.
451  const UT_StringArray &labelNames() const;
452 
453  /// Copy a value from a concrete type to an opaque DT_Value object.
454  /// The number of entries passed should match the return value of
455  /// vectorSize().
456  void copyValue(const fpreal *src, DT_Value &dst) const;
457 
458  /// Copy a value from DT_Value opaque type to a concrete type.
459  /// The number of entries in the dst storage should match the return value
460  /// of vectorSize().
461  void copyValue(const DT_Value &src, fpreal *dst) const;
462 
463  virtual bool operator==(const DT_ParmDef &other) const;
464 private:
465  int32 myVectorSize;
466  fpreal myRangeMin, myRangeMax;
467  bool myRangeLockMin, myRangeLockMax;
468  UT_StringArray myLabelNames;
469 };
470 
471 
473 {
474  DT_ParmDefColor(int id, const UT_StringHolder &name);
475 public:
476  static DT_ParmDefColor *create(int id, const UT_StringHolder &name);
477 
478  /// Automatically cast the base class definition to this type.
479  static const DT_ParmDefColor &get(const DT_ParmDef &def)
480  {
481  UT_ASSERT(def.type() == T_COLOR);
482  return static_cast<const DT_ParmDefColor &>(def);
483  }
484 
485  DT_ParmDefColor *setIncludeAlpha(bool include_alpha);
486  bool includeAlpha() const;
487 
488  /// Copy a value from a concrete type to an opaque DT_Value object.
489  /// The number of entries in src should be 3 for colors that don't
490  /// include alpha, and 4 for colors that do.
491  void copyValue(const fpreal *src, DT_Value &dst) const;
492 
493  /// Copy a value from DT_Value opaque type to a concrete type.
494  /// The number of entries in dst should be 3 for colors that don't
495  /// include alpha, and 4 for colors that do.
496  void copyValue(const DT_Value &src, fpreal *dst) const;
497 
498  virtual bool operator==(const DT_ParmDef &other) const;
499 private:
500  bool myIncludeAlpha;
501 };
502 
503 
505 {
506  DT_ParmDefString(int id, const UT_StringHolder &name);
507 public:
509  {
512  ST_PATH
513  };
514 
515  static DT_ParmDefString *create(int id, const UT_StringHolder &name);
516 
517  /// Automatically cast the base class definition to this type.
518  static const DT_ParmDefString &get(const DT_ParmDef &def)
519  {
520  UT_ASSERT(def.type() == T_STRING);
521  return static_cast<const DT_ParmDefString &>(def);
522  }
523 
524  DT_ParmDefString *setStringType(StringType type);
525  StringType stringType() const;
526 
527  DT_ParmDefString *setHasMenu();
528  bool hasMenu() const;
529 
530  /// Copy a value from a concrete type to an opaque DT_Value object.
531  void copyValue(const char *src,
532  DT_Value &dst) const;
533  /// Copy a value from DT_Value opaque type to a concrete type.
534  void copyValue(const DT_Value &src,
535  UT_StringHolder &dst) const;
536 
537  virtual bool operator==(const DT_ParmDef &other) const;
538 
539 private:
540  StringType myStringType;
541  bool myHasMenu;
542 };
543 
544 
546 {
547  DT_ParmDefMenu(int id, const UT_StringHolder &name);
548 public:
549  /// Create a new menu parameter definition. By default the menu is marked
550  /// as dynamic, requiring the implementation of either
551  /// DT_Plugin::getOptionMenuItems, DT_Plugin::getParameterMenuItems, or
552  /// both.
553  static DT_ParmDefMenu *create(int id, const UT_StringHolder &name);
554 
555  /// Automatically cast the base class definition to this type.
556  static const DT_ParmDefMenu &get(const DT_ParmDef &def)
557  {
558  UT_ASSERT(def.type() == T_MENU);
559  return static_cast<const DT_ParmDefMenu &>(def);
560  }
561 
562  /// Set this menu to be a static menu with a fixed set of menu entries.
563  DT_ParmDefMenu *setStaticMenu(const DT_MenuItemList &items);
564 
565  /// Return the list of static menu items for this parameter definition.
566  /// If the menu is marked as dynamic, this list will be empty.
567  const DT_MenuItemList &staticMenu() const;
568 
569  /// Mark this menu as being dynamically generated. Any existing list of
570  /// static menu items will be deleted. The \c pref_width_in_em parameter
571  /// is used as a guidance to set the approximate display width of the menu
572  /// in units of \c em. The width in pixels is computed based on the
573  /// font used.
574  DT_ParmDefMenu *setDynamicMenu(fpreal pref_width_in_em = 12.0);
575 
576  /// Returns \c true if this menu is dynamically generated.
577  bool isDynamicMenu() const;
578 
579  /// Mark this as an action menu, where selecting a menu entry triggers
580  /// an action rather than updating the value shown in the menu. For this
581  /// type of menu, the parameter value is always shown as the menu text.
582  /// That menu text is not expected to show up in the list of menu items.
583  DT_ParmDefMenu *setActionMenu();
584 
585  /// Returns \c true if this is an action menu.
586  bool isActionMenu() const;
587 
588  // Returns the preferred width of dynamic menus in units of \c em.
589  fpreal dynamicMenuWidth() const;
590 
591  /// Copy a value from a concrete type to an opaque DT_Value object.
592  void copyValue(const char *src,
593  DT_Value &dst) const;
594  /// Copy a value from DT_Value opaque type to a concrete type.
595  void copyValue(const DT_Value &src,
596  UT_StringHolder &dst) const;
597 
598  /// Don't allow triggering multiple action menus at once.
599  virtual bool allowsMultiValueSet() const
600  {
601  if (isActionMenu())
602  return false;
604  }
605 
606  virtual bool operator==(const DT_ParmDef &other) const;
607 
608 private:
609  DT_MenuItemList myStaticItems;
610  fpreal myPrefWidthInEm;
611  bool myDynamicMenu;
612  bool myActionMenu;
613 };
614 
615 
617 {
618  DT_ParmDefPath(int id, const UT_StringHolder &name);
619 public:
620  enum PathType
621  {
622  PT_OPERATOR, //!< Any scene operator
623  PT_OBJECT_PATH, //!< Objects + virtual SOP paths
624  PT_PARM, //!< Node parameter
625  PT_FILE, //!< File browser
626  PT_DIRECTORY, //!< Directory browser
627  };
628 
629  static DT_ParmDefPath *create(int id, const UT_StringHolder &name);
630 
631  /// Automatically cast the base class definition to this type.
632  static const DT_ParmDefPath &get(const DT_ParmDef &def)
633  {
634  UT_ASSERT(def.type() == T_PATH);
635  return static_cast<const DT_ParmDefPath &>(def);
636  }
637 
638  DT_ParmDefPath *setPathType(PathType path_type);
639  PathType pathType() const;
640 
641  DT_ParmDefPath *setOpFilter(const UT_StringHolder &op_filter);
642  const char *opFilter() const;
643 
644  DT_ParmDefPath *setMultiSelection();
645  bool multiSelection() const;
646 
647  /// Copy a value from a concrete type to an opaque DT_Value object.
648  void copyValue(const char *src,
649  DT_Value &dst) const;
650  /// Copy a value from DT_Value opaque type to a concrete type.
651  void copyValue(const DT_Value &src,
652  UT_StringHolder &dst) const;
653 
654  virtual bool operator==(const DT_ParmDef &other) const;
655 
656 private:
657  PathType myPathType;
658  UT_StringHolder myOpFilter;
659  bool myMultiSelection;
660 };
661 
662 
664 {
665  DT_ParmDefButton(int id, const UT_StringHolder &name);
666 
667 public:
668  static DT_ParmDefButton *create(int id, const UT_StringHolder &name);
669  static const DT_ParmDefButton &get(const DT_ParmDef &def)
670  {
671  UT_ASSERT(def.type() == T_BUTTON);
672  return static_cast<const DT_ParmDefButton &>(def);
673  }
674 
675  DT_ParmDefButton *setLabelText(const UT_StringHolder &text);
676  const char *labelText() const;
677 
678  DT_ParmDefButton *setLabelIcon(const UT_StringHolder &icon);
679  const char *labelIcon() const;
680 
681  /// Copy a value from a concrete type to an opaque DT_Value object.
682  void copyValue(bool src,DT_Value &dst) const;
683  /// Copy a value from DT_Value opaque type to a concrete type.
684  void copyValue(const DT_Value &src, bool &dst) const;
685 
686  /// Don't allow triggering multiple buttons at once.
687  virtual bool allowsMultiValueSet() const
688  { return false; }
689 
690  virtual bool operator==(const DT_ParmDef &other) const;
691 
692 private:
693  UT_StringHolder myLabelText;
694  UT_StringHolder myLabelIcon;
695 };
696 
697 
699 {
700  DT_ParmDefGrouped(int id, const UT_StringHolder &name);
701 
702 public:
703  static DT_ParmDefGrouped *create(int id, const UT_StringHolder &name);
704  static const DT_ParmDefGrouped &get(const DT_ParmDef &def)
705  {
706  UT_ASSERT(def.type() == T_GROUPED);
707  return static_cast<const DT_ParmDefGrouped &>(def);
708  }
709 
710  DT_ParmDefGrouped *addGroupedDef(const DT_ParmDefHandle &parm_def);
711 
712  const DT_ParmDefList &groupedDefs() const
713  { return myGroupedParmDefs; }
714 
715  virtual bool operator==(const DT_ParmDef &other) const;
716 
717 private:
718  DT_ParmDefList myGroupedParmDefs;
719 };
720 
721 
722 // ======================================================================
723 // Node definition
724 
725 /// A unique node identifier.
726 typedef exint DT_NodeId;
727 
728 /// A flat list of node identifiers.
730 
731 /// An unordered set of unique node identifiers.
733 
735 {
736 public:
737  // Initialization.
738  DT_Node(const DT_Node &parent, const char *name,
739  bool sort_children = true);
740  ~DT_Node();
741 
742  // Used when initializing the UI element for this DT_Node. These values
743  // should not be modified after creation because they are not kept in sync
744  // with the UI.
745  void setName(const char *name);
746  const UT_StringHolder &name() const
747  { return myName; }
748  void setIcon(const char *icon);
749  const UT_StringHolder &icon() const
750  { return myIcon; }
751  void setOpId(int op_id);
752  int opId() const
753  { return myOpId; }
754  void setSortChildren(bool sort_children);
755  bool sortChildren() const
756  { return mySortChildren; }
757 
758  // Unique identifier for this node. Used for defining parent->child
759  // relationships. Returns 0 if this is the root node.
760  DT_NodeId id() const { return myId; }
761  DT_NodeId parentId() const { return myParentId; }
762 
763  bool operator==(const DT_Node &other) const
764  { return myId == other.myId; }
765  bool operator!=(const DT_Node &other) const
766  { return myId != other.myId; }
767 
768  /// A value that can be used to denote an invalid node id.
769  static DT_NodeId invalidId() { return -1; }
770 
771 private:
772  // For creating a root node.
773  friend class DT_Plugin;
774  DT_Node();
775 
776  void init(DT_NodeId id, DT_NodeId parent_id,
777  const char *name, bool sort_children);
778 
779  DT_NodeId myId;
780  DT_NodeId myParentId;
781 
782  UT_StringHolder myName;
783  UT_StringHolder myIcon;
784 
785  int myOpId;
786  bool mySortChildren;
787 };
788 
790 
792 
793 // ======================================================================
794 // The interface on the plugin host that the plugin can use to communicate
795 // through.
796 
798 {
799 public:
800  /// The list of node change types when calling DT_Host::nodesChanged.
802  {
803  NCT_VALUE_CHANGE, ///< Use id of node(s) whose value changed
804  NCT_NAME_CHANGE, ///< Use id of node(s) renamed
805  NCT_SELECTION_CHANGE, ///< Use id of node(s) whose selection changed
806  NCT_CHILD_ADDED, ///< Use parent id(s) of node(s) added
807  NCT_CHILD_MOVED, ///< Use parent id(s) of node(s) moved
808  NCT_REMOVED, ///< Use id of node(s) removed
809  NCT_EXPANDED, ///< Use id of node(s) that should be expanded
810  NCT_COLLAPSED, ///< Use id of node(s) that should be collapsed
811  };
812 
813  DT_Host(DT_ViewportProvider *viewport_provider);
814  virtual ~DT_Host();
815 
816  /// Sets a filter pattern on the tree, showing only the nodes in the tree
817  /// that match using UT_String::multiMatch with the given pattern. The
818  /// match is made using the full path to the tree node. If filter_cells is
819  /// set to true, the filter is additionally applied to the individual cell
820  /// values for that row, again using UT_String::multiMatch.
821  virtual void setNodeFilter(const char *pattern, bool filter_cells) = 0;
822 
823  /// This method should be called to notify the display tree that a node, or
824  /// a set of nodes, has changed in some way.
825  virtual void nodesChanged(NodeChangeType type,
826  const DT_NodeIdSet &node_ids) = 0;
827 
828  /// Some plugin options have changed and the UI needs to update.
829  virtual void sharedOptionsChanged() = 0;
830 
831  /// Adds an interest on a node that's not a part of the display tree. This
832  /// is useful for when there's not a direct 1-to-1 mapping available
833  /// between tree nodes and OP nodes we're interested in.
834  /// Returns \c true if successful.
835  virtual bool addInterestOnNode(DT_NodeHandle node) = 0;
836 
837  /// Called by plugins to remove an interest from a node that's not a part
838  /// of the display tree.
839  /// Returns \c true if successful.
840  virtual bool removeInterestOnNode(DT_NodeHandle node) = 0;
841 
842  /// Starts an in-place editing operation on a node.
843  virtual void startRename(DT_NodeHandle node) = 0;
844 
845  /// The definition, order and/or count of the parameter definitions has
846  /// changed. This call will cause the data tree to update the corresponding
847  /// display columns.
848  virtual void parameterDefsChanged() = 0;
849 
850  /// Saves the node tree expansion state. This expansion state is
851  /// automatically restored when the next update occurs.
852  virtual void saveTreeExpansionState(bool match_nodes_by_name) = 0;
853 
854  /// Request running a delayed action. This causes the host to call
855  /// DT_Plugin::runDelayedAction with the same parameters as given to this
856  /// call, once the current operation is complete and control is given back
857  /// to the data tree host. This can be used, for example, to perform scene
858  /// operations outside of the DT_Plugin::opEvent callback, when those
859  /// operations may cause events to be generated (e.g. changing a parameter
860  /// value as a reaction to an OP event).
861  /// The action_id is any arbitrary integer, and the data is an opaque
862  /// shared pointer whose interpretation is known only to the plugin.
863  /// \c UT_SharedPtr<void> allows converting back to a known pointer value.
864  /// E.g. if the value given is \c UT_SharedPtr<Foo> is given, then the
865  /// \c UT_SharedPtr<void> value given in DT_Plugin::runDelayedAction can be
866  /// converted back into \c UT_SharedPtr<Foo>.
867  virtual void addDelayedAction(int action_id, UT_SharedPtr<void> data) = 0;
868 
869  /// Report a message of the given severity. The message will be reported
870  /// to Houdini's status line.
871  virtual void addMessage(UT_ErrorSeverity sev, const char *fmt, ...) = 0;
872 
873  /// For binding the data tree to the viewport. Gets a selection from an
874  /// available Scene Viewer pane. Can either take the current selection,
875  /// or force a new selection. Can also choose to get back an object
876  /// selection, component selection, or accept either.
877  virtual bool getViewportSelection(
878  const DT_ViewportSelectionConfig &selection_config,
879  DT_ViewportSelection &selection);
880 
881  /// Interrupt any running viewport selection.
882  virtual void interruptViewportSelection();
883 
884 private:
885  DT_ViewportProvider *myViewportProvider;
886  const DT_ViewportSelectionConfig *myViewportSelectionConfig;
887 };
888 
889 // ======================================================================
890 // Plugin definition
891 
893 {
894 public:
895  DT_Plugin(DT_Host &host);
896  virtual ~DT_Plugin();
897 
898  /// @{
899  /// Methods provided by the plugin architecture.
900  const DT_NodeHandle &rootNode() const { return myRootNode; }
901 
902  /// Returns the DT_DT_HostInterface object which can be used to
903  /// communicate with the host to notify of dirty nodes, parameter changes,
904  /// global option changes, etc.
905  DT_Host &host() const { return myHost; }
906  /// @}
907 
908  /// @{
909  /// Methods to be implemented by the plugin.
910 
911  /// Returns the display name of the data tree plugin. This will be shown in
912  /// the list of available plugins in the data tree pane.
913  virtual const UT_StringHolder &name() const = 0;
914 
915  /// Returns the help ID to be used when the user clicks on the help button
916  /// in the Data Tree pane. By default it just returns the base help for
917  /// the Data Tree.
918  virtual const UT_StringHolder &helpId() const = 0;
919 
920  /// @{
921  /// Tree nodes
922 
923  enum RenameStyle {
924  RS_INVALID, // In-place name editing not allowed
925  RS_ALPHANUM, // Allow alphanumeric characters only
926  RS_OPNAME, // Allow only characters valid for an op name
927  RS_ANY // Allow any characters
928  };
929 
930  /// Get the children of the given node.
931  virtual bool getChildren(const DT_Node &parent,
932  DT_NodeList &list) = 0;
933 
934  /// Returns true if the parent node potentially has children. False
935  /// positives are much better than false negatives.
936  virtual bool hasChildren(const DT_Node &parent)
937  { return true; }
938 
939  /// Get the info text to show in the MMB popup window.
940  virtual bool getNodeInfoText(const DT_Node &node,
941  UT_WorkBuffer &info_text)
942  { return false; }
943 
944  /// The node delete operation is valid for this plugin.
945  virtual bool canDeleteNode(const DT_Node &node)
946  { return false; }
947 
948  /// Called when a request for delete occurs.
949  virtual bool deleteNodes(const DT_NodeList &node_list)
950  { return false; }
951 
952  /// Check if the node copy operation is valid for this plugin.
953  virtual bool canCopyNodes(const DT_NodeList &list,
954  DT_NodeList *filtered_list)
955  { return false; }
956 
957  /// Called when a request to copy occurs.
958  virtual bool copyNodes(const DT_NodeList &list)
959  { return false; }
960 
961  /// Check if the reviously copied nodes can be pasted into the given parent.
962  virtual bool canPasteNodes(const DT_Node &parent_node)
963  { return false; }
964 
965  /// Called when a request to paste into a parent node occurs.
966  virtual bool pasteNodes(const DT_Node &parent_node)
967  { return false; }
968 
969  /// The node rename operation is valid for this plugin.
970  virtual RenameStyle getRenameStyle(const DT_Node &node)
971  { return RS_INVALID; }
972 
973  /// Called when a request for node rename occurs.
974  virtual bool renameNode(const DT_Node &node, const char *new_name)
975  { return false; }
976 
977  /// Called when the right mouse-button (RMB) is clicked on a node. The
978  /// entire node selection is passed in, allowing to create a combined menu
979  /// for all selected nodes.
980  /// When retrieving the top-level menu, \c sub_menu_token will be \c NULL.
981  virtual bool getNodeMenu(const DT_NodeList &node_list,
982  const char *sub_menu_token,
983  DT_NodeMenuItemList &items)
984  { return false; }
985 
986  /// Perform the menu action specified by the user. The \c menu_token
987  /// argument will be the token of the menu item that the user selected.
988  /// The node list will be the same as was passed into \c getNodeMenu.
989  virtual void runMenuAction(const DT_NodeList &node_list,
990  const char *menu_token)
991  { }
992  /// @}
993 
994  /// @{
995  /// Tree parameters
996 
998  {
999  PS_INVALID, ///< No value can be retrieved.
1000  PS_VALID, ///< Value is valid
1001  PS_INDETERMINATE, ///< The value state is indeterminate
1002  PS_ANIMATED, ///< The value is animated and should have a
1003  ///< green background.
1004  PS_LOCKED ///< The value is locked and cannot be edited.
1005  };
1006 
1007  /// Returns the list of parameter definitions for the tree columns.
1008  virtual const DT_ParmDefList &getParameterDefs() = 0;
1009 
1010  /// For dealing with DT_ParmDefGrouped parameters, this method controls
1011  /// which grouped DT_ParmDef should be displayed for a particular DT_Node.
1012  virtual int getGroupedParameterId(const DT_Node &node, int parm_id)
1013  { return parm_id; }
1014 
1015  /// Retrieve a value of a specific parameter for the given node. The
1016  /// parm_id is the value returned from DT_ParmDef::id(). The for_feel
1017  /// flag indicates if we are fetching this value to set up our UI_Feel
1018  /// when the mouse moves over this cell.
1019  ///
1020  /// Use the copyValue function for each function definition to retrieve
1021  /// a concrete values from the opaque DT_Value type.
1022  /// The caller expects DT_Value to be able to cast to specific types
1023  /// to retrieve the display value. Use the following table, based on the
1024  /// parm def type:
1025  ///
1026  /// A return value of \c PS_INDETERMINATE should only be returned if the
1027  /// parameter definition supports it, otherwise it is ignored.
1028  /// Return \c PS_INVALID if no value can be retrieved from the node.
1029  /// \note This function is never called for T_BUTTON types. Only
1030  /// setParameterValue.
1031  virtual ParmState getParameterValue(const DT_Node &node, int parm_id,
1032  DT_Value &value, bool for_feel) = 0;
1033 
1034  /// Sets the value of a specific parameter for the given node. The parm_id
1035  /// is the value returned from DT_ParmDef::id()
1036  /// See the table for getValue for which C++ types should be expected for
1037  /// a given parameter definition type.
1038  virtual bool setParameterValue(const DT_Node &node, int parm_id,
1039  const DT_Value &value) = 0;
1040 
1041  /// Sets the same value of a specific parameter on multiple nodes. This can
1042  /// be used to optimize costly operations, or support exclusivity. The first
1043  /// node in the list is the node for who the user set the value on.
1044  /// The parm_id is the value returned from DT_ParmDef::id()
1045  virtual bool setParameterValues(const DT_NodeList &node_list,
1046  int parm_id,
1047  const DT_Value &value);
1048 
1049  /// For DT_ParmDefMenu items that are defined as dynamic, this function
1050  /// can be used to return a list of menu items based on the specific node,
1051  /// or the current state of other parameters.
1052  virtual bool getParameterMenuItems(const DT_Node &node,
1053  int parm_id,
1054  DT_MenuItemList &items)
1055  { return false; }
1056  /// @}
1057 
1058  /// @{
1059  /// Selection
1060 
1061  /// Called when a node queries for its selection state. If the selection
1062  /// state can be computed, the selection state is returned through the
1063  /// argument 'state' and a value of true returned. Return false if the
1064  /// selection can not be computed, or not supported. In that case, if
1065  /// DT_Node::opId returns a valid id, the op node is queried for its
1066  /// selection state.
1067  virtual bool getSelected(const DT_Node &node, bool &state)
1068  { return false; }
1069 
1070  /// Called when a node is selected or de-selected in the UI. The requested
1071  /// selection state is given by the 'state' argument. If the selection is
1072  /// handled, a value of \c true should be returned. Otherwise, return a
1073  /// value of \c false. In that case, if DT_Node::opId returns a valid id,
1074  /// the op node is selected.
1075  virtual bool setSelected(const DT_Node &node, bool state)
1076  { return false; }
1077  /// @}
1078 
1079  /// @{
1080  /// User-modifiable Plugin Options
1081 
1082  /// Returns the list of parameter definitions for the tree columns.
1083  virtual const DT_ParmDefList &getOptionDefs();
1084 
1085  /// Gets a value for a given option from the plugin.
1086  /// See getParameterValue
1087  /// \param parm_id The id of the parameter. Corresponds to the return
1088  /// value of DT_ParmDef::id.
1089  /// \param value The value returned from the plugin.
1090  /// \return \c true if successful, \c false otherwise.
1091  virtual bool getOptionValue(int parm_id, DT_Value &value)
1092  { return false; }
1093 
1094  /// Sets an option value for the plugin.
1095  virtual bool setOptionValue(int parm_id, const DT_Value &value)
1096  { return false; }
1097 
1098  /// For DT_ParmDefMenu items that are defined as dynamic, this function
1099  /// returns the list of menu items based on the current state.
1100  virtual bool getOptionMenuItems(int parm_id,
1101  DT_MenuItemList &items)
1102  { return false; }
1103  /// @}
1104 
1105  /// @{
1106  /// Events
1107 
1108  /// Called when an operator event has occurred. All nodes that have an
1109  /// interest in a given operator are in the array. See OP_EventType
1110  /// for explanation of what the \c data pointer contains.
1111  virtual void opEvent(const DT_NodeIdSet &node_ids,
1112  OP_EventType type, void *data)
1113  { }
1114 
1115 
1116  /// Called by the host when it is time to run a delayed action that was
1117  /// added with DT_Host::addDelayedAction. Multiple delayed actions are
1118  /// coalesced into one call, hence the list of data.
1119  virtual void runDelayedAction(
1120  int action_id,
1121  const UT_Array<UT_SharedPtr<void> > &data_list)
1122  { }
1123  /// @}
1124 
1125  /// @{
1126  /// Drag and drop
1127  ///
1128 
1129  /// Drag Source
1130  virtual bool dragHasData(const DT_Node &node,
1131  const char *data_label)
1132  { return false; }
1133 
1134  virtual void *dragGetData(const DT_Node &node,
1135  const char *data_label)
1136  { return NULL; }
1137 
1138  /// Drop Receiver
1139  virtual bool dropAccept(const DT_Node &node,
1140  DD_Source &drag_src,
1141  const char *data_label)
1142  { return false; }
1143 
1144  virtual bool dropTest(const DT_Node &node,
1145  DD_Source &drag_src)
1146  { return false; }
1147  virtual void dropGetChoice(const DT_Node &node,
1148  DD_Source &drag_src,
1149  DD_ChoiceList &drop_choices)
1150  { }
1151 
1152  /// When drag and drop is used to reorder child nodes, we get notified
1153  /// through this function.
1154  virtual void nodesReordered(const DT_Node &parent_node,
1155  const UT_IntArray &from_idx,
1156  const UT_IntArray &to_idx)
1157  { }
1158  /// @}
1159 
1160  /// @{
1161  /// Persistence
1162 
1163  /// When the desktop is saved, this method is called to allow the plugin
1164  /// to save any data that would not be saved otherwise.
1165  virtual bool writeDesktopData(std::ostream &os)
1166  { return false; }
1167 
1168  virtual bool readDesktopData(std::istream &is)
1169  { return false; }
1170 
1171  virtual bool writeSceneData(std::ostream &os)
1172  { return writeDesktopData(os); }
1173 
1174  virtual bool readSceneData(std::istream &is)
1175  { return readDesktopData(is); }
1176  /// @}
1177 
1178 protected:
1179  /// Only subclasses can access a non-const version of our root DT_Node.
1180  DT_Node &rootNodeRef();
1181  /// Under special circumstances, a subclass may want to create a new
1182  /// root-like DT_Node (using the default DT_Node constructor, which is
1183  /// private). This function makes that possible.
1184  static DT_NodeHandle createRootNode();
1185 
1186 private:
1187  DT_NodeHandle myRootNode;
1188  DT_Host &myHost;
1189 };
1190 
1192 
1193 
1194 /// A data tree plugin factory base class. Used to create Data Tree plugins on
1195 /// demand and to query names of plugins without creating them.
1196 /// For writing a new Data Tree plugin, see \c ::newDataTreePluginFactory for
1197 /// and example of how to sub-class this class to create a factory for your
1198 /// plugin.
1200 {
1201 public:
1202  virtual ~DT_PluginFactory() {}
1203 
1204  ///
1205  virtual const UT_StringHolder &name() const = 0;
1206 
1207  /// Create a new instance of a data tree plugin from this factory.
1208  virtual DT_PluginHandle create(DT_Host &host) = 0;
1209 
1210 protected:
1211  static bool registerFactory(DT_PluginFactory &factory);
1212 };
1213 
1214 extern "C" {
1215  /// All DSOs that provide a Data Tree plugin factory should implement this
1216  /// function. All it needs to do is to create the appropriate
1217  /// DT_PluginFactory for the plugin(s) it implements.
1218  /// Example:
1219  /// \code
1220  /// class MyDataTreePlugin : public DT_Plugin { ... };
1221  ///
1222  /// class MyDataTreePluginFactory : public DT_PluginFactory
1223  /// {
1224  /// public:
1225  /// MyDataTreePluginFactory()
1226  /// {
1227  /// registerFactory(*this);
1228  /// }
1229  ///
1230  /// virtual const char *name() const { return "My Data Tree Plugin"; }
1231  ///
1232  /// virtual DT_PluginHandle create(DT_Host &host)
1233  /// {
1234  /// return DT_PluginHandle(new MyDataTreePlugin(host));
1235  /// }
1236  /// };
1237  ///
1238  /// UT_UniquePtr<MyDataTreePluginFactory> theFactory;
1239  ///
1240  /// SYS_VISIBILITY_EXPORT void newDataTreePluginFactory()
1241  /// {
1242  /// theFactory.reset(new MyDataTreePluginFactory);
1243  /// }
1244  /// \endcode
1245 
1247 };
1248 
1249 #endif // __DT_Plugin__
1250 
const DT_NodeHandle & rootNode() const
Definition: DT_Plugin.h:900
UT_StringHolder myToolbarName
Definition: DT_Plugin.h:278
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2544
UT_StringHolder myName
Definition: DT_Plugin.h:273
virtual bool getSelected(const DT_Node &node, bool &state)
Definition: DT_Plugin.h:1067
SYS_VISIBILITY_EXPORT void newDataTreePluginFactory()
DT_NodeId id() const
Definition: DT_Plugin.h:760
void copy(const DT_Value &v)
Definition: DT_Plugin.h:139
UT_StringHolder myIcon
Definition: DT_Plugin.h:274
bool operator==(const DT_Node &other) const
Definition: DT_Plugin.h:763
const hboost::disable_if_c< VecTraits< T >::IsVec, T >::type & min(const T &a, const T &b)
Definition: Composite.h:128
#define SYS_VISIBILITY_EXPORT
virtual void opEvent(const DT_NodeIdSet &node_ids, OP_EventType type, void *data)
Definition: DT_Plugin.h:1111
const GLdouble * v
Definition: glcorearb.h:836
virtual bool renameNode(const DT_Node &node, const char *new_name)
Called when a request for node rename occurs.
Definition: DT_Plugin.h:974
virtual bool dragHasData(const DT_Node &node, const char *data_label)
Drag Source.
Definition: DT_Plugin.h:1130
UT_Array< DT_NodeMenuItem > DT_NodeMenuItemList
Definition: DT_Plugin.h:109
UT_SharedPtr< const DT_ParmDef > DT_ParmDefHandle
Definition: DT_Plugin.h:283
virtual bool getParameterMenuItems(const DT_Node &node, int parm_id, DT_MenuItemList &items)
Definition: DT_Plugin.h:1052
Use id of node(s) whose selection changed.
Definition: DT_Plugin.h:805
Value is valid.
Definition: DT_Plugin.h:1000
const UT_StringHolder & name() const
Definition: DT_Plugin.h:746
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
UT_ErrorSeverity
Definition: UT_Error.h:25
GLbitfield flags
Definition: glcorearb.h:1595
Floating point type. DT_ParmDefFloat.
Definition: DT_Plugin.h:198
bool canBeIndeterminate() const
Definition: DT_Plugin.h:259
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glcorearb.h:2538
UT_SharedPtr< const DT_Node > DT_NodeHandle
Definition: DT_Plugin.h:789
Wrapper around hboost::shared_ptr.
Definition: UT_SharedPtr.h:27
virtual bool writeSceneData(std::ostream &os)
Definition: DT_Plugin.h:1171
void clear()
Reset the DT_Value object to be empty.
Definition: DT_Plugin.h:143
DT_Value & operator=(const T &value)
Definition: DT_Plugin.h:130
UT_Set< DT_NodeId > DT_NodeIdSet
An unordered set of unique node identifiers.
Definition: DT_Plugin.h:732
int id() const
Definition: DT_Plugin.h:216
virtual bool pasteNodes(const DT_Node &parent_node)
Called when a request to paste into a parent node occurs.
Definition: DT_Plugin.h:966
virtual bool canDeleteNode(const DT_Node &node)
The node delete operation is valid for this plugin.
Definition: DT_Plugin.h:945
virtual bool setOptionValue(int parm_id, const DT_Value &value)
Sets an option value for the plugin.
Definition: DT_Plugin.h:1095
GLsizeiptr size
Definition: glcorearb.h:663
Menu type. DT_ParmDefMenu.
Definition: DT_Plugin.h:201
UT_Array< DT_NodeHandle > DT_NodeList
Definition: DT_Plugin.h:791
const hboost::disable_if_c< VecTraits< T >::IsVec, T >::type & max(const T &a, const T &b)
Definition: Composite.h:132
Use id of node(s) that should be expanded.
Definition: DT_Plugin.h:809
Opaque data type to pass values of any type across boundaries.
Definition: DT_Plugin.h:115
virtual bool getOptionValue(int parm_id, DT_Value &value)
Definition: DT_Plugin.h:1091
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
Type type() const
Definition: DT_Plugin.h:220
const UT_StringHolder & icon() const
Definition: DT_Plugin.h:749
Only show plugin option in dialog (default)
Definition: DT_Plugin.h:209
exint DT_NodeId
A unique node identifier.
Definition: DT_Plugin.h:726
DT_Host & host() const
Definition: DT_Plugin.h:905
Objects + virtual SOP paths.
Definition: DT_Plugin.h:623
const DT_ParmDefList & groupedDefs() const
Definition: DT_Plugin.h:712
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:102
virtual ~DT_PluginFactory()
Definition: DT_Plugin.h:1202
int64 exint
Definition: SYS_Types.h:109
UT_Array< DT_ParmDefHandle > DT_ParmDefList
Definition: DT_Plugin.h:284
The value state is indeterminate.
Definition: DT_Plugin.h:1001
virtual void nodesReordered(const DT_Node &parent_node, const UT_IntArray &from_idx, const UT_IntArray &to_idx)
Definition: DT_Plugin.h:1154
bool operator!=(const DT_Node &other) const
Definition: DT_Plugin.h:765
Integer type. DT_ParmDefInteger.
Definition: DT_Plugin.h:197
Use id of node(s) that should be collapsed.
Definition: DT_Plugin.h:810
UT_StringHolder myTooltip
Definition: DT_Plugin.h:276
UT_SharedPtr< DT_Plugin > DT_PluginHandle
Definition: DT_Plugin.h:1191
virtual bool allowsMultiValueSet() const
Dont allow triggering multiple radio buttons with one click.
Definition: DT_Plugin.h:328
const UT_StringHolder & tooltip() const
Definition: DT_Plugin.h:239
virtual bool readSceneData(std::istream &is)
Definition: DT_Plugin.h:1174
Toggle type. DT_ParmDefToggle.
Definition: DT_Plugin.h:196
virtual bool getNodeInfoText(const DT_Node &node, UT_WorkBuffer &info_text)
Get the info text to show in the MMB popup window.
Definition: DT_Plugin.h:940
virtual bool canCopyNodes(const DT_NodeList &list, DT_NodeList *filtered_list)
Check if the node copy operation is valid for this plugin.
Definition: DT_Plugin.h:953
const UT_StringHolder & name() const
Returns the name of the parameter definition.
Definition: DT_Plugin.h:230
GLboolean * data
Definition: glcorearb.h:130
virtual void runDelayedAction(int action_id, const UT_Array< UT_SharedPtr< void > > &data_list)
Definition: DT_Plugin.h:1119
GLuint const GLchar * name
Definition: glcorearb.h:785
OptionType optionType() const
Definition: DT_Plugin.h:248
bool myCanBeIndeterminate
Definition: DT_Plugin.h:280
int int32
Definition: SYS_Types.h:28
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
Color type. DT_ParmDefColor.
Definition: DT_Plugin.h:199
Path type. DT_ParmDefPath.
Definition: DT_Plugin.h:202
virtual RenameStyle getRenameStyle(const DT_Node &node)
The node rename operation is valid for this plugin.
Definition: DT_Plugin.h:970
virtual bool allowsMultiValueSet() const
Don't allow triggering multiple buttons at once.
Definition: DT_Plugin.h:687
DT_Value(const T &value)
Definition: DT_Plugin.h:125
virtual bool getOptionMenuItems(int parm_id, DT_MenuItemList &items)
Definition: DT_Plugin.h:1100
Type myType
Definition: DT_Plugin.h:275
UT_Array< DT_MenuItem > DT_MenuItemList
Definition: DT_Plugin.h:74
GLenum GLenum dst
Definition: glcorearb.h:1792
Use id of node(s) removed.
Definition: DT_Plugin.h:808
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:263
File browser.
Definition: DT_Plugin.h:625
int opId() const
Definition: DT_Plugin.h:752
Use parent id(s) of node(s) moved.
Definition: DT_Plugin.h:807
Show option in both toolbar and dialog.
Definition: DT_Plugin.h:210
virtual bool operator==(const DT_ParmDef &other) const =0
virtual void * dragGetData(const DT_Node &node, const char *data_label)
Drag Source.
Definition: DT_Plugin.h:1134
bool sortChildren() const
Definition: DT_Plugin.h:755
virtual bool writeDesktopData(std::ostream &os)
Definition: DT_Plugin.h:1165
virtual ~DT_ParmDef()
Definition: DT_Plugin.h:191
Use id of node(s) whose value changed.
Definition: DT_Plugin.h:803
No value can be retrieved.
Definition: DT_Plugin.h:999
DT_NodeId parentId() const
Definition: DT_Plugin.h:761
virtual int getGroupedParameterId(const DT_Node &node, int parm_id)
Definition: DT_Plugin.h:1012
OP_EventType
Definition: OP_Value.h:22
OptionType myOptionType
Definition: DT_Plugin.h:277
virtual bool dropAccept(const DT_Node &node, DD_Source &drag_src, const char *data_label)
Drop Receiver.
Definition: DT_Plugin.h:1139
Directory browser.
Definition: DT_Plugin.h:626
virtual bool allowsMultiValueSet() const
Don't allow triggering multiple action menus at once.
Definition: DT_Plugin.h:599
const UT_StringHolder & icon() const
Definition: DT_Plugin.h:234
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
virtual bool copyNodes(const DT_NodeList &list)
Called when a request to copy occurs.
Definition: DT_Plugin.h:958
virtual bool readDesktopData(std::istream &is)
Definition: DT_Plugin.h:1168
bool readOnly() const
Definition: DT_Plugin.h:245
virtual bool canPasteNodes(const DT_Node &parent_node)
Check if the reviously copied nodes can be pasted into the given parent.
Definition: DT_Plugin.h:962
virtual bool getNodeMenu(const DT_NodeList &node_list, const char *sub_menu_token, DT_NodeMenuItemList &items)
Definition: DT_Plugin.h:981
virtual bool dropTest(const DT_Node &node, DD_Source &drag_src)
Drag Source.
Definition: DT_Plugin.h:1144
virtual void dropGetChoice(const DT_Node &node, DD_Source &drag_src, DD_ChoiceList &drop_choices)
Drag Source.
Definition: DT_Plugin.h:1147
#define DTUI_API
Definition: DTUI_API.h:10
virtual bool hasChildren(const DT_Node &parent)
Definition: DT_Plugin.h:936
static DT_NodeId invalidId()
A value that can be used to denote an invalid node id.
Definition: DT_Plugin.h:769
DT_Value()
Definition: DT_Plugin.h:120
Use id of node(s) renamed.
Definition: DT_Plugin.h:804
virtual void runMenuAction(const DT_NodeList &node_list, const char *menu_token)
Definition: DT_Plugin.h:989
Button type. DT_ParmDefButton.
Definition: DT_Plugin.h:203
UT_Array< DT_NodeId > DT_NodeIdList
A flat list of node identifiers.
Definition: DT_Plugin.h:729
Node parameter.
Definition: DT_Plugin.h:624
bool myReadOnly
Definition: DT_Plugin.h:279
NodeChangeType
The list of node change types when calling DT_Host::nodesChanged.
Definition: DT_Plugin.h:801
virtual bool setSelected(const DT_Node &node, bool state)
Definition: DT_Plugin.h:1075
Use parent id(s) of node(s) added.
Definition: DT_Plugin.h:806
virtual bool deleteNodes(const DT_NodeList &node_list)
Called when a request for delete occurs.
Definition: DT_Plugin.h:949
String type. DT_ParmDefString.
Definition: DT_Plugin.h:200
virtual bool allowsMultiValueSet() const
Definition: DT_Plugin.h:264
Any scene operator.
Definition: DT_Plugin.h:622
GLenum src
Definition: glcorearb.h:1792