HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_DopDescription.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  */
7 
8 #ifndef __SIM_DopDescription_h__
9 #define __SIM_DopDescription_h__
10 
11 #include "SIM_API.h"
12 #include <UT/UT_String.h>
13 
14 class PRM_ParmList;
15 class PRM_Template;
16 class OP_Node;
17 class OP_Operator;
18 
19 /// This class is used to create a new DOP type based on a SIM_Data subclass.
20 /// This class stores the information that describes the automatic DOP that
21 /// should be created to represent this data type. An automatic DOP outputs
22 /// an instance of a SIM_Data subclass to be attached to one or more objects.
24 {
25 public:
26  /// Returns the live data input. Note that this unfortuantely
27  /// does not often correspond to the wire index!
28  /// -1 means all inputs are enabled. -2 means none of them are.
29  /// 0 or more mean only that input is enabled.
30  typedef int (*SIM_ComputeLiveInput)(const OP_Node *node, double time);
31 
32  /// Callback to handle any obsolete parameters.
33  typedef void (*SIM_ObsoleteParmResolver)(OP_Node *node,
34  PRM_ParmList *obsolete_parms);
35 
36  /// Callback to update old nodes to the latest version.
37  typedef void (*SIM_SyncNodeVersion)(OP_Node *node, const char *old_version,
38  const char *cur_version,
39  bool *node_deleted);
40 
41  /// Callback to provide a custom version string for the operator.
42  typedef bool (*SIM_GetOpVersion)(const OP_Operator &op, UT_String &version);
43 
44  /// Callback to hide or disable parameters.
45  typedef bool (*SIM_UpdateParmsFlags)(OP_Node *node);
46 
47  /// The SIM_DopDescription constructor.
48  /// All features of this class are set on construction and cannot be
49  /// altered once set. Generally this class will be created in a static
50  /// member function of some SIM_Data subclass and used when registering
51  /// the data factory. See the various data access functions for a
52  /// desription of what each constructor argument means.
53  SIM_DopDescription(bool createdop,
54  const char *dopname,
55  const char *dopenglish,
56  const char *dataname,
57  const char *datatypename,
58  const PRM_Template *templates);
59  /// The SIM_DopDescription destructor.
61 
62  /// Returns true if an automatic DOP should be created.
63  /// Many SIM_Data subclasses are for internal use only and do not want
64  /// to be created explicitly by users. In that case this value should be
65  /// set to false, in which case all other values will be ignored.
66  bool getCreateDop() const;
67  /// Returns the name of the automatic DOP operator type.
68  /// This name must be unique among DOP operator types.
69  const UT_String &getDopName() const;
70  /// Returns the descriptive name for the DOP operator type.
71  /// This is the value that appears in toolbars to represent the automatic
72  /// DOP operator type created from this DOP description.
73  const UT_String &getDopEnglish() const;
74  /// Returns the name of the data within the simulation object.
75  /// This name should be a unique value that specifies the name under
76  /// which this data is stored in each simulation object.
77  const UT_String &getDataName() const;
78  /// Returns the name of the SIM_Data subclass type.
79  /// This is the name under which the SIM_Data subclass is registered.
80  /// This value is used to create the new data.
81  const UT_String &getDataTypeName() const;
82  /// Returns the name of the SIM_Data to be created if the node is
83  /// bypassed. If none is given, the data will be deleted.
84  const char *getBypassDataTypeName() const { return myBypassDataTypeName; }
85  void setBypassDataTypeName(const char *name) { myBypassDataTypeName.harden(name); }
86  /// Returns an array of PRM_Templates for setting options.
87  /// The values from each parameter are placed into a SIM_Options, which
88  /// is then sent to the SIM_Data::setParameters() function to set up
89  /// the SIM_Data class based on the parameter values.
90  const PRM_Template *getTemplates() const;
91  /// Returns if this data should have no grey inputs, but instead only
92  /// green inputs so it has to go through an apply stage.
93  bool getPureApplyData() const { return myPureApplyData; }
94  void setPureApplyData(bool pureapply) { myPureApplyData = pureapply; }
95 
96  /// Set the "lowest common denominator" data type name. This is the
97  /// data type that DOP nodes compare existing data against to see if the
98  /// requested data already exists and is of a "compatible" type. This
99  /// affects whether the DOP node uses its "set initial" parameters or
100  /// only its "set always" parameters. This defaults to the actual data
101  /// type name.
102  void setLCDDataTypeName(const char *lcddatatype);
103  /// Set the "lowest common denominator" data type name.
104  const UT_String &getLCDDataTypeName() const;
105 
106  /// Set the Share Data parameter default. The default if off.
107  void setDefaultShareData(int share);
108  /// Get the Share Data parameter default.
109  int getDefaultShareData() const;
110  /// Set the Unique Data Name parameter default. The default is off.
111  void setDefaultUniqueDataName(int unique);
112  /// Get the Unique Data Name parameter default.
113  int getDefaultUniqueDataName() const;
114  /// Set whether each parm gets an update menu. The default is on.
115  void setCreatePerParmUpdateMenus(bool createmenus)
116  { myCreatePerParmUpdateMenus = createmenus; }
117  /// get whether each parm gets an update menu.
119  { return myCreatePerParmUpdateMenus; }
120 
121  /// Set the templates to use for controlling guide geometry.
122  void setGuideTemplates(const PRM_Template *tplates);
123  /// Get the templates to use for controlling guide geometry.
124  const PRM_Template *getGuideTemplates() const;
125 
126  /// Set the templates to use for obsolete parameters.
127  void setObsoleteTemplates(PRM_Template *tplates);
128  /// Get the templates to use for obsolete parameters.
129  PRM_Template *getObsoleteTemplates() const;
130  /// Set the callback to handle any obsolete parameters.
131  void setObsoleteParmResolver(SIM_ObsoleteParmResolver resolver);
132  /// Launch the callback to handle the obsolete parameters.
133  void resolveObsoleteParms(OP_Node *node,
134  PRM_ParmList *obsolete_parms) const;
135  /// Set the callback to update nodes to the latest version.
136  void setSyncNodeVersion(SIM_SyncNodeVersion callback);
137  /// Launch the callback to update nodes to the latest version.
138  void syncNodeVersion(OP_Node *node, const char *old_version,
139  const char *cur_version, bool *node_deleted) const;
140  /// Set the callback to provide a custom version string for the operator.
141  void setOpVersionCallback(SIM_GetOpVersion callback);
142  /// Launch the callback to provide a custom version string for the operator.
143  bool getOpVersion(const OP_Operator &op, UT_String &version) const;
144 
145  /// Set the callback to hide or disable parameters.
146  void setUpdateParmsFlags(SIM_UpdateParmsFlags callback);
147  /// Run the callback to hide or disable parameters.
148  bool updateParmsFlags(OP_Node *node) const;
149 
151  { return myInitialTemplateFlag; }
152  void setInitialTemplateFlag(bool flagval)
153  { myInitialTemplateFlag = flagval; }
154 
155  int computeLiveInput(int defval, const OP_Node *node, double time) const
156  {
157  if (!myLiveInputComputer)
158  return defval;
159  return (*myLiveInputComputer)(node, time);
160  }
161  void setLiveInputComputer(SIM_ComputeLiveInput computer) { myLiveInputComputer = computer; }
162 
163  void getDescriptiveNameParm(UT_String &parm) const { parm = myDescriptiveNameParm; }
164  void setDescriptiveNameParm(const char *parm) { myDescriptiveNameParm.harden(parm); }
165 
166 private:
167  /// Disallow using the copy constructor.
169  /// Disallow using the assignment operator.
171 
172  bool myCreateDop;
173  const UT_String myDopName;
174  const UT_String myDopEnglish;
175  const UT_String myDataName;
176  const UT_String myDataTypeName;
177  UT_String myBypassDataTypeName;
178  const PRM_Template *myTemplates;
179  const PRM_Template *myGuideTemplates;
180  PRM_Template *myObsoleteTemplates;
181  SIM_ObsoleteParmResolver myObsoleteParmResolver;
182  SIM_SyncNodeVersion mySyncNodeVersionCallback;
183  SIM_GetOpVersion myGetOpVersionCallback;
184  SIM_UpdateParmsFlags myUpdateParmsCallback;
185  UT_String myLCDDataTypeName;
186  int myDefaultShareData;
187  int myDefaultUniqueDataName;
188  bool myCreatePerParmUpdateMenus;
189  bool myPureApplyData;
190  bool myInitialTemplateFlag;
191  SIM_ComputeLiveInput myLiveInputComputer;
192  UT_String myDescriptiveNameParm;
193 };
194 
195 #endif
196 
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
bool getPureApplyData() const
void
Definition: png.h:1083
GT_API const UT_StringHolder time
void setLiveInputComputer(SIM_ComputeLiveInput computer)
const char * getBypassDataTypeName() const
void getDescriptiveNameParm(UT_String &parm) const
void setPureApplyData(bool pureapply)
GLuint const GLchar * name
Definition: glcorearb.h:786
bool getCreatePerParmUpdateMenus() const
get whether each parm gets an update menu.
int computeLiveInput(int defval, const OP_Node *node, double time) const
GT_API const UT_StringHolder version
I unique(I begin, I end)
Definition: pugixml.cpp:7195
bool getInitialTemplateFlag() const
LeafData & operator=(const LeafData &)=delete
void setBypassDataTypeName(const char *name)
void setCreatePerParmUpdateMenus(bool createmenus)
Set whether each parm gets an update menu. The default is on.
#define SIM_API
Definition: SIM_API.h:12
void setInitialTemplateFlag(bool flagval)
void setDescriptiveNameParm(const char *parm)