HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
COP2_Node.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: COP2_Node.h
7  *
8  * COMMENTS:
9  * 2nd Generation Composite operator base class
10  */
11 
12 #ifndef __COP2_Node_h__
13 #define __COP2_Node_h__
14 
15 #include "COP2_API.h"
16 
17 #include <COP/COP_Node_Common.h>
18 
19 #include <UT/UT_ErrorManager.h>
20 #include <UT/UT_SymbolTable.h>
21 #include <UT/UT_FloatArray.h>
22 #include <UT/UT_IntArray.h>
23 #include <UT/UT_ValArray.h>
24 #include <UT/UT_Array.h>
25 #include <UT/UT_Lock.h>
26 #include <UT/UT_Rect.h>
27 #include <UT/UT_TokenString.h>
28 #include <UT/UT_Thread.h>
29 #include <UT/UT_UniquePtr.h>
30 #include <UT/UT_FilterType.h>
31 #include <UT/UT_VectorTypes.h>
32 
33 #include <OP/OP_Network.h>
34 #include <OP/OP_OperatorPair.h>
35 
36 #include <TIL/TIL_Defines.h>
37 #include <TIL/TIL_Sequence.h>
38 #include <TIL/TIL_Region.h>
39 #include <TIL/TIL_TileList.h>
40 
41 #include "COP2_Common.h"
42 #include "COP2_Context.h"
43 #include "COP2_BoundsCache.h"
44 
45 class UT_Color;
46 class UT_FileLUT;
47 class UT_Interrupt;
48 class UT_StringArray;
49 class UT_StringHolder;
50 class IMG_TileOptions;
51 class TIL_ImageSource;
52 class TIL_Raster;
53 class TIL_TileCache;
54 class TIL_Plane;
55 class TIL_ProxyManager;
56 class TIL_Region;
57 class TIL_Tile;
58 class TIL_TileList;
59 class TIL_TileManager;
60 class TIL_TileMPlay;
61 class PXL_Lookup;
62 class OP_OperatorTable;
63 class COP2_PixelFunction;
67 class COP2_CheckpointWrapper;
68 class COP2_CookAreaInfo;
69 class COP2_CookAreaList;
70 class COP2_VolatileParmManager;
72 
74  TIL_Region *, COP2_Node *);
75 
77 {
78 public:
79  static const OP_OpTypeId OPTYPE_ID = COP2_OPTYPE_ID;
80 
81  // Lets the COP know that we are accessing, and again when we're done.
82  virtual OP_ERROR open(short &key, int clear_errors = 0) override;
83  bool isOpen() const { return myCop2OpenCount > 0; }
84  virtual void close(short key) override;
85 
86  OP_Node* getOp() override
87  {
88  return this;
89  }
90 
92  {
93  return mySequence;
94  }
95 
96  float getPercentageComplete(int num_extra_tiles_cooked) const override;
97 
98  int getNumThreadsToUse() const override;
99 
100  void raiseImageTooLargeError() override;
101 
102  // gets sequence information for this COP: start/end, res, rate.
103  TIL_Sequence * getSequenceInfo(OP_ERROR *error = 0);
104 
105  // gets the sequence info for an input to this COP.
106  const TIL_Sequence *inputInfo(int input);
107 
108  // gets the sequence time for the current time.
109  float getSequenceTime() const;
110 
111  // gets the image source for the viewer.
112  TIL_ImageSource *getImageSource() { return myImageSource; }
113 
114  void forceRecook(bool evensmartcache = false) override;
115 
116  // Used for collecting cook timing statistics all nodes in one cook.
117  // You maintain ownership of the table.
118  static void setNodeTimingTable(COP2_DebugTimingTable *table);
119 
120  // Sets the LUT (globally) that will be used for previewing nodes in
121  // the network editor
122  static void setPreviewLUT(
123  const UT_StringHolder &display,
124  const UT_StringHolder &view);
125  static void setPreviewLUT(
126  const UT_StringHolder &lut_name);
127 
128  static const PXL_Lookup *getPreviewLUT();
129  static const UT_StringHolder &getPreviewLUTName();
130 
131  // cooks this COP and produces an output raster, stored in 'raster'.
132  // the second method cooks a sub-region of the image; if subregion
133  // is 1, the raster contains the full image and only the sub-region
134  // is updated. If 0, the raster will only contain the sub-region.
135  // returns 1 on success or 0 if an error occurred.
137  const TIL_Plane *plane,
138  int array_index = 0,
139  int subregion = 1, int clear = 1,
140  float black = 0.0F, float white = 1.0F,
141  int compindex = -1,
142  int ignore_bwpoints=0,
143  const int *comp_map=0,
144  float gamma = 1.0F,
145  bool interactive = false,
146  const UT_StringHolder &ocio_ospace = UT_StringHolder(),
147  const UT_StringHolder &ocio_look = UT_StringHolder(),
148  const UT_StringHolder &ocio_display = UT_StringHolder(),
149  const UT_StringHolder &ocio_view = UT_StringHolder());
150 
151  int cookToRaster(TIL_Raster *raster, OP_Context &,
152  const TIL_Plane *plane,
153  int array_index,
154  int xstart,int ystart,int xend,int yend,
155  int subregion = 1, int clear = 1,
156  float black = 0.0F, float white = 1.0F,
157  int compindex = -1,
158  int ignore_bwpoints=0,
159  const int *comp_map=0,
160  float gamma = 1.0F,
161  bool interactive = false,
162  UT_ValArray<TIL_Raster *> *tiles = 0,
163  int tile_index = 0, TIL_TileMPlay * =0,
164  bool cleanup_after = true,
165  const UT_StringHolder &ocio_ospace = UT_StringHolder(),
166  const UT_StringHolder &ocio_look = UT_StringHolder(),
167  const UT_StringHolder &ocio_display = UT_StringHolder(),
168  const UT_StringHolder &ocio_view = UT_StringHolder());
169 
170  // This method cooks multiple output rasters at a time. The arrays must all
171  // be the same size (except in the case of flipbooking to TIL_TileMplay,
172  // where rasters may be empty). Currently, rendering to different
173  // OP_Context resolutions is not supported; only to different
174  // context.myTime's.
176  UT_ValArray<OP_Context *> &contexts,
178  UT_IntArray &array_index,
179  UT_ValArray<const int *> &comp_map,
181  int subregion = 1, int clear = 1,
182  float black = 0.0F, float white = 1.0F,
183  int compindex = -1,
184  int ignore_bwpoints=0,
185  float gamma = 1.0F,
186  bool interactive = false,
187  UT_ValArray<TIL_Raster *> *tiles = 0,
188  int tile_index = 0, TIL_TileMPlay * =0,
189  bool cleanup_after = true,
190  const UT_StringHolder &ocio_ospace = UT_StringHolder(),
191  const UT_StringHolder &ocio_look = UT_StringHolder(),
192  const UT_StringHolder &ocio_display = UT_StringHolder(),
193  const UT_StringHolder &ocio_view = UT_StringHolder()) override;
194 
195  // This method sets data in "plane_parms" corresponding to the other
196  // parameters that are passed in. The plane cooking parms are passed
197  // to the different threads that perform the cooking.
198  void computePlaneCookParms(COP2_PlaneCookParms &plane_parms,
199  OP_Context &context,
200  const TIL_Plane *rplane,
201  int array_index,
202  TIL_Raster *raster,
203  int thread_index,
204  const int *compmap,
205  int xstart, int ystart,
206  int xend, int yend,
207  bool flipbook,
208  UT_ValArray<TIL_Tile *> *tile_list);
209 
210  // Is the specified plane in the tile cache?
211  bool isPlaneCached(const TIL_Plane &refplane,
212  int array_index, float time,
213  int xres, int yres,
214  int xstart, int ystart, int xend, int yend,
215  bool flipbook);
216  bool isPlaneCached(COP2_Context &context,
217  const TIL_Plane &refplane,
218  int xstart, int ystart, int xend, int yend,
219  bool flipbook);
220 
221  // Move tiles for a particular plane from the regular cache into the
222  // list of checkpointed tiles. This method is called from the cook
223  // scheduler.
224  void checkpointCachedTilesForPlane(
225  const TIL_Plane &refplane,
226  int array_index, float time,
227  int xres, int yres,
228  int xstart, int ystart, int xend, int yend,
229  bool flipbook,
230  UT_ValArray<TIL_Tile *> &tile_list);
231  void checkpointCachedTilesForPlane(COP2_Context &context,
232  const TIL_Plane &refplane,
233  int xstart, int ystart, int xend, int yend,
234  bool flipbook,
235  UT_ValArray<TIL_Tile *> &tile_list);
236 
237  // This method maps from playbar time to the time in the sequence when the
238  // node will actually be cooked. File COPs, for example, always cook at
239  // time 0 if their sequence is a single image.
240  double mapTimeIntoSequence(double time);
241 
242  void waitForLastFile() override;
243 
244  // returns the identifier for a specific image at this node, described by
245  // context.xres/yres/time, plane and array_index. You must free
246  // the token string when you're done with it.
247  virtual UT_TokenString *getImageIdentifier(const TIL_Plane *plane,
248  int array_index, float t,
249  int xres, int yres,
250  int thread);
251 
252  // getContextData returns an existing context data or allocates a new
253  // context if it's not found. Contexts only exist for a single cook, and
254  // are deleted once close() is called.
255  COP2_Context *getContextData(const TIL_Plane *plane,
256  int array_index,
257  float t,
258  int xres,
259  int yres,
260  int thread,
261  bool force_bounds = true);
262 
263  // Determines the bounds of the operation. Normally (0,0) - (xres-1,yres-1)
264  void getImageBounds(const TIL_Plane *plane, int array,
265  float t, int xres, int yres, int thread,
266  int &x1, int &y1,int &x2, int &y2) override;
267  inline void getImageBounds(COP2_Context &context,
268  int &x1, int &y1,int &x2, int &y2);
269 
270  // Gets the bounds of input 'input'. Returns false if the input does not
271  // exist.
272  inline bool getInputBounds(int input, COP2_Context &context,
273  int &x1, int &y1, int &x2, int &y2);
274 
275  // General version of above.
276  bool getInputBounds(int input,
277  const TIL_Plane *plane, int array,
278  float t, int xres, int yres,
279  int thread,
280  int &x1, int &y1, int &x2, int &y2);
281 
282  // returns true if the tile at (tilex,tiley) pixel coords is aligned &
283  // the same size as the corresponding tile in the input. This can only
284  // be called once this nodes bounds have been determined (ie, don't call
285  // from computeImageBounds). with_node is optional; it uses a different
286  // node instead of 'this' ('with_node' and its input 'input').
287  bool isTileAlignedWithInput(int input,
288  COP2_Context &context,
289  int tilex, int tiley,
290  COP2_Node *with_node = 0);
291  bool isTileAlignedWithInput(int input,
292  const TIL_Plane *plane,
293  int array_index,
294  float t, int xres, int yres,
295  int thread,
296  int tilex, int tiley,
297  COP2_Node *with_node=0);
298 
299  // The following method is called when you wish to compare the alignment
300  // with the input at a different time.
301  bool isTileAlignedWithInputAtTime(int input,
302  COP2_Context &context,
303  int tilex, int tiley,
304  float input_time,
305  COP2_Node *with_node=0);
306 
307  // The following function is very similar to isTileAlignedWithInput,
308  // except it compares the tile in the specified input plane with that
309  // specified in this node's context. In particular, this is used when
310  // we cannot assume that this node actually contains the input plane.
311  bool isInputTileAlignedWithContext(int input,
312  const TIL_Plane *plane,
313  int tilex, int tiley,
314  COP2_Context &context,
315  COP2_Node *with_node=0);
316 
317  bool arePlanesAligned(COP2_Context &context,
318  const TIL_Plane *plane1, int aindex1,
319  const TIL_Plane *plane2, int aindex2,
320  int tilex, int tiley);
321 
322 
323  bool isInputPlaneCompatible(COP2_Context &context,
324  int input_num);
325 
326  // Returns the difference in origin of the this bound with its input.
327  bool getInputBoundsDiff(int input, COP2_Context &context,
328  int &dx, int &dy);
329 
330 
331  // Allows input COPs to remap the time into their time space.
332  fpreal getTimeTransform(int input, fpreal t) override;
333 
334  // Set the resolution in the input context to the input's resolution.
335  void getInputRes(int input, fpreal t,
336  const OP_Context &context,
337  OP_Context &icontext) override;
338 
339  // allows generators to remap their cook time.
340  virtual double remapTime(double t);
341  virtual bool isTimeModifier() const { return false; }
342 
343  // return true if this is a slow operation that may need interactive
344  // quality reduction help.
345  virtual bool isSlowOperation() const { return true; }
346  virtual bool isTimeDepOperation() { return false; }
347  virtual bool isGPUAssisted(const TIL_Plane & /*plane*/,
348  int /*array_index*/, float /*t*/,
349  int /*xres*/, int /*yres*/,
350  int /*thread_index*/)
351  { return false; }
352 
353  virtual bool isGenerator() const { return false; }
354  virtual bool isPixelBased() const { return false; }
355 
356  virtual int getMaskInput() const { return -1; }
357 
358  // these functions return a scale factor for biasing U and V lengths for
359  // things like blur kernels and transforms based on the proxy level,
360  // pixel aspect ratio and interlacing.
361  void getScaleFactors(int xres, int yres,
362  float &sx, float &sy) const;
363  float getXScaleFactor(int xres) const;
364  float getYScaleFactor(int yres) const;
365 
366  // returns a plane which determines what should be displayed in the icon
367  // preview (RGB, alpha, depth, etc).
368  TIL_Plane *getPreviewPlane(int &index);
369  int getPreviewPlane(int &pindex, int &aindex);
370  int isFollowingParent(const COP2_Node *parent);
371  void setPreviewPlane(int pindex, int aindex =0);
372  void parentPreviewChanged();
373 
374  // return one of the follwing if your COP cannot be cooked multithreaded.
375  // COP2_MULTITHREADED allows multiple threads in the COP at once.
376  // COP2_SINGLE_THREAD allows only one thread in the COP at once, but
377  // releases the lock when the COP cooks its inputs.
378  // COP2_EXCLUSIVE_THREAD locks the COP until its cleanup function is called.
379  // This mode pretty much kills multithreaded performance. Use with
380  // care! (useful for debugging code).
381  virtual int isSingleThreadedCop() const {return COP2_MULTITHREADED;}
382 
383  // clears out the cache for this node.
384  void clearTilesInCache();
385 
386  // returns true if the frame in question exists. Only really overridden
387  // by the file COP. Set adjust to be true if you can use another frame
388  // in its place (like using the closest frame instead)
389  virtual bool doesFrameExist(int /*frame*/,
390  bool /*adjust*/ =true) { return true; }
391 
392  // frame locking
393 
394  // returns 1 if any plane at any time is locked.
395  int isAnythingLocked() const;
396 
397  // returns 1 if the plane is ever locked.
398  int isPlaneLocked(const TIL_Plane *p) const;
399 
400  // returns 1 if the COP is locked at time t
401  int isSequenceLocked(float t);
402 
403  // returns 1 if the plane is locked at time t
404  int isPlaneLocked(const TIL_Plane *p, float t);
405 
406  // both methods return 1 if the op was successful.
407  int lockPlane(const TIL_Plane *p, float t);
408  int lockPlanes(float t);
409  int unlockPlane(const TIL_Plane *p, float t);
410  int unlockPlanes(float t);
411  int unlockAll();
412 
413  // Disk Caching for this node
414  void enableDiskCache(bool enable);
415  bool isDiskCacheEnabled() const { return myProxyEnable; }
416 
417  // Color selections.
418  virtual void setColorSelection(float *col, int size, bool accum);
419 
420  // Callback from the cache manager to remove tiles from a COP's list
421  // when the tile is thrown out of the cache.
422  static void tileRemovalCallback(void *parent, TIL_Tile *removed);
423  void tileRemoved(TIL_Tile *removed);
424 
425  static void setViewerCallback(void (*viewer)(COP2_Node *, void *,
426  TIL_ViewerType ),
427  void *data);
428 
429  // interactive render commands.
430  static void setCookPosition(float u, float v);
431 
432  static bool isCooking();
433 
434  bool isInterrupted(int threadidx) override;
435  void setInterrupted(int threadidx) override;
436 
437  static TIL_TileCache *getCache();
438  static TIL_ProxyManager *getProxyManager();
439  static TIL_TileManager *getTileManager();
440  static bool isInitialized();
441 
443  { return error(); }
444 
445  OP_ERROR error() override
446  {
447  // Call OP_Network::getErrorSeverity() directly
448  // here to avoid locking.
450  OP_ERROR csev = myCookErrorManager.getSeverity();
451 
452  return sev > csev ? sev : csev;
453  }
454  OP_ERROR error(OP_Context &context) override
455  {
456  // Call OP_Network::getErrorSeverity() directly
457  // here to avoid locking.
459  OP_ERROR csev = myCookErrorManager.getSeverity();
460 
461  return sev > csev ? sev : csev;
462  }
463 
464  // need to add a few things to the parm hash code.
466  int group_mask = 1) override;
467 
468 
469  // Collapsable Color & transform functions.
470  virtual void getPixelFunction(const TIL_Plane *plane,
471  int array_index, float t,
472  int xres, int yres,
473  int thread,
474  COP2_PixelFunction *&function,
475  bool concatenate,
476  bool dependent_too);
477 
478  virtual void getImageTransform(COP2_Context &context,
480  COP2_Node *& source,
481  int &input_index);
482 
483  // returns the color of pixel (x,y) for the given plane in color.
484  // 'color' should be big enough to hold the single pixels' values (use
485  // 4 floats if in doubt). If it could not be evaluated, false is returned.
486  // NB: This cooks the COP for the given pixel.
487  //
488  bool getPixelValue(const TIL_Plane *plane,
489  int array_index, float t,
490  int xres, int yres,
491  int x, int y,
492  float *color);
493 
494  bool getPixelValueByUV(const char *plane_name,
495  double u, double v,
496  bool interpolate,
497  UT_FloatArray &vals);
498 
499  bool getPixelColorValueByUV(COP2_ColorComponent comp,
500  double u, double v,
501  bool interpolate,
502  float &val);
503 
504  COP2_ThreadPref getThreadPref() const { return myThreadPreference; }
505 
506  // by default, most nodes can have as many threads as possible in their
507  // cook method. But some COPs can block with more than 1 thread, so this
508  // method gives a hint to the engine as to how many threads to allow at
509  // once in the cook - set 'plane' to the # of threads that can be cooking
510  // a given plane/time in a node; set 'node' to the # of threads that can be
511  // cooking in the node, regardless of plane/time; set 'op' to the # of
512  // threads that can be in a single Operator type at a time.
514  int &plane,
515  int &node,
516  int &op) const
517  { plane = node = op = TIL_MAX_THREADS; }
518 
519  // if true, only thread 0 can cook this operator.
520  virtual bool onlyCookInMainThread() const { return false; }
521 
522  // Returns the thread index based on the calling thread id
523  // (setWorkingThreadId must have been called first).
524  int getThreadIndex();
525 
526  // Menu building methods.
527  static void buildPlanePreviewMenu(
528  void *, PRM_Name *, int,
529  const PRM_SpareData *, const PRM_Parm *);
530  static void buildScopeMenu(
531  void *, PRM_Name *, int,
532  const PRM_SpareData *, const PRM_Parm *);
533  static void buildPlaneScopeMenu(
534  void *, PRM_Name *, int,
535  const PRM_SpareData *, const PRM_Parm *);
536  static void buildScopeMenuNoColAlpha(
537  void *, PRM_Name *, int,
538  const PRM_SpareData *, const PRM_Parm *);
539  static void buildPlaneMenu(
540  void *, PRM_Name *, int,
541  const PRM_SpareData *, const PRM_Parm *);
542  static void buildCompMenu(
543  void *, PRM_Name *, int,
544  const PRM_SpareData *, const PRM_Parm *);
545  static void buildInputScopeMenu(
546  void *, PRM_Name *, int,
547  const PRM_SpareData *, const PRM_Parm *);
548  static void buildInputPlaneMenu(
549  void *, PRM_Name *, int,
550  const PRM_SpareData *, const PRM_Parm *);
551  static void buildInputCompMenu(
552  void *, PRM_Name *, int,
553  const PRM_SpareData *, const PRM_Parm *);
554 
555  void buildPlaneMenu(PRM_Name *items, int maxsize,
556  bool useinput = false,
557  bool planes_only = false,
558  bool comps_only = false,
559  bool wild = true,
560  int input = 0,
561  bool nocoloralpha = false);
562 
563  static const char *getAlphaPlaneName();
564  static const char *getMaskPlaneName();
565  static const char *getDepthPlaneName();
566  static const char *getLumPlaneName();
567  static const char *getBumpPlaneName();
568  static const char *getPointPlaneName();
569  static const char *getNormalPlaneName();
570  static const char *getVelocityPlaneName();
571  static const char *getThumbnailPlaneKey();
572 
573  // Override to specify a plane to view in the COP viewer. No preference
574  // by default.
575  virtual bool preferredViewPlane(UT_WorkBuffer &) { return false; }
576 
577  // DEBUG stuff:
578  static int dumpCache(void *me, int i, float t,
579  const PRM_Template *);
580  static void printMe(void *me, std::ostream &os);
581 
582  static void addToFileLoadTime(float t);
583 
584  // Normal Public OP Stuff ************************************************
585  static const char *theChildTableName;
586  const char *getChildType() const override
587  { return COP2_OPTYPE_NAME; }
588  const char *getOpType() const override
589  { return COP2_OPTYPE_NAME; }
590 
591  OP_OpTypeId getChildTypeID() const override
592  { return COP2_OPTYPE_ID; }
593  OP_OpTypeId getOpTypeID() const override
594  { return COP2_OPTYPE_ID; }
595 
596  int64 getMemoryUsage(bool inclusive) const override
597  {
598  int64 mem = inclusive ? sizeof(*this) : 0;
599  mem += OP_Network::getMemoryUsage(false);
600  // FIXME: Count the actual memory here!!!
601  return mem;
602  }
603 
605  { return OP_RASTER_DATA; }
606  void *getCookedData(const OP_Context &) override { return 0; }
607 
608  void opChanged(OP_EventType type, void *data) override;
609  void userDataChanged(const UT_StringHolder &key) override;
610 
611  static void initializeExpressions();
612  static void initializeCache();
613  static void buildOperatorTable(OP_OperatorTable &table);
614  static void installCommands();
615 
618  static PRM_Template myTemplateList[];
619  static CH_LocalVariable myVariableList[];
620 
621  void getNodeSpecificInfoText(OP_Context &context,
622  OP_NodeInfoParms &iparms) override;
624  const OP_NodeInfoTreeParms &parms) override;
625 
626  void inputRes(int input, float t, int xres, int yres,
627  int &i_xres, int &i_yres);
628 
629  // This is the function called by multiple threads to cook the tiles
630  // of a node.
631  void processTile(COP2_ThreadCookParms *p);
632 
633  void setInputBlocked(bool blocked, int thread);
634 
635  // Remove all the regions for this node. This method is called when
636  // a node is uncheckpointed.
637  void removeRegions();
638 
639  // Allows you to define which inputs (or nodes) are opened and closed
640  // by this node.
641  virtual int getNumInputsToOpen() const { return nInputs(); }
642  virtual COP2_Node *getInputToOpen(int i)
643  { return CAST_COP2NODE(getInput(i, true)); }
644 
645  // For the output area (an area of a plane belonging to this node)
646  // and a set of input areas, determine which input areas and which
647  // parts of these areas are needed to cook the output area.
648  virtual void getInputDependenciesForOutputArea(
649  COP2_CookAreaInfo &output_area,
650  const COP2_CookAreaList &input_areas,
651  COP2_CookAreaList &needed_areas);
652 
653  // A checkpoint wrapper is a data structure that's internal to the
654  // cook scheduler. However, it's convenient to have a fast mapping
655  // from a node to a wrapper, the the node stores a pointer to the wrapper.
656  COP2_CheckpointWrapper *getCheckpointWrapper(int array_index);
657  void setCheckpointWrapper(int array_index,
658  COP2_CheckpointWrapper *wrap);
659 
660  // these are basically private for the cook scheduler ----- vvvvvv
661  // COP2_CheckpointWrapper is not a public class.
662  int getNumCheckpointWrappers() const;
663  COP2_CheckpointWrapper *getWrapper(int i) const;
664  void resetCheckpointWrappers();
665  // --------------------------------------------------------- ^^^^^^
666 
667  virtual void modifyViewMatrix(int input,
668  COP2_Context &context,
669  UT_Matrix4 &matrix,
670  float zoom);
671 
672  virtual COP2_Node *selectInput(int px, int py, const char *plane_name,
673  int array_index);
674  /// @{
675  /// Methods defined on OP_Node
676  //Absolute Width
677  fpreal getW() const override;
678  //Absolute Height
679  fpreal getH() const override;
680  /// @}
681 
682  // call to reset any missing or bad frames.
683  static void resetBadMissingFrames();
684 
685  // Global preferences controlled by the pref dialog.
686  static bool getShowPreviewPref();
687  static void setShowPreviewPref(bool show);
688 
689  unsigned referenceAllParameters(OP_Parameters *from,
690  bool relative_references = true) override;
691 
692 protected:
693  COP2_Node(OP_Network *net, const char *name, OP_Operator *entry);
694  ~COP2_Node() override;
695 
696  OP_ERROR cookMe(OP_Context &) override { return UT_ERROR_NONE; }
697  bool cook(OP_Context &) override;
698  OP_ERROR bypassMe(OP_Context &, int &) override
699  { return UT_ERROR_NONE; }
700 
701  static unsigned int getCookScore(float cooktime);
702 
703  // Set this appropriately if $W, $H should use the full resolution,
704  // and not the proxy resolution. By default, we use the proxy
705  // resolution, but if the node itself performs the correction, we
706  // want to use the full resolution.
707  void setVariableUseFullRes(bool onoff);
708 
709  bool evalVariableValue(fpreal &val, int index,
710  int thread) override;
712  int thr) override
713  { return OP_Network::evalVariableValue(v, i, thr); }
714 
716  UT_StringArray &reflist,
717  UT_StringArray *nodelist =0,
718  bool collapse = false,
719  bool check_missing = false,
720  bool show_missing_only=false) override;
721 
722  void launchViewer(TIL_ViewerType view);
723 
724  // call these methods when an error occurs during cookSequenceInfo().
725  void addError(int code, const char *msg = 0);
726  void addSystemError(const char *msg = 0);
727  void addWarning(int code, const char *msg = 0);
728  void addSystemWarning(const char *msg = 0);
729  void addMessage(int code, const char *msg = 0);
730 
731  // Call these methods when an error occurs during cooking.
732  void addCookError(int code, const char *msg = 0);
733  void addCookSystemError(const char *msg = 0);
734  void addCookWarning(int code, const char *msg = 0);
735  void addCookSystemWarning(int code, const char *msg = 0);
736  void addCookMessage(int code, const char *msg = 0);
737 
739 
740  // normally, an image cooked at 100x100 will look similar to the same image
741  // cooked at 200x200. If your node does NOT scale with resolution, return 1
742  virtual int isScaledImageDifferent() const { return 0; }
743 
744  // inputOpenFailed is called if the node fails to open.
745  virtual void inputOpenFailed(int ) { }
746 
747 
749  { return COP2_THREAD_NO_PREF; }
750 
751  // returns a short phrase describing the operation.
752  virtual const char *getOperationInfo();
753 
754  // cooks the information for the sequence.
755  virtual TIL_Sequence * cookSequenceInfo(OP_ERROR &error) = 0;
756 
757  bool isInputBlocked(int thread);
758 
759  // gets a specific tile of an input.
760  TIL_TileList *inputTile(int input_index,
761  COP2_Context &context,
762  const TIL_Plane *plane,
763  int array_index,
764  float t,
765  int xstart,
766  int ystart,
767  OP_ERROR *err = 0,
768  int block = 1,
769  bool *mask = 0,
770  COP2_Node *fromtile = 0,
771  bool correctorig = true,
772  bool *blocked = 0,
773  bool *was_corrected = 0);
774 
775  // gets a tile out of the plane specified by the context.
776  inline TIL_TileList *inputTile(int input_index,
777  COP2_Context &context,
778  int xstart,
779  int ystart,
780  OP_ERROR *err = 0,
781  int block = 1,
782  bool *mask = 0,
783  bool *blocked = 0,
784  bool *was_corrected = 0);
785 
786  // gets a specific tile of an input that corresponds to this tile.
787  inline TIL_TileList *inputTile(int input,
788  COP2_Context &context,
789  TIL_TileList *mytile,
790  float t,
791  OP_ERROR *err = 0,
792  int block = 1,
793  bool *mask = 0,
794  bool *blocked = 0,
795  bool *was_corrected = 0);
796 
797  // gets a specific tile specified by the tilelist and the context.
798  inline TIL_TileList *inputTile(int input,
799  COP2_Context &context,
800  TIL_TileList *mytile,
801  OP_ERROR *err = 0,
802  int block = 1,
803  bool *mask = 0,
804  bool *blocked = 0,
805  bool *was_corrected = 0);
806 
807  // copies the input tile specified in tilelist.
808  bool copyInput(int input,
809  COP2_Context &context,
810  TIL_TileList *tilelist,
811  float t,
812  OP_ERROR *err = 0,
813  int block = 1,
814  bool *mask = 0);
815 
816  bool copyInput(int input,
817  COP2_Context &context,
818  TIL_TileList *mytile,
819  OP_ERROR *err = 0,
820  int block = 1,
821  bool *mask = 0);
822 
823  // this is a modified version of inputTile() which should be called from
824  // passThroughTiles() only, instead of inputTile().
825  TIL_TileList *passInputTile(int input_index,
826  COP2_Context &context,
827  const TIL_Plane *plane,
828  int array_index,
829  float t,
830  int xstart,
831  int ystart,
832  int block,
833  bool *blocked,
834  bool *mask,
835  COP2_Node *fromTile = 0);
836 
837  // must be used to release a tile returned by inputTile when you are
838  // finished working with it. 'reset' removes the tiles from the cache.
839  void releaseTile(TIL_TileList *&, bool reset = false);
840 
841  // gets a region of an input channel, cooking tiles where necessary.
842  // region_data holds a list of num_region regions, which are allocated
843  // by the caller. returns 0 if errors were encountered.
844  TIL_Region * inputRegion(int input_index,
845  COP2_Context &context,
846  const TIL_Plane *plane,
847  int array_index,
848  float t,
849  int xstart,
850  int ystart,
851  int xend,
852  int yend,
854  int share = 1,
855  void *regionmem[PLANE_MAX_VECTOR_SIZE]=0,
856  bool correct_aspect = true,
857  bool correct_bounds = true,
858  int scan_alignment = 0);
859 
860  // gets a region out of an input. Plane & array index are specified in the
861  // context.
862  inline TIL_Region * inputRegion(int input_index,
863  COP2_Context &context,
864  int xstart,
865  int ystart,
866  int xend,
867  int yend,
869  int share = 1,
870  void *regionmem[PLANE_MAX_VECTOR_SIZE]=0,
871  bool correct_aspect = true,
872  bool correct_bounds = true,
873  int scan_alignment = 0);
874 
875  // gets an input region corresponding to a tilelist, an optional shift and
876  // an option to write the region data directly into the tilelist data.
877  TIL_Region * inputRegion(int input_index,
878  COP2_Context &context,
879  const TIL_Plane *plane,
880  int array_index,
881  float t,
882  TIL_TileList *tilelist,
883  int xshift=0,
884  int yshift=0,
885  int copy = 0,
886  TIL_RegionExtend hold = TIL_BLACK);
887 
888 
889  // gets a region out of an input. Plane & array index are specified in the
890  // context, while the region is determined by the tile dimensions.
891  inline TIL_Region * inputRegion(int input_index,
892  COP2_Context &context,
893  TIL_TileList *tilelist,
894  int xshift=0,
895  int yshift=0,
896  int copy = 0,
897  TIL_RegionExtend hold = TIL_BLACK);
898 
899  // allocates a region for output (ie, files read in scanline by scanline
900  // require temporary storage before being divided into tiles for
901  // efficiency.
902  inline TIL_Region * outputRegion(const TIL_Plane *plane, int array_index,
903  float t, int xres, int yres, int thread,
904  int xstart, int ystart,
905  int xend, int yend,
906  int share = 1,
907  int rindex = 0,
908  int alignment = 0);
909 
910  TIL_Region * outputRegion(COP2_Context &context,
911  int xstart, int ystart,
912  int xend, int yend,
913  int share = 1,
914  int rindex = 0,
915  int alignment = 0);
916 
917  // The following version of outputRegion takes a reference plane to use
918  // to compute the bounds. This is useful, for example, when the region
919  // we wish to store only has one channel, but we wish the plane to have
920  // 3 channels in our sequence info.
921  TIL_Region * outputRegion(const TIL_Plane *plane,
922  const TIL_Plane *ref_plane,
923  int array_index, float t,
924  int xres, int yres, int thread,
925  int xstart, int ystart,
926  int xend, int yend,
927  int share = 1,
928  int rindex = 0,
929  int alignment = 0);
930 
931  ////////////////////////////////////////////////////////////////////////
932  // Simple Scale related functions
933  // Implemented in COP2_NodeScale.C
934 
935  // This method simply scales the input to the current resolution and
936  // copies it into the given tilelist.
937  void scaleInput(int input, COP2_Context &context,
938  const TIL_Plane *plane, int array_index,
939  float t, UT_FilterType xfilter,
940  UT_FilterType yfilter,
941  TIL_TileList *tilelist);
942 
943  // This utility method is used to scale the supplied image bounds by
944  // the specified factors.
945  static void scaleImageArea(float sx, float sy,
946  int ix1, int iy1, int ix2, int iy2,
947  int &x1, int &y1, int &x2, int &y2);
948 
949  ////////////////////////////////////////////////////////////////////////
950  // Transform Related Fucntions
951  // Implemented in COP2_NodeTransform.C
952 
953  // given an area, this grabs the transformed image data from the input.
954  TIL_Region * transformRegion(int input,
955  COP2_Context &context,
956  const TIL_Plane *plane,
957  int aindex,
958  float t,
959  int xres,
960  int yres,
961  int xstart,
962  int ystart,
963  int xend,
964  int yend,
965  const COP2_TransformParms &parms,
966  bool input_aspect_adjust = true,
967  bool streak_off_frame = false);
968 
969  // transforms the input area/plane given by the region.
970  // The region bounds should be in the input's canvas space, if they aren't,
971  // set bounds_in_canvas_space to false;
972  bool transformRegion(int input,
973  COP2_Context &context,
974  TIL_Region *region,
975  const COP2_TransformParms &parms,
976  bool input_aspect_adjust = true,
977  bool bounds_in_canvas_space = true,
978  bool streak_off_frame = false);
979 
980  bool isFullTransform(int input,
981  COP2_Context &context,
982  const COP2_TransformParms &cparms,
983  bool input_aspect_adjust=true,
984  COP2_Node **source_node=0,
985  int *source_index=0,
986  float *aspectx1=0,
987  float *aspectx2=0,
988  float *aspecty1=0,
989  float *aspecty2=0,
990  COP2_TransformParms *prepped_parms=0);
991 
992  TIL_Region * transformBlurRegion(int input,
993  COP2_Context &context,
994  const TIL_Plane *plane,
995  int aindex,
996  float t,
997  int xres,
998  int yres,
999  int xstart,
1000  int ystart,
1001  int xend,
1002  int yend,
1003  float amount,
1004  float bias,
1006  bool deformation = false);
1007 
1008  bool transformBlurRegion(int input,
1009  COP2_Context &context,
1010  TIL_Region *region,
1011  float amount,
1012  float bias,
1014  bool deformation = false,
1015  bool bounds_in_canvas_space = true);
1016 
1017  // Helper function for transformRegion. It is called when all the
1018  // transform has to do is translate the region.
1019  bool translateRegion(COP2_Context &context,
1020  COP2_Node &source_node,
1021  int source_input,
1022  TIL_Region *region, float tx, float ty,
1023  TIL_RegionExtend hold,
1024  bool bounds_in_canvas_space,
1025  bool streak_off_frame);
1026 
1027  // Helper function for transformRegion. It is called on to do a full
1028  // transform.
1029  bool fullTransformRegion(COP2_Context &context,
1030  COP2_Node &source_node,
1031  int source_input,
1032  TIL_Region *region,
1034  float haspect, float input_haspect,
1035  float vaspect, float input_vaspect,
1036  bool bounds_in_canvas_space);
1037 
1038  UT_Matrix4 getShiftedInverseTransformMatrix(COP2_Context &context,
1039  COP2_Node &source_node,
1040  int source_input,
1041  const TIL_Plane *iplane,
1042  int array_index,
1043  const COP2_TransformParms &parms,
1044  int &dx, int &dy);
1045 
1046  // Helper function for transformRegion and computeImageBounds. It is called
1047  // to prepare the transform parms for extraction. This method will do all
1048  // the collapsing of transforms as well. "source_node" will contain the
1049  // node whose input at "source_index" should be read for the data.
1050  // "source_node" will be initialized, but "source_index" needs to be the
1051  // index of the input for which we wish to prepare the parms (it may be
1052  // modified if transforms have collapsed).
1053  void prepareTransformParms(COP2_Context &context,
1055  COP2_Node *& source_node,
1056  int &source_index,
1057  bool input_aspect_adjust);
1058 
1059  // adjustPivotParms adjusts the pivot and translate parms in order to
1060  // account for aspect ratios (it is a helper function to
1061  // prepareTransformParms).
1062  void adjustPivotParms(int input_index,
1064  bool input_aspect_adjust);
1065 
1066  // Helper function for transformBlurRegion and computeImageBounds. It is
1067  // called to copy the set of transform parms and it prepares the new copies
1068  // for use.
1069  void copyAndPrepareTransformParms(
1071  &source_parms,
1073 
1074  //
1075  ////////////////////////////////////////////////////////////////////////
1076 
1077 
1078  void extractFromOutputRegion(TIL_TileList *tiles,
1079  TIL_Region *output);
1080 
1081  // like releaseTile for regions... call when you're finished with the
1082  // region.
1083  void releaseRegion(TIL_Region *, int output = 0);
1084 
1085  // gets tiles to process for this node. Normally, you just process the
1086  // nodes passed into cookMyTile(); however, if you need more to complete
1087  // the cook efficiently, request more using this function.
1088  // If block is 0, this function may return null. Only COP2_Node should
1089  // ever call this method with block set to 1.
1090  TIL_TileList *requestWorkingTiles(COP2_Context &context,
1091  const TIL_Plane *plane,
1092  int array_index,
1093  float t,
1094  int xstart, int ystart,
1095  int *cache_flag = 0,
1096  int ignore_bypass = 0,
1097  int block = 0);
1098 
1099  // once you're done processing the tiles requested with requestWorkingTiles
1100  // you must call this function. Do not call this function on the tilelist
1101  // passed in to cookMyTile().
1102  void releaseWorkingTiles(TIL_TileList *list);
1103 
1104  // Passes tiles from the input to the output.
1105  virtual void passThroughTiles(COP2_Context &context,
1106  const TIL_Plane *plane,
1107  int array_index,
1108  float t,
1109  int xstart, int ystart,
1110  TIL_TileList *&tile,
1111  int block = 1,
1112  bool *mask = 0,
1113  bool *blocked = 0);
1114 
1115  // return 1 if you want to pass a specific tile through; allows you to
1116  // scope regions of the data.
1117  virtual int passThrough(COP2_Context &context,
1118  const TIL_Plane *plane, int comp_index,
1119  int array_index, float t,
1120  int xstart, int ystart);
1121 
1122  TIL_TileList *getBlackTile(const TIL_Plane *plane, int aindex,
1123  float t, int xres, int yres, int thread,
1124  int xstart, int ystart, bool *mask =0);
1125 
1126  // Called to cook a single tile. Called for each tile in the image.
1127  virtual OP_ERROR cookMyTile(COP2_Context &context,
1128  TIL_TileList *tiles);
1129 
1130 
1131  OP_ERROR cookFullImage(COP2_Context &context,
1132  TIL_TileList *tiles,
1133  COP2_FullImageCB callback,
1134  UT_Lock &fullimagelock,
1135  bool use_float);
1136 
1137  inline void lockParms(bool lock);
1138 
1139  // Returns a new context. Overide to return your context derived from
1140  // COP2_ContextData and initialize it. This should only ever be called from
1141  // getContextData().
1142  virtual COP2_ContextData *newContextData(const TIL_Plane *plane,
1143  int array_index,
1144  float t,
1145  int xres,
1146  int yres,
1147  int thread,
1148  int max_threads);
1149 
1150  // retrieves only the context, without creating a context data.
1151  COP2_Context *getContext(const TIL_Plane *plane,
1152  int array_index,
1153  float t,
1154  int xres,
1155  int yres,
1156  int thread);
1157 
1158  // Copies the bounds of the input specified into the context. The pointers
1159  // are optional; they are assigned to the new bounds if non-null.
1160  bool copyInputBounds(int input, COP2_Context &context,
1161  int *x1 = 0, int *y1 = 0,
1162  int *x2 = 0, int *y2 = 0);
1163 
1164  // Override if your operation expands the op bounds. This method should set
1165  // the bounds in the context using setBounds()
1166  virtual void computeImageBounds(COP2_Context &context);
1167 
1168  // Scoping
1169  virtual bool isFrameScoped(int /*image_index*/) { return true; }
1170  // Override to return a scope string if the COP has a scope field. If there
1171  // is a valid scope, return 1, otherwise 0.
1172  virtual int scope(UT_String & /*scope*/) { return 0; }
1173  virtual int frameScope(UT_String & /*scope*/) { return 0; }
1174 
1175  OP_ERROR save(std::ostream &os, const OP_SaveFlags &flags,
1176  const char *pathPrefix,
1177  const UT_StringHolder &name_override = UT_StringHolder()
1178  ) override;
1179  OP_ERROR saveIntrinsic(std::ostream &os,
1180  const OP_SaveFlags &flags) override;
1181  bool load(UT_IStream &is, const char *extension,
1182  const char *path=0) override;
1183 
1184  // This function will convert a tile at index in the tilelist
1185  // to floating point or return the image data pointer if the tile
1186  // is already FP. This function returns true if it allocated memory that
1187  // you need to free (with delete [])
1188  bool getTileInFP(TIL_TileList *tilelist, float *&dest,
1189  int index, void *dtile =0);
1190 
1191  // This function will write a block of floating point data back to the
1192  // tile at index in the tilelist, converting it if necessary. It's
1193  // assumed that the FP source data is the proper size (tilelist->mySize).
1194  void writeFPtoTile(TIL_TileList *tilelist, float *&src,
1195  int index);
1196 
1197  void setCOPColoring(COP2_OpColorType type, bool enable);
1198 
1199  void getOvercookStats(int &redone, int &total);
1200  void clearOvercookStats();
1201 
1202  void ensureSequenceContainsColorAndAlpha();
1203 
1204  // This method is overridden by COP2_SubNet because its "input" is
1205  // special.
1206  virtual void cleanUpInputsRecursively();
1207 
1208 
1209  // This method returns the cook area info for a given context. Can
1210  // only be called during cookMyTile().
1211  const COP2_CookAreaInfo *getAreaInfo(COP2_Context &context) const;
1212 
1213  // This method makes the output area of the plane depend on all parts of
1214  // all input planes, regardless of the size of the output area.
1215  void makeOutputAreaDependOnAllInputAreas(
1216  COP2_CookAreaInfo &output_area,
1217  const COP2_CookAreaList &input_areas,
1218  COP2_CookAreaList &needed_areas);
1219 
1220  // This method makes the output area depended on all planes for a given
1221  // input.
1222  void makeOutputAreaDependOnInputAreas(int input,
1223  COP2_CookAreaInfo &output_area,
1224  const COP2_CookAreaList &input_areas,
1225  COP2_CookAreaList &needed_areas);
1226 
1227  // Selects a plane from the input to be dependent on. Returns the plane
1228  // added to the needed_areas list.
1229  COP2_CookAreaInfo *makeOutputAreaDependOnInputPlane(int input,
1230  const char *planename, int array_index, float t,
1231  const COP2_CookAreaList &input_areas,
1232  COP2_CookAreaList &needed_areas);
1233 
1234  // selects the corresponding plane from an input to be dependent on.
1235  // Returns the plane added to the needed_areas list.
1236  COP2_CookAreaInfo *makeOutputAreaDependOnMyPlane(int input,
1237  COP2_CookAreaInfo &output_area,
1238  const COP2_CookAreaList &input_areas,
1239  COP2_CookAreaList &needed_areas);
1240 
1241  // This method will try to collapse the transforms in the input areas,
1242  // setting the real input node in the needed areas. It will delete
1243  // the contents of uncollapsed_input_areas.
1244  void getInputAreasForCollapsedTransformInputs(
1245  COP2_Context &context,
1246  const COP2_TransformParms &transform_parms,
1247  COP2_CookAreaInfo &output_area,
1248  COP2_CookAreaList &uncollapsed_input_areas,
1249  COP2_CookAreaList &needed_areas,
1250  bool input_aspect_adjust,
1251  bool clear_uncollapse_list);
1252 
1253  // Override this method if the derived COP does not support partially
1254  // scoped planes and uses the default scope mechanism inside
1255  // COP2_PixelBase.
1256  virtual bool allowPartiallyScopedPlanes() const {return true;}
1257 
1258 
1259  void registerVolatileParm(const char *name,PRM_Callback c,
1260  bool ignore_missing = false);
1261 
1262  // the following set methods will follow channel references, if any
1263  // are present on the parm.
1264  void deAnimateFollowChanRef(const char *parmname,
1265  int vecidx );
1266 
1267  void getDependencyInfo(fpreal t, UT_WorkBuffer &text);
1268  void getDependencyInfoTree(fpreal t, UT_InfoTree &tree);
1269 
1270  void swapParm(const char *name1,const char *name2,
1271  int vsize);
1272  void swapStringParm(const char *name1,const char *name2,
1273  int vsize);
1274 public:
1275  // these are the 'manager' methods for setting up, cooking tiles and
1276  // cleaning up. The functions 'setupCook' and 'cookMyTile' are the ones
1277  // that should be overridden for normal operations. These methods do things
1278  // like lock inputs, make sure the cook is setup, etc.
1279  virtual OP_ERROR setup(float t, int xres, int yres, int max_threads,
1280  bool doinput = true);
1281  OP_ERROR cookTile(TIL_TileList *&, float t,
1282  int xres, int yres, int thread_index,
1283  int max_threads);
1284 
1285  // Clean up this node and its inputs. Cleaning up involves cleaning up
1286  // cook contexts and updating the performance monitor.
1287  void recursivelyCleanUp();
1288  void cleanUpCookContexts();
1289 
1290  // Clean up all the regions. This method is not called as part of the
1291  // normal cleanup.
1292  void cleanUpAllRegions() override;
1293 
1294  void bumpCookSerial() { myCookSerial++; }
1295  int getCookSerial() { return myCookSerial; }
1296 protected:
1299  unsigned char myCop2RecurseFlag :1,
1300  myFramesAllScopedFlag:1;
1304 
1305 private:
1306  UT_ValArray<COP2_Context *> myCookContexts;
1307  UT_ValArray<TIL_Region *> myNonSharedRegions;
1308 
1309  int myInitCook;
1310  int64 myTotalCookTime[TIL_MAX_THREADS];
1311  int64 myInputTileCookTime[TIL_MAX_THREADS];
1312  int64 myTotalTileCookTime[TIL_MAX_THREADS];
1313  unsigned char myCookStateFlags[TIL_MAX_THREADS];
1314  UT_IntArray myInputOpenKeys;
1315  int myCookDepth;
1316  int myCacheHits;
1317  int myCacheMisses;
1318  UT_ValArray<cop2LockInfo *> myLockedPlanes;
1319  int myPreviewPlaneIndex;
1320  int myPreviewPlaneArrayIndex;
1321  OP_ERROR myCookError;
1322  OP_ERROR myLastCop2CookError;
1323  OP_VERSION myCookSequenceVersion;
1324  float myLastErrorTime;
1325  bool myProxyEnable;
1326  bool myCop2DirtyFlag;
1327 
1328  // The following serial counter is included in the image identifier
1329  // string for this node. Forcing a recook will increment this counter,
1330  // thus preventing use of any cached tiles or images.
1331  int myCookSerial;
1332 
1333  // locks
1334  static TIL_FastLock theParmEvalLock;
1335  static TIL_FastLock theParmHashCodeLock;
1336  TIL_FastLock mySingleThreadedLock;
1337  TIL_FastLock mySetupFuncLock;
1338  TIL_FastLock myCookVarLock;
1339  TIL_FastLock myRegionLock;
1340  TIL_FastLock myErrorLock;
1341  TIL_FastLock myIntrLock;
1342  TIL_FastLock myInputBlockLock;
1343  TIL_FastLock myContextDataLock;
1344 
1345  // Viewer image source
1346  TIL_ImageSource *myImageSource;
1347 
1348  // Local variables
1349  int myVarResX[TIL_MAX_THREADS];
1350  int myVarResY[TIL_MAX_THREADS];
1351  int myVarImageIndex[TIL_MAX_THREADS];
1352  float myVarImageTime[TIL_MAX_THREADS];
1353  int myVarImageArray[TIL_MAX_THREADS];
1354  int myVarPlaneIndex[TIL_MAX_THREADS];
1355  int myVarPlaneChannels[TIL_MAX_THREADS];
1356 
1357  unsigned char myVarResUsed :1,
1358  myVarImageArrayUsed :1,
1359  myVarImagePlaneUsed :1,
1360  myVarUseFullRes :1,
1361  myCookOccurred :1;
1362  // Overcooking detection
1363  int myNumCookedTiles;
1364  int myDupCookedTiles;
1365 
1366  UT_Array<COP2_CheckpointWrapper *> myCheckpointWrapper;
1367 
1368  COP2_VolatileParmManager *myVolatileParms;
1369 
1370  // stuff for caching the image bounds.
1371  COP2_BoundsCache myBoundsCache;
1372  TIL_FastLock myBoundsLock;
1373 
1374  // This variable keeps track of the thread that opened the node.
1375  // If the node is not open, then it is set to UT_INVALID_THREAD_ID.
1376  ut_thread_id_t myOpenThreadId;
1377 
1378  // This variable locks the sections in the open() and close()
1379  // functions.
1380  UT_Lock myOpenLock;
1381 
1382  static bool theShowPreviewPref;
1383 
1384 private:
1385  // Sets node's opener thread id. Pass in UT_INVALID_THREAD_ID
1386  // to signal that the node is closed.
1387  void setOpenerThread(ut_thread_id_t thread_id)
1388  { myOpenThreadId = thread_id; }
1389 
1390  // Returns true if the current thread is the same thread that
1391  // opened the node. Returns false if the threads do not match or
1392  // if the node is closed.
1393  bool isOpenerThread() const
1394  { return myOpenThreadId
1395  == UT_Thread::getMyThreadId(); }
1396 
1397  virtual float copTimeTransform(int input, COP2_Context &context,
1398  float t);
1399 
1400  void setupVariables(const TIL_Plane *plane,
1401  int array,
1402  int xres,
1403  int yres,
1404  float t,
1405  int thread);
1406 
1407  // checks for parameter time dependency, and out-of-range keyframes.
1408  void checkTimeDepAndRange();
1409 
1410  // mostly used for debugging & correcting cache problems.
1411  void verifyCacheIntegrity() { }
1412 
1413  // Methods to fetch tiles from the cache or from an input.
1414  int getWorkingTiles(COP2_Context &context,
1415  const TIL_Plane *plane,
1416  int array_index,
1417  float t,
1418  int xstart,int ystart,
1419  TIL_TileList *tilelist,
1420  int ignore_bypass = 0,
1421  int block = 1,
1422  bool *mask = 0,
1423  double *passtime = 0);
1424 
1425  bool fillInteractiveTile(COP2_Context &context,
1426  const TIL_Plane *plane,
1427  int array_index, float t,
1428  int xstart,int ystart,
1429  TIL_Tile *tile, int cindex,
1430  int findex);
1431 
1432  // used only by inputTile, to resolve tile size/offset problems introduced
1433  // by the workspace & scoping channels.
1434  TIL_TileList * correctInputTile(int input_index,
1435  COP2_Context &context,
1436  const TIL_Plane *plane,
1437  int array_index,
1438  int xstart, int ystart,
1439  TIL_TileList *tilelist,
1440  int block, bool *blocked, bool *mask);
1441 
1442  void doneCookOnTiles(TIL_TileList *tiles, OP_ERROR errstate,
1443  int thread_index);
1444 
1445  // This function is used by processTile to send data to a tile devide.
1446  // This is nontrivial because the tile may extend outside the bounds
1447  // of the region of interest for the tile device.
1448  bool writeSafeDeepTile(COP2_ThreadCookParms *p,
1449  TIL_TileList *tilelist) const;
1450 
1451  // performance related functions
1452  void markTimerStart(int64 *now) const;
1453  void getElapsedTime(int64 *now) const;
1454  void appendCookTimesToPerformanceMonitor();
1455  void setCookDepth(int d);
1456 
1457  // Allocates or returns a pointer to a previously allocated region.
1458  TIL_Region * allocateRegion(const TIL_Plane *plane, int input_index,
1459  int array_index, float t,
1460  int xres, int yres,
1461  int x1, int y1, int x2, int y2,
1462  int bx1, int by1, int bx2, int by2,
1463  TIL_RegionExtend hold,
1464  int output, int share,
1465  int scan_alignment);
1466 
1467  // Preps a region for use; only called by allocateRegion & inputRegion.
1468  void openRegion(TIL_Region *region, void *regionmem[4],
1469  bool output);
1470 
1471  // called by the multiprocessor cooks as the 'thread method'.
1472  static void * threadCookTile(void *data);
1473 
1474  // These methods do the actual work of manipulating the rasters.
1475 
1476  // insert into full raster, possibly with a colour subrange.
1477  void insertIntoRaster(TIL_Raster *r, TIL_Tile *t,int tindex,
1478  float low=0.0F,float high=1.0F) const;
1479 
1480  // insert into subregion of a raster, possibly with a colour subrange.
1481  // (x1,y1) -> (x2,y2) defines the rectangular region to be updated.
1482  // (x,y)shift defines how the tile origins are translated to fit into the
1483  // region.
1484  void insertIntoRaster(TIL_Raster *r, TIL_Tile *t,int tindex,
1485  int x1, int y1, int x2, int y2,
1486  int xshift=0, int yshift=0,
1487  float low=0.0F,float high=1.0F,
1488  int greyscale = 0,
1489  int ignore_points =0,
1490  float gamma = 1.0F) const;
1491 
1492  void highlightTile(int thread, int onoff);
1493  void resetHighlight();
1494 
1495  // These methods compute a number of bounds related variables.
1496  void computeBoundsVariables(const OP_Context &context,
1497  const TIL_Plane *rplane,
1498  int array_index, TIL_Raster *raster,
1499  int thread_index,
1500  int orig_xstart, int orig_ystart,
1501  int orig_xend, int orig_yend,
1502  int &xstart, int &ystart, int &xend, int &yend,
1503  int &xtile1, int &ytile1,
1504  int &xtile2, int &ytile2,
1505  int &x1, int &y1, int &x2, int &y2,
1506  int &xshift, int &yshift,
1507  int &bounds_xstart, int &bounds_ystart,
1508  int &bounds_xend, int &bounds_yend,
1509  bool flipbook);
1510 
1511  void computeBoundsVariables(const TIL_Plane *rplane,
1512  float time, int xres, int yres,
1513  int array_index, TIL_Raster *raster,
1514  int thread_index,
1515  int orig_xstart, int orig_ystart,
1516  int orig_xend, int orig_yend,
1517  int &xstart, int &ystart, int &xend, int &yend,
1518  int &xtile1, int &ytile1, int &xtile2, int &ytile2,
1519  int &x1, int &y1, int &x2, int &y2,
1520  int &xshift, int &yshift,
1521  int &bounds_xstart, int &bounds_ystart,
1522  int &bounds_xend, int &bounds_yend,
1523  bool flipbook);
1524 
1525  // This convenience method returns the token string for the plane and
1526  // the tile indices for the area of interest. The area of interest
1527  // (xstart,ystart)-(xend,yend) is in frame space.
1528  UT_TokenString *getPlaneIdentifierAndTileBoundaries(
1529  COP2_Context &context,
1530  const TIL_Plane &refplane,
1531  int xstart, int ystart, int xend, int yend,
1532  int &xtile1, int &ytile1, int &xtile2, int &ytile2,
1533  bool flipbook);
1534 
1535  TIL_Region * getTransformRegionGPU(
1536  COP2_Node &source_node, int source_input,
1537  COP2_Context &context,
1538  const TIL_Plane *plane, int array_index,
1539  int x1, int y1, int x2, int y2,
1540  int input_origx, int input_origy,
1541  int input_xres, int input_yres,
1542  int filt_xoffset, int filt_yoffset,
1543  const COP2_TransformParms &parms,
1544  bool bounds_in_canvas_space,
1545  int &tx1, int &ty1, int &tx2, int &ty2,
1546  int preoffset[2], int postoffset[2]);
1547 
1548  bool fullTransformRegionCPU(COP2_Context &context,
1549  COP2_Node &source_node,
1550  int source_input,
1551  TIL_Region *region,
1552  const COP2_TransformParms &parms,
1553  int x1, int y1, int x2, int y2,
1554  int input_x1, int input_y1,
1555  int input_x2, int input_y2,
1556  int input_xres, int input_yres,
1557  int full_input_xres, int full_input_yres,
1558  int filt_xoffset, int filt_yoffset,
1559  float haspect, float input_haspect,
1560  float vaspect, float input_vaspect,
1561  bool bounds_in_canvas_space,
1562  const UT_Matrix4 &xform);
1563 
1564  bool fullTransformRegionGPU(COP2_Context &context,
1565  COP2_Node &source_node,
1566  int source_input,
1567  TIL_Region *region,
1568  const COP2_TransformParms &parms,
1569  int x1, int y1, int x2, int y2,
1570  int input_x1, int input_y1,
1571  int node_x1, int node_y1,
1572  int node_x2, int node_y2,
1573  int input_xres, int input_yres,
1574  int full_input_xres, int full_input_yres,
1575  int filt_xoffset, int filt_yoffset,
1576  float haspect, float input_haspect,
1577  float vaspect, float input_vaspect,
1578  bool bounds_in_canvas_space,
1579  const UT_Matrix4 &xform);
1580 
1581  bool transformBlurRegionCPU(int input,
1582  COP2_Context &context,
1583  TIL_Region *region,
1585  bool deformation,
1586  float prev, float next, int numtimes,
1587  float itime[3], float ifact[3],
1588  bool bounds_in_canvas_space,
1589  int filt_xoffset, int filt_yoffset,
1590  int input_origx, int input_origy,
1591  int ixres, int iyres,
1592  int x1, int y1, int x2, int y2,
1593  float startt, float endt, float incr,
1594  float bfact);
1595 
1596  bool transformBlurRegionGPU(int input,
1597  COP2_Context &context,
1598  TIL_Region *region,
1600  int deformation,
1601  float prev, float next, int numtimes,
1602  float itime[3], float ifact[3],
1603  bool bounds_in_canvas_space,
1604  int filt_xoffset, int filt_yoffset,
1605  int input_origx, int input_origy,
1606  int ixres, int iyres,
1607  int x1, int y1, int x2, int y2,
1608  float startt, float endt, float incr,
1609  float bfact);
1610 
1611  // These virtuals are methods that nobody should override...
1612  //
1613  // I/O methods
1614  //
1615  bool loadPacket(UT_IStream &is, short class_id, short sig,
1616  const char *path=0) override;
1617  bool loadPacket(UT_IStream &is, const char *token,
1618  const char *path=0) override;
1619 
1620  void deleteCookedData() override {}
1621  int saveCookedData(const char *, OP_Context &) override;
1622  int saveCookedData(std::ostream &, OP_Context &,
1623  int = 0) override
1624  { return 0; }
1625  const char *getFileExtension(int binary) const override
1626  { return binary ? "bcop2" : "cop2"; }
1627 
1628  static void installExpressions();
1629 
1630  friend class COP2_CookScheduler;
1631  friend class COP2_VexVariableMap;
1632  friend class COP2_PixelOp;
1633  friend class COP2_VexOp;
1634  friend class COP2_MaskOp;
1635 };
1636 
1637 inline TIL_TileList *
1638 COP2_Node::inputTile(int input_index, COP2_Context &context,
1639  int xstart, int ystart, OP_ERROR *err, int block,
1640  bool *mask, bool *blocked, bool *was_corrected)
1641 {
1642  return inputTile(input_index, context,
1643  context.myPlane, context.myArrayIndex,
1644  context.myTime, xstart, ystart, err, block, mask, 0,
1645  true, blocked, was_corrected);
1646 }
1647 
1648 
1649 inline TIL_TileList *
1650 COP2_Node::inputTile(int input_index, COP2_Context &context,
1651  TIL_TileList *tiles, OP_ERROR *err, int block,
1652  bool *mask, bool *blocked, bool *was_corrected)
1653 {
1654  return inputTile(input_index, context,
1655  context.myPlane, context.myArrayIndex,
1656  context.myTime,
1657  tiles->myX1,
1658  tiles->myY1,
1659  err, block, mask, 0, true, blocked, was_corrected);
1660 }
1661 
1662 inline TIL_TileList *
1664  TIL_TileList *tilelist, float t,
1665  OP_ERROR *err,int block, bool *mask, bool *blocked,
1666  bool *was_corrected)
1667 {
1668  return inputTile(index, context, tilelist->myPlane, tilelist->myArrayIndex,
1669  t, tilelist->myX1, tilelist->myY1, err, block, mask,
1670  0, true, blocked, was_corrected);
1671 }
1672 
1673 inline TIL_Region *
1674 COP2_Node::inputRegion(int input_index,
1675  COP2_Context &context,
1676  TIL_TileList *tilelist,
1677  int xshift,int yshift, int copy, TIL_RegionExtend hold)
1678 {
1679  return inputRegion(input_index, context,
1680  context.myPlane, context.myArrayIndex,
1681  context.myTime, tilelist, xshift, yshift, copy, hold);
1682 }
1683 
1684 inline TIL_Region *
1685 COP2_Node::inputRegion(int input_index, COP2_Context &context,
1686  int xstart, int ystart, int xend, int yend,
1687  TIL_RegionExtend hold, int share,
1688  void *regionmem[PLANE_MAX_VECTOR_SIZE],
1689  bool correct_aspect, bool correct_bounds,
1690  int scan_alignment)
1691 {
1692  return inputRegion(input_index, context,
1693  context.myPlane, context.myArrayIndex,
1694  context.myTime, xstart, ystart, xend, yend,
1695  hold, share, regionmem, correct_aspect,
1696  correct_bounds, scan_alignment);
1697 }
1698 
1699 inline TIL_Region *
1700 COP2_Node::outputRegion(const TIL_Plane *plane, int array_index, float seqt,
1701  int xres, int yres, int thread,
1702  int xstart, int ystart, int xend, int yend, int share,
1703  int rindex, int alignment)
1704 {
1705  return outputRegion(plane, plane, array_index, seqt, xres, yres, thread,
1706  xstart, ystart, xend, yend, share, rindex,alignment);
1707 }
1708 
1709 inline void
1711 {
1712  if(lock)
1713  TIL_LOCK(theParmEvalLock);
1714  else
1715  TIL_UNLOCK(theParmEvalLock);
1716 }
1717 
1718 inline bool
1720  int &x1, int &y1, int &x2, int &y2)
1721 {
1722  return getInputBounds(input, context.myPlane, context.myArrayIndex,
1723  context.myTime, context.myXres, context.myYres,
1724  context.myThreadIndex, x1,y1, x2,y2);
1725 }
1726 
1727 inline void
1729  int &x1,int &y1, int &x2,int &y2)
1730 {
1731  getImageBounds(context.myPlane, context.myArrayIndex, context.myTime,
1732  context.myXres, context.myYres, context.myThreadIndex,
1733  x1,y1, x2,y2);
1734 }
1735 
1736 // Some common defines.
1737 extern "C" {
1739 };
1740 
1741 #endif
virtual int saveCookedData(std::ostream &os, OP_Context &, int binary=0)=0
SYS_VISIBILITY_EXPORT void newCop2Operator(OP_OperatorTable *table)
UT_ErrorSeverity OP_ERROR
Definition: OP_Error.h:6
short * getInput(int size) override
#define COP2_OPTYPE_NAME
Definition: OP_Node.h:311
GLbitfield flags
Definition: glcorearb.h:1596
void getImageBounds(const TIL_Plane *plane, int array, float t, int xres, int yres, int thread, int &x1, int &y1, int &x2, int &y2) override
fpreal getH() const override
Node position/scale is used by the UI.
#define TIL_UNLOCK(loc)
Definition: TIL_Defines.h:264
virtual bool isSlowOperation() const
Definition: COP2_Node.h:345
fpreal getW() const override
Node position/scale is used by the UI.
int getThreadIndex() const
virtual bool isInterrupted(int thread)=0
virtual bool loadPacket(UT_IStream &is, short class_id, short sig, const char *path=nullptr)
uint64 OP_VERSION
Definition: OP_Version.h:6
#define COP2_MULTITHREADED
Definition: COP2_Common.h:214
unsigned referenceAllParameters(OP_Parameters *from, bool relative_references=true) override
TIL_ImageSource * getImageSource()
Definition: COP2_Node.h:112
TIL_Sequence mySequence
Definition: COP2_Node.h:1297
#define SYS_VISIBILITY_EXPORT
virtual bool isPixelBased() const
Definition: COP2_Node.h:354
virtual void setInterrupted(int)=0
GT_API const UT_StringHolder time
OP_ERROR error() override
Definition: COP2_Node.h:445
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
virtual int isScaledImageDifferent() const
Definition: COP2_Node.h:742
const GLdouble * v
Definition: glcorearb.h:837
OP_OpTypeId getChildTypeID() const override
Definition: COP2_Node.h:591
void bumpCookSerial()
Definition: COP2_Node.h:1294
virtual bool doesFrameExist(int, bool=true)
Definition: COP2_Node.h:389
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
#define TIL_LOCK(loc)
Definition: TIL_Defines.h:263
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
void lockParms(bool lock)
Definition: COP2_Node.h:1710
int myInterruptFlags
Definition: COP2_Node.h:1301
virtual bool preferredViewPlane(UT_WorkBuffer &)
Definition: COP2_Node.h:575
TIL_RegionExtend
Definition: TIL_Region.h:26
virtual void forceRecook(bool evensmartcache=true)
int myCop2OpenCount
Definition: COP2_Node.h:1298
COP2_ThreadPref getThreadPref() const
Definition: COP2_Node.h:504
TIL_Sequence & getSequence() override
Definition: COP2_Node.h:91
UT_ErrorSeverity
Definition: UT_Error.h:25
OP_ERROR getErrorSeverity() override
Definition: COP2_Node.h:442
Parameters for OP_Node::getInfoText()/OP_Node::getNodeSpecificInfoText()
TIL_Region * outputRegion(const TIL_Plane *plane, int array_index, float t, int xres, int yres, int thread, int xstart, int ystart, int xend, int yend, int share=1, int rindex=0, int alignment=0)
Definition: COP2_Node.h:1700
GLint y
Definition: glcorearb.h:103
const char * getOpType() const override
Definition: COP2_Node.h:588
int64 getMemoryUsage(bool inclusive) const override
Definition: COP2_Node.h:596
UT_ErrorManager myCookErrorManager
Definition: COP2_Node.h:738
virtual void getNodeSpecificInfoText(OP_Context &context, OP_NodeInfoParms &parms)
OP_ERROR bypassMe(OP_Context &, int &) override
Definition: COP2_Node.h:698
UT_FilterType
Definition: UT_FilterType.h:16
static OP_VariablePair myVariablePair
Definition: COP2_Node.h:617
static const char * theChildTableName
Definition: COP2_Node.h:585
virtual int getNumInputsToOpen() const
Definition: COP2_Node.h:641
GLdouble GLdouble x2
Definition: glad.h:2349
const TIL_Plane * myPlane
Definition: TIL_TileList.h:61
COP2_ThreadPref
Definition: COP2_Common.h:249
bool evalVariableValue(UT_String &v, int i, int thr) override
Definition: COP2_Node.h:711
< returns > If no error
Definition: snippets.dox:2
virtual unsigned nInputs() const
virtual bool isTimeDepOperation()
Definition: COP2_Node.h:346
void opChanged(OP_EventType reason, void *data=nullptr) override
virtual bool allowPartiallyScopedPlanes() const
Definition: COP2_Node.h:1256
virtual float getPercentageComplete(int num_extra_tiles_cooked) const =0
short myArrayIndex
Definition: TIL_TileList.h:64
OP_ERROR cookMe(OP_Context &) override
Definition: COP2_Node.h:696
OP_ERROR(* COP2_FullImageCB)(COP2_Context &, const TIL_Region *, TIL_Region *, COP2_Node *)
Definition: COP2_Node.h:73
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
virtual bool isGenerator() const
Definition: COP2_Node.h:353
virtual void getMyExternalReferences(UT_StringArray &reflist, UT_StringArray *nodelist=nullptr, bool collapse=false, bool check_missing=false, bool show_missing_only=false)
virtual int scope(UT_String &)
Definition: COP2_Node.h:1172
virtual void cleanUpAllRegions()=0
GLboolean reset
Definition: glad.h:5138
virtual void raiseImageTooLargeError()=0
virtual COP2_ThreadPref getThreadPreference() const
Definition: COP2_Node.h:748
virtual int getNumThreadsToUse() const =0
int64 getMemoryUsage(bool inclusive) const override
virtual OP_ERROR saveIntrinsic(std::ostream &os, const OP_SaveFlags &flags)
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
GLdouble y1
Definition: glad.h:2349
virtual void getMaxNumThreadsInCook(COP2_Context &, int &plane, int &node, int &op) const
Definition: COP2_Node.h:513
GLint GLuint mask
Definition: glcorearb.h:124
OP_OpTypeId getOpTypeID() const override
Definition: COP2_Node.h:593
#define PLANE_MAX_VECTOR_SIZE
Definition: TIL_Defines.h:166
virtual bool cook(OP_Context &context)
virtual void userDataChanged(const UT_StringHolder &key)
HUSD_API const char * raster()
long long int64
Definition: SYS_Types.h:116
virtual void getImageBounds(const TIL_Plane *plane, int array, float t, int xres, int yres, int thread, int &x1, int &y1, int &x2, int &y2)=0
OP_OpTypeId
Definition: OP_OpTypeId.h:18
bool isOpen() const
Definition: COP2_Node.h:83
GLuint const GLchar * name
Definition: glcorearb.h:786
virtual int cookToRaster(UT_ValArray< TIL_Raster * > &rasters, UT_ValArray< OP_Context * > &contexts, UT_ValArray< const TIL_Plane * > &planes, UT_IntArray &array_index, UT_ValArray< const int * > &comp_map, UT_Array< UT_InclusiveRect > &bounds, int subregion=1, int clear=1, float black=0.0F, float white=1.0F, int compindex=-1, int ignore_bwpoints=0, float gamma=1.0F, bool interactive=false, UT_ValArray< TIL_Raster * > *tiles=0, int tile_index=0, TIL_TileMPlay *=0, bool cleanup_after=true, const UT_StringHolder &ocio_ospace=UT_StringHolder(), const UT_StringHolder &ocio_look=UT_StringHolder(), const UT_StringHolder &ocio_display=UT_StringHolder(), const UT_StringHolder &ocio_view=UT_StringHolder())=0
GLint GLenum GLint x
Definition: glcorearb.h:409
virtual bool isTimeModifier() const
Definition: COP2_Node.h:341
int getCookSerial()
Definition: COP2_Node.h:1295
bool getInputBounds(int input, COP2_Context &context, int &x1, int &y1, int &x2, int &y2)
Definition: COP2_Node.h:1719
GLenum GLenum GLsizei void * table
Definition: glad.h:5129
int myInputBlockFlags
Definition: COP2_Node.h:1302
GLdouble t
Definition: glad.h:2397
TIL_ViewerType
Definition: TIL_Defines.h:138
IFDmantra py
Definition: HDK_Image.dox:266
virtual void getInputRes(int input, fpreal t, const OP_Context &context, OP_Context &input_context)
GLsizeiptr size
Definition: glcorearb.h:664
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
OP_ERROR error(OP_Context &context) override
Definition: COP2_Node.h:454
virtual const char * getFileExtension(int binary) const =0
GA_API const UT_StringHolder parms
TIL_Region * inputRegion(int input_index, COP2_Context &context, const TIL_Plane *plane, int array_index, float t, int xstart, int ystart, int xend, int yend, TIL_RegionExtend hold=TIL_BLACK, int share=1, void *regionmem[PLANE_MAX_VECTOR_SIZE]=0, bool correct_aspect=true, bool correct_bounds=true, int scan_alignment=0)
virtual bool onlyCookInMainThread() const
Definition: COP2_Node.h:520
Parameters for OP_Node::fillInfoTree()/OP_Node::fillInfoTreeNodeSpecific()
virtual void fillInfoTreeNodeSpecific(UT_InfoTree &tree, const OP_NodeInfoTreeParms &parms)
#define COP2_API
Definition: COP2_API.h:10
virtual OP_ERROR save(std::ostream &os, const OP_SaveFlags &flags, const char *path_prefix="", const UT_StringHolder &name_override=UT_StringHolder())
virtual int isSingleThreadedCop() const
Definition: COP2_Node.h:381
GLuint color
Definition: glcorearb.h:1261
OP_DataType getCookedDataType() const override
Definition: COP2_Node.h:604
fpreal64 fpreal
Definition: SYS_Types.h:278
OP_ERROR getErrorSeverity() override
virtual fpreal getTimeTransform(int input, fpreal t)
GLuint index
Definition: glcorearb.h:786
GLuint GLfloat * val
Definition: glcorearb.h:1608
static ut_thread_id_t getMyThreadId()
OP_EventType
Definition: OP_Value.h:22
A global error manager scope.
OP_DataType
Definition: OP_DataTypes.h:189
static OP_TemplatePair myTemplatePair
Definition: COP2_Node.h:616
virtual bool evalVariableValue(UT_String &val, int index, int thread)
#define TIL_MAX_THREADS
Definition: TIL_Defines.h:37
virtual void waitForLastFile()=0
virtual bool isFrameScoped(int)
Definition: COP2_Node.h:1169
virtual bool isGPUAssisted(const TIL_Plane &, int, float, int, int, int)
Definition: COP2_Node.h:347
virtual int frameScope(UT_String &)
Definition: COP2_Node.h:1173
const TIL_Plane * myPlane
Definition: COP2_Context.h:74
virtual COP2_Node * getInputToOpen(int i)
Definition: COP2_Node.h:642
GLboolean r
Definition: glcorearb.h:1222
bool load(UT_IStream &is, const char *ext="", const char *path=nullptr) override
GLdouble GLdouble GLdouble y2
Definition: glad.h:2349
COP2_ThreadPref myThreadPreference
Definition: COP2_Node.h:1303
**Note that the tasks the thread_id
Definition: thread.h:646
virtual void inputOpenFailed(int)
Definition: COP2_Node.h:745
virtual int getMaskInput() const
Definition: COP2_Node.h:356
OP_Node * getOp() override
Definition: COP2_Node.h:86
virtual UT_TokenString & getParmHashCode(OP_Context &context, int group_mask=1)
virtual OP_ERROR open(short &key, int clear_errors=0)=0
OIIO_UTIL_API std::string extension(string_view filepath, bool include_dot=true) noexcept
TIL_TileList * inputTile(int input_index, COP2_Context &context, const TIL_Plane *plane, int array_index, float t, int xstart, int ystart, OP_ERROR *err=0, int block=1, bool *mask=0, COP2_Node *fromtile=0, bool correctorig=true, bool *blocked=0, bool *was_corrected=0)
COP2_ColorComponent
Definition: COP2_Common.h:256
virtual void close(short key)=0
const char * getChildType() const override
Definition: COP2_Node.h:586
Definition: format.h:1821
bool isCooking(bool include_ancestors) const
void * getCookedData(const OP_Context &) override
Definition: COP2_Node.h:606
virtual void deleteCookedData()=0
COP2_OpColorType
Definition: COP2_Common.h:242
GLenum src
Definition: glcorearb.h:1793
bool isDiskCacheEnabled() const
Definition: COP2_Node.h:415