HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_NodeFlags.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: OP Library (C++)
7  *
8  */
9 
10 #ifndef __OP_NodeFlags_h__
11 #define __OP_NodeFlags_h__
12 
13 #include "OP_API.h"
14 #include <SYS/SYS_Types.h>
15 #include <iosfwd>
16 
17 class UT_IStream;
18 class UT_String;
19 class OP_Node;
20 class OP_Network;
21 class OP_Director;
22 
23 #define OP_BYPASS_FLAG 'b'
24 #define OP_COLORDEFAULT_FLAG 'F'
25 #define OP_COMPRESS_FLAG 'c'
26 #define OP_CURRENT_FLAG 'C'
27 #define OP_DISPLAY_FLAG 'd'
28 #define OP_EXPOSE_FLAG 'e'
29 #define OP_FOOTPRINT_FLAG 'f'
30 #define OP_HIGHLIGHT_FLAG 'h'
31 #define OP_LOCK_FLAG 'l'
32 #define OP_SOFT_LOCK_FLAG 'K'
33 #define OP_OUTPUTFORVIEW_FLAG 'O'
34 #define OP_PICK_FLAG 'p'
35 #define OP_DESCRIPTIVENAME_FLAG 'P'
36 #define OP_DISPLAYCOMMENT_FLAG 'Y'
37 #define OP_RENDER_FLAG 'r'
38 #define OP_SAVEDATA_FLAG 's'
39 #define OP_TEMPLATE_FLAG 't'
40 #define OP_UNLOAD_FLAG 'u'
41 #define OP_VISIBLE_FLAG 'V'
42 #define OP_XRAY_FLAG 'y'
43 
44 #define OP_MODELED_FLAG 'm'
45 #define OP_END_FLAG 'E'
46 #define OP_ORIGIN_FLAG 'x'
47 
48 #define OP_FLAG_ON " on"
49 #define OP_FLAG_OFF " off"
50 
51 #define SET_FLAG_STRING(str_val, flag_val) \
52  str_val = (flag_val) ? OP_FLAG_ON : OP_FLAG_OFF
53 
54 //___________________________________________________________________________
55 
57 {
58 public:
59 
61  {
62  OP_UNLOCKED = 0x0,
63  OP_HARD_LOCKED = 0x1,
64  OP_SOFT_LOCKED = 0x2
65  };
66 
67  static const char *getFlagName(uchar token);
68 
69  static const uchar *getTakeFlagTokens();
70  static bool isTakeFlag(uchar token);
71 
72  // Methods to check whether a particular flag is subject to permissions.
73  // The set of flags subject to asset permissions is a superset of those
74  // subject to standard permissions.
75  static bool isSubjectToStdPermissions(uchar token);
76  static bool isSubjectToAssetPermissions(uchar token);
77 
78  void setRecursion(bool val) const
79  { myRecursion = val; }
80  bool getRecursion() const
81  { return myRecursion; }
82 
83  void setUndoComment(int onOff)
84  { undoComment = onOff; }
85  void setUndoInput(int onOff)
86  { undoInput = onOff; }
87  void setUndoLayout(int onOff)
88  { undoLayout = onOff; }
89  void setUndoDelScript(int onOff)
90  { undoDelScript = onOff; }
91  void setUndoPreTransform(int onOff)
92  { undoPreTransform = onOff; }
93  void setUndoFlagChange(int onOff)
94  { undoFlagChange = onOff; }
95  void setColorDefault(int onOff)
96  { colorDefault = onOff; }
97  void setCompress(int onOff)
98  { compress = onOff; }
99  void setDisplayDescriptiveName(int onOff)
100  { displayDescriptiveName = onOff; }
101  void setDisplayComment(int onOff)
102  { displayComment = onOff; }
103  void setModelled(int onOff)
104  { modelled = onOff; }
105  void setAlwaysCook(int onOff)
106  { alwaysCook = onOff; }
107  void setUnload(int onOff)
108  { unload = onOff; }
109  void setForceCook(int onOff)
110  { forceCook = onOff; }
111  void setHasCookedData(int onOff)
112  { myHasCookedData = onOff; }
113  void setTimeDep(int onOff)
114  { timeDep = onOff; }
115  void setCooking(int onOff)
116  { cooking = onOff; }
117  void setDisplay(int onOff)
118  { display = onOff; }
119  void setRender(int onOff)
120  { render = onOff; }
121  void setHighlight(int onOff)
122  { highlight = onOff; }
123  void setTemplate(int onOff)
124  { templated = onOff; }
125  void setFootprint(int onOff)
126  { footprinted = onOff; }
127  void setXray(int onOff)
128  { xray = onOff; }
129  void setBypass(int onOff)
130  { bypass = onOff; }
131  void setPicked(int onOff)
132  { picked = onOff; }
133  void setEditPicked(int onOff)
134  { editPicked = onOff; }
135  void setHardLocked(int onOff)
136  { locked = onOff ? OP_HARD_LOCKED : OP_UNLOCKED; }
137  void setSoftLocked(int onOff)
138  { locked = onOff ? OP_SOFT_LOCKED : OP_UNLOCKED; }
139  void setLocked(int state)
140  { locked = state; }
141  void setModified(int onOff)
142  { modified = onOff; }
143  void setExpose(int onOff)
144  { exposed = onOff; }
145  void setSaveBypass(int onOff)
146  { saveBypass = onOff; }
147  void setSaveData(int onOff)
148  { saveData = onOff; }
149  void setOutputForView(int output)
150  { outputForView = output; }
151 
152  // Used to detect if we need to call OP_Node::handleTimeInterest() on
153  // a time change
154  void setTimeInterest(int onOff)
155  { timeInterest = onOff; }
156  void setTimeInterestCook(int onOff)
157  { timeInterestCook = onOff; }
158  void setClearDependency(int onOff)
159  {clearDependency = onOff;}
160 
161  int getUndoComment() const
162  { return undoComment; }
163  int getUndoInput() const
164  { return undoInput; }
165  int getUndoLayout() const
166  { return undoLayout; }
167  int getUndoDelScript() const
168  { return undoDelScript; }
170  { return undoPreTransform; }
171  int getUndoFlagChange() const
172  { return undoFlagChange; }
173  int getColorDefault() const
174  { return colorDefault; }
175  int getCompress() const
176  { return compress; }
178  { return displayDescriptiveName; }
179  int getDisplayComment() const
180  { return displayComment; }
181  int getModelled() const
182  { return modelled; }
183  int getAlwaysCook() const
184  { return alwaysCook; }
185  int getUnload() const
186  { return unload; }
187  int getForceCook() const
188  { return forceCook; }
189  int getHasCookedData() const
190  { return myHasCookedData; }
191  int getTimeDep() const
192  { return timeDep; }
193  int getCooking() const
194  { return cooking; }
195  int getDisplay() const
196  { return display; }
197  int getRender() const
198  { return render; }
199  int getHighlight() const
200  { return highlight; }
201  int getTemplate() const
202  { return templated; }
203  int getFootprint() const
204  { return footprinted; }
205  int getXray() const
206  { return xray; }
207  int getBypass() const
208  { return bypass; }
209  int getPicked() const
210  { return picked; }
211  int getEditPicked() const
212  { return editPicked; }
213  int getHardLocked() const
214  { return locked == OP_HARD_LOCKED; }
215  int getSoftLocked() const
216  { return locked == OP_SOFT_LOCKED; }
217  int getLocked() const
218  { return locked; }
219  int getModified() const
220  { return modified; }
221  int getExpose() const
222  { return exposed; }
223  int getSaveBypass() const
224  { return saveBypass; }
225  int getSaveData() const
226  { return saveData; }
227  int getTimeInterest() const
228  { return timeInterest; }
230  { return timeInterestCook; }
231  int getClearDependency() const
232  { return clearDependency; }
233  int getOutputForView() const
234  { return outputForView; }
235 
236  void clearAllTakeFlags();
237  // Set the activation flag
238  void setTakeFlag(uchar which, int v);
239  int getTakeFlag(uchar which) const;
240  // Set the actual flag associated with the take token
241  void setTakeValue(uchar which, int v);
242  int getTakeValue(uchar which) const;
243 
244  void setHasTakeData(int onoff)
245  { myHasTakeData = onoff; }
246  int getHasTakeData() const
247  { return myHasTakeData; }
248 
249  int getTakeDisplay() const
250  { return myTakeDisplay; }
251  int getTakeRender() const
252  { return myTakeRender; }
253  int getTakeTemplate() const
254  { return myTakeTemplate; }
255  int getTakeExpose() const
256  { return myTakeExpose; }
257  int getTakeBypass() const
258  { return myTakeBypass; }
259  int getTakePick() const
260  { return myTakePick; }
261  int getTakeCurrent() const
262  { return myTakeCurrent; }
263 
264  bool getInterrupted() const
265  { return myInterrupted; }
266  void setInterrupted(bool f)
267  { myInterrupted = f; }
269  { return myDescendantInterrupted; }
271  { myDescendantInterrupted = f; }
272  bool getClearingInterrupt() const
273  { return myClearingInterrupt; }
275  { myClearingInterrupt = f; }
276 
277  const char *getExtra() const
278  { return myExtra; }
279 
280  void setExtra(const char *opts, int val,
281  const char **labels)
282  {
283  myExtra = opts;
284  myExtraVal = val;
285  myExtraLabel = labels;
286  }
287 
288  int getExtraVal(char a) const;
289  void setExtraVal(char a, int onoff);
290 
291 
292  void appendCommandString(std::ostream &os,
293  const char *flags,
294  bool save_to_hip) const;
295  void getFlagOptions(UT_String &options) const;
296 
297  // Data for the flags
298  //
299 private:
300  // the most common bits are promoted to full characters for
301  // maximum on/off testing efficiency
302  char modified; // Changed since load/startup.
303  char timeDep; // Needs to recook at different time
304  char cooking; // OP is currently cooking
305  char locked; // OP is hard or soft locked
306  char forceCook; // Force op to recook
307  char alwaysCook; // Always cook this op
308  char bypass; // OP is bypassed when cooking
309  char render; // OP is rendered
310  char display; // OP is displayed
311  char templated; // Data on for display only
312  char outputForView; // Which output to view
313 
314  // USING THESE DIRECTLY IS DEPRECATED! USE THE ACCESSORS!
315  unsigned modelled:1, // Cooked data has been edited.
316  saveBypass:1, // OP is bypassed when saving.
317  saveData:1, // Save cooked data in file.
318  picked:1, // Picked by user.
319  editPicked:1, // Picked by user from viewport.
320  unload:1, // Unload data after usage.
321  colorDefault:1, // Use the default color for this node type.
322  compress:1, // Display OP node in a compressed UI.
323  displayDescriptiveName:1, // Display the descriptive name, if any.
324  displayComment:1, // Display the comment, if any.
325 
326  // These flags are used to save whether a particular
327  // type of change for the node has been saved.
328  undoParmChange:1, // NB: This flag seems to be no longer used!
329  undoFlagChange:1,
330  undoLayout:1,
331  undoInput:1,
332  undoComment:1,
333  exposed:1;
334 
335 
336 private:
337  // the most common bits are promoted to full characters for
338  // maximum on/off testing efficiency
339  mutable bool myRecursion;
340  bool myHasCookedData; // Node has some concept of cooked data
341  char highlight; // OP's contents are highlighted
342 
343  // Which flags are active in the current take
344  unsigned myHasTakeData:1, // Node has take data of some kind
345  myTakeDisplay:1,
346  myTakeRender:1,
347  myTakeTemplate:1,
348  myTakeExpose:1,
349  myTakeBypass:1,
350  myTakePick:1,
351  myTakeCurrent:1;
352 
353  // When an OP's cooking is interrupted, we set this flag
354  bool myInterrupted:1;
355  // Parent networks of any interrupted node has this flag set
356  bool myDescendantInterrupted:1;
357  // This one says we are in the clearInterrupt function.
358  bool myClearingInterrupt:1;
359 
360  unsigned footprinted:1,
361  xray:1,
362  // Used to save whether a particular type of change has been
363  // saved
364  undoDelScript:1,
365  undoPreTransform:1,
366  // Used to detect if we need to call
367  // OP_Node::handleTimeInterest() on a time change
368  timeInterest:1,
369  timeInterestCook:1, // if we've already checked timeInterest
370  clearDependency:1; // if we should clear cook dependencies
371 
372 private:
373  friend class OP_Node;
374  friend class OP_UndoFlag;
375 
376  OP_NodeFlags()
377  : myExtra(nullptr),
378  myExtraLabel(nullptr)
379  { setDefaults(); }
381  { shallowCopy(source); }
382 
383  OP_NodeFlags & operator=(const OP_NodeFlags &) = delete;
384 
385  void shallowCopy(const OP_NodeFlags &source);
386 
387 
388  // Methods to load & save for streams
389  void save(std::ostream &os, int binary = 0, int forundo = 0);
390  bool load(UT_IStream &os, const char *path=0);
391 
392  bool loadAsciiFlag(const char *name, const char *val);
393  bool loadBinaryFlag(int tag, int val);
394 
395  // This method initializes all the flags to their default values
396  void setDefaults(void);
397 
398  const char *myExtra;
399  const char **myExtraLabel;
400  unsigned int myExtraVal;
401 
402 };
403 
404 //
405 // When OP_FLAG_CHANGED events are sent a pointer to this structure
406 // is given.
408 {
409  OP_NodeFlagData(int f, int v) { flag = f; value = v; }
410  OP_NodeFlagData() { flag = -1; value = 0; }
411 
412  int flag; // OP_FOO_FLAG or -1 for all
413  int value; // New value where appropriate.
414 };
415 
416 #endif
int getHardLocked() const
Definition: OP_NodeFlags.h:213
void setModelled(int onOff)
Definition: OP_NodeFlags.h:103
int getUndoFlagChange() const
Definition: OP_NodeFlags.h:171
unsigned char uchar
Definition: SYS_Types.h:42
void setUndoLayout(int onOff)
Definition: OP_NodeFlags.h:87
void setSaveBypass(int onOff)
Definition: OP_NodeFlags.h:145
int getPicked() const
Definition: OP_NodeFlags.h:209
GLuint const GLchar * name
Definition: glew.h:1814
void setForceCook(int onOff)
Definition: OP_NodeFlags.h:109
void setBypass(int onOff)
Definition: OP_NodeFlags.h:129
void setCompress(int onOff)
Definition: OP_NodeFlags.h:97
int getDisplayDescriptiveName() const
Definition: OP_NodeFlags.h:177
int getRender() const
Definition: OP_NodeFlags.h:197
int getUndoPreTransform() const
Definition: OP_NodeFlags.h:169
void setClearingInterrupt(bool f)
Definition: OP_NodeFlags.h:274
GLuint const GLfloat * val
Definition: glew.h:2794
int getModelled() const
Definition: OP_NodeFlags.h:181
int getHasCookedData() const
Definition: OP_NodeFlags.h:189
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:9477
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
Definition: glew.h:2864
int getCompress() const
Definition: OP_NodeFlags.h:175
void setRender(int onOff)
Definition: OP_NodeFlags.h:119
int getHasTakeData() const
Definition: OP_NodeFlags.h:246
int getTakePick() const
Definition: OP_NodeFlags.h:259
OP_NodeFlagData(int f, int v)
Definition: OP_NodeFlags.h:409
void setHasCookedData(int onOff)
Definition: OP_NodeFlags.h:111
bool getClearingInterrupt() const
Definition: OP_NodeFlags.h:272
GLsizei GLsizei GLchar * source
Definition: glew.h:1832
int getTakeExpose() const
Definition: OP_NodeFlags.h:255
int getClearDependency() const
Definition: OP_NodeFlags.h:231
int getSoftLocked() const
Definition: OP_NodeFlags.h:215
void setHardLocked(int onOff)
Definition: OP_NodeFlags.h:135
bool getDescendantInterrupted() const
Definition: OP_NodeFlags.h:268
const GLdouble * v
Definition: glew.h:1391
void setUndoInput(int onOff)
Definition: OP_NodeFlags.h:85
void setXray(int onOff)
Definition: OP_NodeFlags.h:127
int getForceCook() const
Definition: OP_NodeFlags.h:187
IFDmantra you can see code vm_image_mplay_direction endcode When SOHO starts a render
Definition: HDK_Image.dox:266
int getUndoDelScript() const
Definition: OP_NodeFlags.h:167
int getAlwaysCook() const
Definition: OP_NodeFlags.h:183
int getUndoInput() const
Definition: OP_NodeFlags.h:163
int getFootprint() const
Definition: OP_NodeFlags.h:203
int getColorDefault() const
Definition: OP_NodeFlags.h:173
void setUndoDelScript(int onOff)
Definition: OP_NodeFlags.h:89
void setHighlight(int onOff)
Definition: OP_NodeFlags.h:121
int getSaveBypass() const
Definition: OP_NodeFlags.h:223
int getUndoLayout() const
Definition: OP_NodeFlags.h:165
void setExpose(int onOff)
Definition: OP_NodeFlags.h:143
void setClearDependency(int onOff)
Definition: OP_NodeFlags.h:158
int getTakeRender() const
Definition: OP_NodeFlags.h:251
GLclampf f
Definition: glew.h:3499
int getEditPicked() const
Definition: OP_NodeFlags.h:211
void setUndoComment(int onOff)
Definition: OP_NodeFlags.h:83
int getDisplayComment() const
Definition: OP_NodeFlags.h:179
int getTimeInterestCook() const
Definition: OP_NodeFlags.h:229
void setRecursion(bool val) const
Definition: OP_NodeFlags.h:78
int getOutputForView() const
Definition: OP_NodeFlags.h:233
void setUndoFlagChange(int onOff)
Definition: OP_NodeFlags.h:93
int getDisplay() const
Definition: OP_NodeFlags.h:195
void setExtra(const char *opts, int val, const char **labels)
Definition: OP_NodeFlags.h:280
const GLuint GLenum const void * binary
Definition: glew.h:3502
const char * getExtra() const
Definition: OP_NodeFlags.h:277
void setFootprint(int onOff)
Definition: OP_NodeFlags.h:125
void setLocked(int state)
Definition: OP_NodeFlags.h:139
int getTakeCurrent() const
Definition: OP_NodeFlags.h:261
void setDescendantInterrupted(bool f)
Definition: OP_NodeFlags.h:270
int getTakeTemplate() const
Definition: OP_NodeFlags.h:253
int getTimeDep() const
Definition: OP_NodeFlags.h:191
void setSoftLocked(int onOff)
Definition: OP_NodeFlags.h:137
int getLocked() const
Definition: OP_NodeFlags.h:217
int getTakeBypass() const
Definition: OP_NodeFlags.h:257
void setColorDefault(int onOff)
Definition: OP_NodeFlags.h:95
int getTimeInterest() const
Definition: OP_NodeFlags.h:227
int getBypass() const
Definition: OP_NodeFlags.h:207
int getExpose() const
Definition: OP_NodeFlags.h:221
void setDisplayComment(int onOff)
Definition: OP_NodeFlags.h:101
GLsizei const GLchar *const * path
Definition: glew.h:6461
void setEditPicked(int onOff)
Definition: OP_NodeFlags.h:133
void setModified(int onOff)
Definition: OP_NodeFlags.h:141
Create an evaluation context scope with a new node.
Definition: OP_Director.h:60
bool getRecursion() const
Definition: OP_NodeFlags.h:80
int getUnload() const
Definition: OP_NodeFlags.h:185
#define OP_API
Definition: OP_API.h:10
void setUnload(int onOff)
Definition: OP_NodeFlags.h:107
int getUndoComment() const
Definition: OP_NodeFlags.h:161
int getCooking() const
Definition: OP_NodeFlags.h:193
void setInterrupted(bool f)
Definition: OP_NodeFlags.h:266
void setHasTakeData(int onoff)
Definition: OP_NodeFlags.h:244
void setOutputForView(int output)
Definition: OP_NodeFlags.h:149
void setTemplate(int onOff)
Definition: OP_NodeFlags.h:123
bool getInterrupted() const
Definition: OP_NodeFlags.h:264
int getHighlight() const
Definition: OP_NodeFlags.h:199
int getTemplate() const
Definition: OP_NodeFlags.h:201
void setCooking(int onOff)
Definition: OP_NodeFlags.h:115
int getTakeDisplay() const
Definition: OP_NodeFlags.h:249
void setPicked(int onOff)
Definition: OP_NodeFlags.h:131
int getXray() const
Definition: OP_NodeFlags.h:205
void setTimeDep(int onOff)
Definition: OP_NodeFlags.h:113
void setTimeInterest(int onOff)
Definition: OP_NodeFlags.h:154
GLsizei const GLfloat * value
Definition: glew.h:1849
void setAlwaysCook(int onOff)
Definition: OP_NodeFlags.h:105
void setUndoPreTransform(int onOff)
Definition: OP_NodeFlags.h:91
int getSaveData() const
Definition: OP_NodeFlags.h:225
void setDisplayDescriptiveName(int onOff)
Definition: OP_NodeFlags.h:99
void setDisplay(int onOff)
Definition: OP_NodeFlags.h:117
void setTimeInterestCook(int onOff)
Definition: OP_NodeFlags.h:156
void setSaveData(int onOff)
Definition: OP_NodeFlags.h:147
int getModified() const
Definition: OP_NodeFlags.h:219