HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 
286 
287 
288 /// Defines a boolean parameter, represented by a toggle.
289 ///
290 /// When used with DT_Plugin::setParameterValue, DT_Plugin::getParameterValue,
291 /// DT_Plugin::setOptionValue, and DT_Plugin::getOptionValue, the \c value
292 /// argument should be of type \c bool.
294 {
295  DT_ParmDefToggle(int id, const UT_StringHolder &name);
296 public:
297  /// Create a new DT_ParmDefToggle type with a given id and name.
298  static DT_ParmDefToggle *create(int id, const UT_StringHolder &name);
299 
300  /// Automatically cast the base class definition to this type.
301  static const DT_ParmDefToggle &get(const DT_ParmDef &def)
302  {
303  UT_ASSERT(def.type() == T_TOGGLE);
304  return static_cast<const DT_ParmDefToggle &>(def);
305  }
306 
307  /// This toggle acts like a radio button. In that case, multi-selection
308  /// parameter change does not apply and the toggle is drawn like a radio
309  /// button.
310  DT_ParmDefToggle *setRadio();
311  bool isRadio() const;
312 
313  /// Sets the icon to use for the toggle button itself instead of the
314  /// standard UI toggle. For indeterminate states, the icon will be drawn
315  /// slightly grayed out.
316  /// \note Ignored for radio buttons.
317  DT_ParmDefToggle *setToggleIcon(const UT_StringHolder &icon);
318 
319  /// Return the value of the toggle icon.
320  const char *toggleIcon() const;
321 
322  /// Copy a value from a concrete type to an opaque DT_Value object.
323  void copyValue(bool src, DT_Value &dst) const;
324 
325  /// Copy a value from DT_Value opaque type to a concrete type.
326  void copyValue(const DT_Value &src, bool &dst) const;
327 
328  /// Dont allow triggering multiple radio buttons with one click.
329  virtual bool allowsMultiValueSet() const
330  {
331  if (isRadio())
332  return false;
334  }
335 
336  virtual bool operator==(const DT_ParmDef &other) const;
337 
338 private:
339  bool myIsRadio;
340  UT_StringHolder myToggleIcon;
341 };
342 
343 
344 /// Defines an integer vector parameter, represented by an input field. The
345 /// integer vector can range from a single entry, to four.
346 ///
347 /// When used with DT_Plugin::setParameterValue, DT_Plugin::getParameterValue,
348 /// DT_Plugin::setOptionValue, and DT_Plugin::getOptionValue, the \c value
349 /// argument type is according to the following table:
351 {
352  DT_ParmDefInteger(int id, const UT_StringHolder &name);
353 
354 public:
355  /// Create a new integer vector parameter definition with a given id and
356  /// a name.
357  ///
358  static DT_ParmDefInteger *create(int id, const UT_StringHolder &name);
359 
360  /// Automatically cast the base class definition to this type.
361  static const DT_ParmDefInteger &get(const DT_ParmDef &def)
362  {
363  UT_ASSERT(def.type() == T_INTEGER);
364  return static_cast<const DT_ParmDefInteger &>(def);
365  }
366 
367  /// @{
368  /// Set/get the vector size of the integer. Valid values are 1-4.
369  /// Invalid values are clamped.
370  DT_ParmDefInteger *setVectorSize(int32 size);
371  int32 vectorSize() const;
372  /// @}
373 
374  /// @{
375  /// Set get the allowed range for all entries of the integer vector.
376  /// The min/max values are inclusive.
377  DT_ParmDefInteger *setRange(int32 min, int32 max);
378  void getRange(int32 &min, int32 &max) const;
379  /// @}
380 
381  /// @{
382  /// Specify whether the range should be locked at either, or both, ends.
383  /// A locked range will clamp on the locked side.
384  DT_ParmDefInteger *setRangeLock(bool min, bool max);
385  void getRangeLock(bool &min, bool &max) const;
386  /// @}
387 
388  /// Set display label names for each vector component (e.g. "X"/"Y"/"Z" or
389  /// "U"/"V"). The size of the label array should equal to the size of the
390  /// vector size of the parameter. Therefore, it's important to call
391  /// setVectorSize prior to this call.
392  DT_ParmDefInteger *setLabelNames(const UT_StringArray &labels);
393 
394  /// Return the list of label names for the vector components. If no labels
395  /// were added, returns the empty array.
396  const UT_StringArray &labelNames() const;
397 
398  /// Copy a value from a concrete type to an opaque DT_Value object.
399  /// The number of entries passed should match the return value of
400  /// vectorSize().
401  void copyValue(const int *src, DT_Value &dst) const;
402 
403  /// Copy a value from DT_Value opaque type to a concrete type.
404  /// The number of entries in the dst storage should match the return value
405  /// of vectorSize().
406  void copyValue(const DT_Value &src, int *dst) const;
407 
408 
409  virtual bool operator==(const DT_ParmDef &other) const;
410 
411 private:
412  int32 myVectorSize;
413  int32 myRangeMin, myRangeMax;
414  bool myRangeLockMin, myRangeLockMax;
415  UT_StringArray myLabelNames;
416 };
417 
418 
420 {
421  DT_ParmDefFloat(int id, const UT_StringHolder &name);
422 
423 public:
424  static DT_ParmDefFloat *create(int id, const UT_StringHolder &name);
425 
426  /// Automatically cast the base class definition to this type.
427  static const DT_ParmDefFloat &get(const DT_ParmDef &def)
428  {
429  UT_ASSERT(def.type() == T_FLOAT);
430  return static_cast<const DT_ParmDefFloat &>(def);
431  }
432 
433  /// Set the vector size of the float. Valid values are 1-4.
434  /// Invalid values are clamped.
435  DT_ParmDefFloat *setVectorSize(int32 size);
436  int32 vectorSize() const;
437 
438  DT_ParmDefFloat *setRange(fpreal min, fpreal max);
439  void getRange(fpreal &min, fpreal &max) const;
440 
441  DT_ParmDefFloat *setRangeLock(bool min, bool max);
442  void getRangeLock(bool &min, bool &max) const;
443 
444  /// Set display label names for each vector component (e.g. "X"/"Y"/"Z" or
445  /// "U"/"V"). The size of the label array should equal to the size of the
446  /// vector size of the parameter. Therefore, it's important to call
447  /// setVectorSize prior to this call.
448  DT_ParmDefFloat *setLabelNames(const UT_StringArray &labels);
449 
450  /// Return the list of label names for the vector components. If no labels
451  /// were added, returns the empty array.
452  const UT_StringArray &labelNames() const;
453 
454  /// Copy a value from a concrete type to an opaque DT_Value object.
455  /// The number of entries passed should match the return value of
456  /// vectorSize().
457  void copyValue(const fpreal *src, DT_Value &dst) const;
458 
459  /// Copy a value from DT_Value opaque type to a concrete type.
460  /// The number of entries in the dst storage should match the return value
461  /// of vectorSize().
462  void copyValue(const DT_Value &src, fpreal *dst) const;
463 
464  virtual bool operator==(const DT_ParmDef &other) const;
465 private:
466  int32 myVectorSize;
467  fpreal myRangeMin, myRangeMax;
468  bool myRangeLockMin, myRangeLockMax;
469  UT_StringArray myLabelNames;
470 };
471 
472 
474 {
475  DT_ParmDefColor(int id, const UT_StringHolder &name);
476 public:
477  static DT_ParmDefColor *create(int id, const UT_StringHolder &name);
478 
479  /// Automatically cast the base class definition to this type.
480  static const DT_ParmDefColor &get(const DT_ParmDef &def)
481  {
482  UT_ASSERT(def.type() == T_COLOR);
483  return static_cast<const DT_ParmDefColor &>(def);
484  }
485 
486  DT_ParmDefColor *setIncludeAlpha(bool include_alpha);
487  bool includeAlpha() const;
488 
489  /// Copy a value from a concrete type to an opaque DT_Value object.
490  /// The number of entries in src should be 3 for colors that don't
491  /// include alpha, and 4 for colors that do.
492  void copyValue(const fpreal *src, DT_Value &dst) const;
493 
494  /// Copy a value from DT_Value opaque type to a concrete type.
495  /// The number of entries in dst should be 3 for colors that don't
496  /// include alpha, and 4 for colors that do.
497  void copyValue(const DT_Value &src, fpreal *dst) const;
498 
499  virtual bool operator==(const DT_ParmDef &other) const;
500 private:
501  bool myIncludeAlpha;
502 };
503 
504 
506 {
507  DT_ParmDefString(int id, const UT_StringHolder &name);
508 public:
510  {
513  ST_PATH
514  };
515 
516  static DT_ParmDefString *create(int id, const UT_StringHolder &name);
517 
518  /// Automatically cast the base class definition to this type.
519  static const DT_ParmDefString &get(const DT_ParmDef &def)
520  {
521  UT_ASSERT(def.type() == T_STRING);
522  return static_cast<const DT_ParmDefString &>(def);
523  }
524 
525  DT_ParmDefString *setStringType(StringType type);
526  StringType stringType() const;
527 
528  DT_ParmDefString *setHasMenu();
529  bool hasMenu() const;
530 
531  /// Copy a value from a concrete type to an opaque DT_Value object.
532  void copyValue(const char *src,
533  DT_Value &dst) const;
534  /// Copy a value from DT_Value opaque type to a concrete type.
535  void copyValue(const DT_Value &src,
536  UT_StringHolder &dst) const;
537 
538  virtual bool operator==(const DT_ParmDef &other) const;
539 
540 private:
541  StringType myStringType;
542  bool myHasMenu;
543 };
544 
545 
547 {
548  DT_ParmDefMenu(int id, const UT_StringHolder &name);
549 public:
550  /// Create a new menu parameter definition. By default the menu is marked
551  /// as dynamic, requiring the implementation of either
552  /// DT_Plugin::getOptionMenuItems, DT_Plugin::getParameterMenuItems, or
553  /// both.
554  static DT_ParmDefMenu *create(int id, const UT_StringHolder &name);
555 
556  /// Automatically cast the base class definition to this type.
557  static const DT_ParmDefMenu &get(const DT_ParmDef &def)
558  {
559  UT_ASSERT(def.type() == T_MENU);
560  return static_cast<const DT_ParmDefMenu &>(def);
561  }
562 
563  /// Set this menu to be a static menu with a fixed set of menu entries.
564  DT_ParmDefMenu *setStaticMenu(const DT_MenuItemList &items);
565 
566  /// Return the list of static menu items for this parameter definition.
567  /// If the menu is marked as dynamic, this list will be empty.
568  const DT_MenuItemList &staticMenu() const;
569 
570  /// Mark this menu as being dynamically generated. Any existing list of
571  /// static menu items will be deleted. The \c pref_width_in_em parameter
572  /// is used as a guidance to set the approximate display width of the menu
573  /// in units of \c em. The width in pixels is computed based on the
574  /// font used.
575  DT_ParmDefMenu *setDynamicMenu(fpreal pref_width_in_em = 12.0);
576 
577  /// Returns \c true if this menu is dynamically generated.
578  bool isDynamicMenu() const;
579 
580  /// Mark this as an action menu, where selecting a menu entry triggers
581  /// an action rather than updating the value shown in the menu. For this
582  /// type of menu, the parameter value is always shown as the menu text.
583  /// That menu text is not expected to show up in the list of menu items.
584  DT_ParmDefMenu *setActionMenu();
585 
586  /// Returns \c true if this is an action menu.
587  bool isActionMenu() const;
588 
589  // Returns the preferred width of dynamic menus in units of \c em.
590  fpreal dynamicMenuWidth() const;
591 
592  /// Copy a value from a concrete type to an opaque DT_Value object.
593  void copyValue(const char *src,
594  DT_Value &dst) const;
595  /// Copy a value from DT_Value opaque type to a concrete type.
596  void copyValue(const DT_Value &src,
597  UT_StringHolder &dst) const;
598 
599  /// Don't allow triggering multiple action menus at once.
600  virtual bool allowsMultiValueSet() const
601  {
602  if (isActionMenu())
603  return false;
605  }
606 
607  virtual bool operator==(const DT_ParmDef &other) const;
608 
609 private:
610  DT_MenuItemList myStaticItems;
611  fpreal myPrefWidthInEm;
612  bool myDynamicMenu;
613  bool myActionMenu;
614 };
615 
616 
618 {
619  DT_ParmDefPath(int id, const UT_StringHolder &name);
620 public:
621  enum PathType
622  {
623  PT_OPERATOR, //!< Any scene operator
624  PT_OBJECT_PATH, //!< Objects + virtual SOP paths
625  PT_PARM, //!< Node parameter
626  PT_FILE, //!< File browser
627  PT_DIRECTORY, //!< Directory browser
628  };
629 
630  static DT_ParmDefPath *create(int id, const UT_StringHolder &name);
631 
632  /// Automatically cast the base class definition to this type.
633  static const DT_ParmDefPath &get(const DT_ParmDef &def)
634  {
635  UT_ASSERT(def.type() == T_PATH);
636  return static_cast<const DT_ParmDefPath &>(def);
637  }
638 
639  DT_ParmDefPath *setPathType(PathType path_type);
640  PathType pathType() const;
641 
642  DT_ParmDefPath *setOpFilter(const UT_StringHolder &op_filter);
643  const char *opFilter() const;
644 
645  DT_ParmDefPath *setMultiSelection();
646  bool multiSelection() const;
647 
648  /// Copy a value from a concrete type to an opaque DT_Value object.
649  void copyValue(const char *src,
650  DT_Value &dst) const;
651  /// Copy a value from DT_Value opaque type to a concrete type.
652  void copyValue(const DT_Value &src,
653  UT_StringHolder &dst) const;
654 
655  virtual bool operator==(const DT_ParmDef &other) const;
656 
657 private:
658  PathType myPathType;
659  UT_StringHolder myOpFilter;
660  bool myMultiSelection;
661 };
662 
663 
665 {
666  DT_ParmDefButton(int id, const UT_StringHolder &name);
667 
668 public:
669  static DT_ParmDefButton *create(int id, const UT_StringHolder &name);
670  static const DT_ParmDefButton &get(const DT_ParmDef &def)
671  {
672  UT_ASSERT(def.type() == T_BUTTON);
673  return static_cast<const DT_ParmDefButton &>(def);
674  }
675 
676  DT_ParmDefButton *setLabelText(const UT_StringHolder &text);
677  const char *labelText() const;
678 
679  DT_ParmDefButton *setLabelIcon(const UT_StringHolder &icon);
680  const char *labelIcon() const;
681 
682  /// Copy a value from a concrete type to an opaque DT_Value object.
683  void copyValue(bool src,DT_Value &dst) const;
684  /// Copy a value from DT_Value opaque type to a concrete type.
685  void copyValue(const DT_Value &src, bool &dst) const;
686 
687  /// Don't allow triggering multiple buttons at once.
688  virtual bool allowsMultiValueSet() const
689  { return false; }
690 
691  virtual bool operator==(const DT_ParmDef &other) const;
692 
693 private:
694  UT_StringHolder myLabelText;
695  UT_StringHolder myLabelIcon;
696 };
697 
698 
700 {
701  DT_ParmDefGrouped(int id, const UT_StringHolder &name);
702 
703 public:
704  static DT_ParmDefGrouped *create(int id, const UT_StringHolder &name);
705  static const DT_ParmDefGrouped &get(const DT_ParmDef &def)
706  {
707  UT_ASSERT(def.type() == T_GROUPED);
708  return static_cast<const DT_ParmDefGrouped &>(def);
709  }
710 
711  DT_ParmDefGrouped *addGroupedDef(const DT_ParmDefHandle &parm_def);
712 
713  const DT_ParmDefList &groupedDefs() const
714  { return myGroupedParmDefs; }
715 
716  virtual bool operator==(const DT_ParmDef &other) const;
717 
718 private:
719  DT_ParmDefList myGroupedParmDefs;
720 };
721 
722 
723 // ======================================================================
724 // Node definition
725 
726 /// A unique node identifier.
727 typedef exint DT_NodeId;
728 
729 /// A flat list of node identifiers.
731 
732 /// An unordered set of unique node identifiers.
734 
736 {
737 public:
738  // Initialization.
739  DT_Node(const DT_Node &parent, const char *name,
740  bool sort_children = true);
741  ~DT_Node();
742 
743  // Used when initializing the UI element for this DT_Node. These values
744  // should not be modified after creation because they are not kept in sync
745  // with the UI.
746  void setName(const char *name);
747  const UT_StringHolder &name() const
748  { return myName; }
749  void setIcon(const char *icon);
750  const UT_StringHolder &icon() const
751  { return myIcon; }
752  void setOpId(int op_id);
753  int opId() const
754  { return myOpId; }
755  void setSortChildren(bool sort_children);
756  bool sortChildren() const
757  { return mySortChildren; }
758 
759  // Unique identifier for this node. Used for defining parent->child
760  // relationships. Returns 0 if this is the root node.
761  DT_NodeId id() const { return myId; }
762  DT_NodeId parentId() const { return myParentId; }
763 
764  bool operator==(const DT_Node &other) const
765  { return myId == other.myId; }
766  bool operator!=(const DT_Node &other) const
767  { return myId != other.myId; }
768 
769  /// A value that can be used to denote an invalid node id.
770  static DT_NodeId invalidId() { return -1; }
771 
772 private:
773  // For creating a root node.
774  friend class DT_Plugin;
775  DT_Node();
776 
777  void init(DT_NodeId id, DT_NodeId parent_id,
778  const char *name, bool sort_children);
779 
780  DT_NodeId myId;
781  DT_NodeId myParentId;
782 
783  UT_StringHolder myName;
784  UT_StringHolder myIcon;
785 
786  int myOpId;
787  bool mySortChildren;
788 };
789 
791 
793 
794 // ======================================================================
795 // The interface on the plugin host that the plugin can use to communicate
796 // through.
797 
799 {
800 public:
801  /// The list of node change types when calling DT_Host::nodesChanged.
803  {
804  NCT_VALUE_CHANGE, ///< Use id of node(s) whose value changed
805  NCT_NAME_CHANGE, ///< Use id of node(s) renamed
806  NCT_SELECTION_CHANGE, ///< Use id of node(s) whose selection changed
807  NCT_CHILD_ADDED, ///< Use parent id(s) of node(s) added
808  NCT_CHILD_MOVED, ///< Use parent id(s) of node(s) moved
809  NCT_REMOVED, ///< Use id of node(s) removed
810  NCT_EXPANDED, ///< Use id of node(s) that should be expanded
811  NCT_COLLAPSED, ///< Use id of node(s) that should be collapsed
812  };
813 
814  DT_Host(DT_ViewportProvider *viewport_provider);
815  virtual ~DT_Host();
816 
817  /// Sets a filter pattern on the tree, showing only the nodes in the tree
818  /// that match using UT_String::multiMatch with the given pattern. The
819  /// match is made using the full path to the tree node. If filter_cells is
820  /// set to true, the filter is additionally applied to the individual cell
821  /// values for that row, again using UT_String::multiMatch.
822  virtual void setNodeFilter(const char *pattern, bool filter_cells) = 0;
823 
824  /// This method should be called to notify the display tree that a node, or
825  /// a set of nodes, has changed in some way.
826  virtual void nodesChanged(NodeChangeType type,
827  const DT_NodeIdSet &node_ids) = 0;
828 
829  /// Some plugin options have changed and the UI needs to update.
830  virtual void sharedOptionsChanged() = 0;
831 
832  /// Adds an interest on a node that's not a part of the display tree. This
833  /// is useful for when there's not a direct 1-to-1 mapping available
834  /// between tree nodes and OP nodes we're interested in.
835  /// Returns \c true if successful.
836  virtual bool addInterestOnNode(DT_NodeHandle node) = 0;
837 
838  /// Called by plugins to remove an interest from a node that's not a part
839  /// of the display tree.
840  /// Returns \c true if successful.
841  virtual bool removeInterestOnNode(DT_NodeHandle node) = 0;
842 
843  /// Starts an in-place editing operation on a node.
844  virtual void startRename(DT_NodeHandle node) = 0;
845 
846  /// The definition, order and/or count of the parameter definitions has
847  /// changed. This call will cause the data tree to update the corresponding
848  /// display columns.
849  virtual void parameterDefsChanged() = 0;
850 
851  /// Saves the node tree expansion state. This expansion state is
852  /// automatically restored when the next update occurs.
853  virtual void saveTreeExpansionState(bool match_nodes_by_name) = 0;
854 
855  /// Request running a delayed action. This causes the host to call
856  /// DT_Plugin::runDelayedAction with the same parameters as given to this
857  /// call, once the current operation is complete and control is given back
858  /// to the data tree host. This can be used, for example, to perform scene
859  /// operations outside of the DT_Plugin::opEvent callback, when those
860  /// operations may cause events to be generated (e.g. changing a parameter
861  /// value as a reaction to an OP event).
862  /// The action_id is any arbitrary integer, and the data is an opaque
863  /// shared pointer whose interpretation is known only to the plugin.
864  /// \c UT_SharedPtr<void> allows converting back to a known pointer value.
865  /// E.g. if the value given is \c UT_SharedPtr<Foo> is given, then the
866  /// \c UT_SharedPtr<void> value given in DT_Plugin::runDelayedAction can be
867  /// converted back into \c UT_SharedPtr<Foo>.
868  virtual void addDelayedAction(int action_id, UT_SharedPtr<void> data) = 0;
869 
870  /// Report a message of the given severity. The message will be reported
871  /// to Houdini's status line.
872  virtual void addMessage(UT_ErrorSeverity sev, const char *fmt, ...) = 0;
873 
874  /// For binding the data tree to the viewport. Gets a selection from an
875  /// available Scene Viewer pane. Can either take the current selection,
876  /// or force a new selection. Can also choose to get back an object
877  /// selection, component selection, or accept either.
878  virtual bool getViewportSelection(
879  const DT_ViewportSelectionConfig &selection_config,
881 
882  /// Interrupt any running viewport selection.
883  virtual void interruptViewportSelection();
884 
885 private:
886  DT_ViewportProvider *myViewportProvider;
887  const DT_ViewportSelectionConfig *myViewportSelectionConfig;
888 };
889 
890 // ======================================================================
891 // Plugin definition
892 
894 {
895 public:
896  DT_Plugin(DT_Host &host);
897  virtual ~DT_Plugin();
898 
899  /// @{
900  /// Methods provided by the plugin architecture.
901  const DT_NodeHandle &rootNode() const { return myRootNode; }
902 
903  /// Returns the DT_DT_HostInterface object which can be used to
904  /// communicate with the host to notify of dirty nodes, parameter changes,
905  /// global option changes, etc.
906  DT_Host &host() const { return myHost; }
907  /// @}
908 
909  /// @{
910  /// Methods to be implemented by the plugin.
911 
912  /// Returns the display name of the data tree plugin. This will be shown in
913  /// the list of available plugins in the data tree pane.
914  virtual const UT_StringHolder &name() const = 0;
915 
916  /// Returns the help ID to be used when the user clicks on the help button
917  /// in the Data Tree pane. By default it just returns the base help for
918  /// the Data Tree.
919  virtual const UT_StringHolder &helpId() const = 0;
920 
921  /// @{
922  /// Tree nodes
923 
924  enum RenameStyle {
925  RS_INVALID, // In-place name editing not allowed
926  RS_ALPHANUM, // Allow alphanumeric characters only
927  RS_OPNAME, // Allow only characters valid for an op name
928  RS_ANY // Allow any characters
929  };
930 
931  /// Get the children of the given node.
932  virtual bool getChildren(const DT_Node &parent,
933  DT_NodeList &list) = 0;
934 
935  /// Returns true if the parent node potentially has children. False
936  /// positives are much better than false negatives.
937  virtual bool hasChildren(const DT_Node &parent)
938  { return true; }
939 
940  /// Get the info text to show in the MMB popup window.
941  virtual bool getNodeInfoText(const DT_Node &node,
942  UT_WorkBuffer &info_text)
943  { return false; }
944 
945  /// The node delete operation is valid for this plugin.
946  virtual bool canDeleteNode(const DT_Node &node)
947  { return false; }
948 
949  /// Called when a request for delete occurs.
950  virtual bool deleteNodes(const DT_NodeList &node_list)
951  { return false; }
952 
953  /// Check if the node copy operation is valid for this plugin.
954  virtual bool canCopyNodes(const DT_NodeList &list,
955  DT_NodeList *filtered_list)
956  { return false; }
957 
958  /// Called when a request to copy occurs.
959  virtual bool copyNodes(const DT_NodeList &list)
960  { return false; }
961 
962  /// Check if the reviously copied nodes can be pasted into the given parent.
963  virtual bool canPasteNodes(const DT_Node &parent_node)
964  { return false; }
965 
966  /// Called when a request to paste into a parent node occurs.
967  virtual bool pasteNodes(const DT_Node &parent_node)
968  { return false; }
969 
970  /// The node rename operation is valid for this plugin.
971  virtual RenameStyle getRenameStyle(const DT_Node &node)
972  { return RS_INVALID; }
973 
974  /// Called when a request for node rename occurs.
975  virtual bool renameNode(const DT_Node &node, const char *new_name)
976  { return false; }
977 
978  /// Called when the right mouse-button (RMB) is clicked on a node. The
979  /// entire node selection is passed in, allowing to create a combined menu
980  /// for all selected nodes.
981  /// When retrieving the top-level menu, \c sub_menu_token will be \c NULL.
982  virtual bool getNodeMenu(const DT_NodeList &node_list,
983  const char *sub_menu_token,
984  DT_NodeMenuItemList &items)
985  { return false; }
986 
987  /// Perform the menu action specified by the user. The \c menu_token
988  /// argument will be the token of the menu item that the user selected.
989  /// The node list will be the same as was passed into \c getNodeMenu.
990  virtual void runMenuAction(const DT_NodeList &node_list,
991  const char *menu_token)
992  { }
993  /// @}
994 
995  /// @{
996  /// Tree parameters
997 
999  {
1000  PS_INVALID, ///< No value can be retrieved.
1001  PS_VALID, ///< Value is valid
1002  PS_INDETERMINATE, ///< The value state is indeterminate
1003  PS_ANIMATED, ///< The value is animated and should have a
1004  ///< green background.
1005  PS_LOCKED ///< The value is locked and cannot be edited.
1006  };
1007 
1008  /// Returns the list of parameter definitions for the tree columns.
1009  virtual const DT_ParmDefList &getParameterDefs() = 0;
1010 
1011  /// For dealing with DT_ParmDefGrouped parameters, this method controls
1012  /// which grouped DT_ParmDef should be displayed for a particular DT_Node.
1013  virtual int getGroupedParameterId(const DT_Node &node, int parm_id)
1014  { return parm_id; }
1015 
1016  /// Retrieve a value of a specific parameter for the given node. The
1017  /// parm_id is the value returned from DT_ParmDef::id(). The for_feel
1018  /// flag indicates if we are fetching this value to set up our UI_Feel
1019  /// when the mouse moves over this cell.
1020  ///
1021  /// Use the copyValue function for each function definition to retrieve
1022  /// a concrete values from the opaque DT_Value type.
1023  /// The caller expects DT_Value to be able to cast to specific types
1024  /// to retrieve the display value. Use the following table, based on the
1025  /// parm def type:
1026  ///
1027  /// A return value of \c PS_INDETERMINATE should only be returned if the
1028  /// parameter definition supports it, otherwise it is ignored.
1029  /// Return \c PS_INVALID if no value can be retrieved from the node.
1030  /// \note This function is never called for T_BUTTON types. Only
1031  /// setParameterValue.
1032  virtual ParmState getParameterValue(const DT_Node &node, int parm_id,
1033  DT_Value &value, bool for_feel) = 0;
1034 
1035  /// Sets the value of a specific parameter for the given node. The parm_id
1036  /// is the value returned from DT_ParmDef::id()
1037  /// See the table for getValue for which C++ types should be expected for
1038  /// a given parameter definition type.
1039  virtual bool setParameterValue(const DT_Node &node, int parm_id,
1040  const DT_Value &value) = 0;
1041 
1042  /// Sets the same value of a specific parameter on multiple nodes. This can
1043  /// be used to optimize costly operations, or support exclusivity. The first
1044  /// node in the list is the node for who the user set the value on.
1045  /// The parm_id is the value returned from DT_ParmDef::id()
1046  virtual bool setParameterValues(const DT_NodeList &node_list,
1047  int parm_id,
1048  const DT_Value &value);
1049 
1050  /// For DT_ParmDefMenu items that are defined as dynamic, this function
1051  /// can be used to return a list of menu items based on the specific node,
1052  /// or the current state of other parameters.
1053  virtual bool getParameterMenuItems(const DT_Node &node,
1054  int parm_id,
1055  DT_MenuItemList &items)
1056  { return false; }
1057  /// @}
1058 
1059  /// @{
1060  /// Selection
1061 
1062  /// Called when a node queries for its selection state. If the selection
1063  /// state can be computed, the selection state is returned through the
1064  /// argument 'state' and a value of true returned. Return false if the
1065  /// selection can not be computed, or not supported. In that case, if
1066  /// DT_Node::opId returns a valid id, the op node is queried for its
1067  /// selection state.
1068  virtual bool getSelected(const DT_Node &node, bool &state)
1069  { return false; }
1070 
1071  /// Called when a node is selected or de-selected in the UI. The requested
1072  /// selection state is given by the 'state' argument. If the selection is
1073  /// handled, a value of \c true should be returned. Otherwise, return a
1074  /// value of \c false. In that case, if DT_Node::opId returns a valid id,
1075  /// the op node is selected.
1076  virtual bool setSelected(const DT_Node &node, bool state)
1077  { return false; }
1078  /// @}
1079 
1080  /// @{
1081  /// User-modifiable Plugin Options
1082 
1083  /// Returns the list of parameter definitions for the tree columns.
1084  virtual const DT_ParmDefList &getOptionDefs();
1085 
1086  /// Gets a value for a given option from the plugin.
1087  /// See getParameterValue
1088  /// \param parm_id The id of the parameter. Corresponds to the return
1089  /// value of DT_ParmDef::id.
1090  /// \param value The value returned from the plugin.
1091  /// \return \c true if successful, \c false otherwise.
1092  virtual bool getOptionValue(int parm_id, DT_Value &value)
1093  { return false; }
1094 
1095  /// Sets an option value for the plugin.
1096  virtual bool setOptionValue(int parm_id, const DT_Value &value)
1097  { return false; }
1098 
1099  /// For DT_ParmDefMenu items that are defined as dynamic, this function
1100  /// returns the list of menu items based on the current state.
1101  virtual bool getOptionMenuItems(int parm_id,
1102  DT_MenuItemList &items)
1103  { return false; }
1104  /// @}
1105 
1106  /// @{
1107  /// Events
1108 
1109  /// Called when an operator event has occurred. All nodes that have an
1110  /// interest in a given operator are in the array. See OP_EventType
1111  /// for explanation of what the \c data pointer contains.
1112  virtual void opEvent(const DT_NodeIdSet &node_ids,
1113  OP_EventType type, void *data)
1114  { }
1115 
1116 
1117  /// Called by the host when it is time to run a delayed action that was
1118  /// added with DT_Host::addDelayedAction. Multiple delayed actions are
1119  /// coalesced into one call, hence the list of data.
1120  virtual void runDelayedAction(
1121  int action_id,
1122  const UT_Array<UT_SharedPtr<void> > &data_list)
1123  { }
1124  /// @}
1125 
1126  /// @{
1127  /// Drag and drop
1128  ///
1129 
1130  /// Drag Source
1131  virtual bool dragHasData(const DT_Node &node,
1132  const char *data_label)
1133  { return false; }
1134 
1135  virtual void *dragGetData(const DT_Node &node,
1136  const char *data_label)
1137  { return NULL; }
1138 
1139  /// Drop Receiver
1140  virtual bool dropAccept(const DT_Node &node,
1141  DD_Source &drag_src,
1142  const char *data_label)
1143  { return false; }
1144 
1145  virtual bool dropTest(const DT_Node &node,
1146  DD_Source &drag_src)
1147  { return false; }
1148  virtual void dropGetChoice(const DT_Node &node,
1149  DD_Source &drag_src,
1150  DD_ChoiceList &drop_choices)
1151  { }
1152 
1153  /// When drag and drop is used to reorder child nodes, we get notified
1154  /// through this function.
1155  virtual void nodesReordered(const DT_Node &parent_node,
1156  const UT_IntArray &from_idx,
1157  const UT_IntArray &to_idx)
1158  { }
1159  /// @}
1160 
1161  /// @{
1162  /// Persistence
1163 
1164  /// When the desktop is saved, this method is called to allow the plugin
1165  /// to save any data that would not be saved otherwise.
1166  virtual bool writeDesktopData(std::ostream &os)
1167  { return false; }
1168 
1169  virtual bool readDesktopData(std::istream &is)
1170  { return false; }
1171 
1172  virtual bool writeSceneData(std::ostream &os)
1173  { return writeDesktopData(os); }
1174 
1175  virtual bool readSceneData(std::istream &is)
1176  { return readDesktopData(is); }
1177  /// @}
1178 
1179 protected:
1180  /// Only subclasses can access a non-const version of our root DT_Node.
1181  DT_Node &rootNodeRef();
1182  /// Under special circumstances, a subclass may want to create a new
1183  /// root-like DT_Node (using the default DT_Node constructor, which is
1184  /// private). This function makes that possible.
1185  static DT_NodeHandle createRootNode();
1186 
1187 private:
1188  DT_NodeHandle myRootNode;
1189  DT_Host &myHost;
1190 };
1191 
1193 
1194 
1195 /// A data tree plugin factory base class. Used to create Data Tree plugins on
1196 /// demand and to query names of plugins without creating them.
1197 /// For writing a new Data Tree plugin, see \c ::newDataTreePluginFactory for
1198 /// and example of how to sub-class this class to create a factory for your
1199 /// plugin.
1201 {
1202 public:
1203  virtual ~DT_PluginFactory() {}
1204 
1205  ///
1206  virtual const UT_StringHolder &name() const = 0;
1207 
1208  /// Create a new instance of a data tree plugin from this factory.
1209  virtual DT_PluginHandle create(DT_Host &host) = 0;
1210 
1211 protected:
1212  static bool registerFactory(DT_PluginFactory &factory);
1213 };
1214 
1215 extern "C" {
1216  /// All DSOs that provide a Data Tree plugin factory should implement this
1217  /// function. All it needs to do is to create the appropriate
1218  /// DT_PluginFactory for the plugin(s) it implements.
1219  /// Example:
1220  /// \code
1221  /// class MyDataTreePlugin : public DT_Plugin { ... };
1222  ///
1223  /// class MyDataTreePluginFactory : public DT_PluginFactory
1224  /// {
1225  /// public:
1226  /// MyDataTreePluginFactory()
1227  /// {
1228  /// registerFactory(*this);
1229  /// }
1230  ///
1231  /// virtual const char *name() const { return "My Data Tree Plugin"; }
1232  ///
1233  /// virtual DT_PluginHandle create(DT_Host &host)
1234  /// {
1235  /// return DT_PluginHandle(new MyDataTreePlugin(host));
1236  /// }
1237  /// };
1238  ///
1239  /// UT_UniquePtr<MyDataTreePluginFactory> theFactory;
1240  ///
1241  /// SYS_VISIBILITY_EXPORT void newDataTreePluginFactory()
1242  /// {
1243  /// theFactory.reset(new MyDataTreePluginFactory);
1244  /// }
1245  /// \endcode
1246 
1248 };
1249 
1250 #endif // __DT_Plugin__
1251 
const DT_NodeHandle & rootNode() const
Definition: DT_Plugin.h:901
UT_StringHolder myToolbarName
Definition: DT_Plugin.h:278
GT_API const UT_StringHolder selection
Definition: UT_Set.h:58
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:1068
SYS_VISIBILITY_EXPORT void newDataTreePluginFactory()
DT_NodeId id() const
Definition: DT_Plugin.h:761
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:764
#define SYS_VISIBILITY_EXPORT
virtual void opEvent(const DT_NodeIdSet &node_ids, OP_EventType type, void *data)
Definition: DT_Plugin.h:1112
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:975
virtual bool dragHasData(const DT_Node &node, const char *data_label)
Drag Source.
Definition: DT_Plugin.h:1131
UT_Array< DT_NodeMenuItem > DT_NodeMenuItemList
Definition: DT_Plugin.h:109
UT_SharedPtr< const DT_ParmDef > DT_ParmDefHandle
Definition: DT_Plugin.h:284
virtual bool getParameterMenuItems(const DT_Node &node, int parm_id, DT_MenuItemList &items)
Definition: DT_Plugin.h:1053
Use id of node(s) whose selection changed.
Definition: DT_Plugin.h:806
Value is valid.
Definition: DT_Plugin.h:1001
const UT_StringHolder & name() const
Definition: DT_Plugin.h:747
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
UT_ErrorSeverity
Definition: UT_Error.h:25
GLbitfield flags
Definition: glcorearb.h:1595
UT_SharedPtr< DT_ParmDef > DT_ParmDefPtr
Definition: DT_Plugin.h:283
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:790
virtual bool writeSceneData(std::ostream &os)
Definition: DT_Plugin.h:1172
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:733
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:967
virtual bool canDeleteNode(const DT_Node &node)
The node delete operation is valid for this plugin.
Definition: DT_Plugin.h:946
virtual bool setOptionValue(int parm_id, const DT_Value &value)
Sets an option value for the plugin.
Definition: DT_Plugin.h:1096
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:792
Use id of node(s) that should be expanded.
Definition: DT_Plugin.h:810
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:1092
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:750
Only show plugin option in dialog (default)
Definition: DT_Plugin.h:209
exint DT_NodeId
A unique node identifier.
Definition: DT_Plugin.h:727
DT_Host & host() const
Definition: DT_Plugin.h:906
Objects + virtual SOP paths.
Definition: DT_Plugin.h:624
const DT_ParmDefList & groupedDefs() const
Definition: DT_Plugin.h:713
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
virtual ~DT_PluginFactory()
Definition: DT_Plugin.h:1203
int64 exint
Definition: SYS_Types.h:116
UT_Array< DT_ParmDefHandle > DT_ParmDefList
Definition: DT_Plugin.h:285
const std::enable_if<!VecTraits< T >::IsVec, T >::type & max(const T &a, const T &b)
Definition: Composite.h:133
The value state is indeterminate.
Definition: DT_Plugin.h:1002
virtual void nodesReordered(const DT_Node &parent_node, const UT_IntArray &from_idx, const UT_IntArray &to_idx)
Definition: DT_Plugin.h:1155
bool operator!=(const DT_Node &other) const
Definition: DT_Plugin.h:766
Integer type. DT_ParmDefInteger.
Definition: DT_Plugin.h:197
Use id of node(s) that should be collapsed.
Definition: DT_Plugin.h:811
UT_StringHolder myTooltip
Definition: DT_Plugin.h:276
UT_SharedPtr< DT_Plugin > DT_PluginHandle
Definition: DT_Plugin.h:1192
virtual bool allowsMultiValueSet() const
Dont allow triggering multiple radio buttons with one click.
Definition: DT_Plugin.h:329
const UT_StringHolder & tooltip() const
Definition: DT_Plugin.h:239
virtual bool readSceneData(std::istream &is)
Definition: DT_Plugin.h:1175
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:941
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:954
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:1120
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:35
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:971
virtual bool allowsMultiValueSet() const
Don't allow triggering multiple buttons at once.
Definition: DT_Plugin.h:688
DT_Value(const T &value)
Definition: DT_Plugin.h:125
virtual bool getOptionMenuItems(int parm_id, DT_MenuItemList &items)
Definition: DT_Plugin.h:1101
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:809
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:270
File browser.
Definition: DT_Plugin.h:626
int opId() const
Definition: DT_Plugin.h:753
Use parent id(s) of node(s) moved.
Definition: DT_Plugin.h:808
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:1135
bool sortChildren() const
Definition: DT_Plugin.h:756
virtual bool writeDesktopData(std::ostream &os)
Definition: DT_Plugin.h:1166
virtual ~DT_ParmDef()
Definition: DT_Plugin.h:191
Use id of node(s) whose value changed.
Definition: DT_Plugin.h:804
No value can be retrieved.
Definition: DT_Plugin.h:1000
DT_NodeId parentId() const
Definition: DT_Plugin.h:762
virtual int getGroupedParameterId(const DT_Node &node, int parm_id)
Definition: DT_Plugin.h:1013
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:1140
Directory browser.
Definition: DT_Plugin.h:627
virtual bool allowsMultiValueSet() const
Don't allow triggering multiple action menus at once.
Definition: DT_Plugin.h:600
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:959
virtual bool readDesktopData(std::istream &is)
Definition: DT_Plugin.h:1169
bool readOnly() const
Definition: DT_Plugin.h:245
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:126
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:963
virtual bool getNodeMenu(const DT_NodeList &node_list, const char *sub_menu_token, DT_NodeMenuItemList &items)
Definition: DT_Plugin.h:982
virtual bool dropTest(const DT_Node &node, DD_Source &drag_src)
Drag Source.
Definition: DT_Plugin.h:1145
virtual void dropGetChoice(const DT_Node &node, DD_Source &drag_src, DD_ChoiceList &drop_choices)
Drag Source.
Definition: DT_Plugin.h:1148
#define DTUI_API
Definition: DTUI_API.h:10
virtual bool hasChildren(const DT_Node &parent)
Definition: DT_Plugin.h:937
static DT_NodeId invalidId()
A value that can be used to denote an invalid node id.
Definition: DT_Plugin.h:770
DT_Value()
Definition: DT_Plugin.h:120
Use id of node(s) renamed.
Definition: DT_Plugin.h:805
virtual void runMenuAction(const DT_NodeList &node_list, const char *menu_token)
Definition: DT_Plugin.h:990
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:730
Node parameter.
Definition: DT_Plugin.h:625
const std::enable_if<!VecTraits< T >::IsVec, T >::type & min(const T &a, const T &b)
Definition: Composite.h:129
bool myReadOnly
Definition: DT_Plugin.h:279
NodeChangeType
The list of node change types when calling DT_Host::nodesChanged.
Definition: DT_Plugin.h:802
virtual bool setSelected(const DT_Node &node, bool state)
Definition: DT_Plugin.h:1076
Use parent id(s) of node(s) added.
Definition: DT_Plugin.h:807
virtual bool deleteNodes(const DT_NodeList &node_list)
Called when a request for delete occurs.
Definition: DT_Plugin.h:950
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:623
GLenum src
Definition: glcorearb.h:1792