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