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,
479  COP2_TransformParms &parms,
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  // Query color for Net Overview rendering
609  int getNetOverviewColor( UT_Color &color ) override;
610  void opChanged(OP_EventType type, void *data) override;
611  void userDataChanged(const UT_StringHolder &key) override;
612 
613  static void initializeExpressions();
614  static void initializeCache();
615  static void buildOperatorTable(OP_OperatorTable &table);
616  static void installCommands();
617 
620  static PRM_Template myTemplateList[];
621  static CH_LocalVariable myVariableList[];
622 
623  void getNodeSpecificInfoText(OP_Context &context,
624  OP_NodeInfoParms &iparms) override;
626  const OP_NodeInfoTreeParms &parms) override;
627 
628  void inputRes(int input, float t, int xres, int yres,
629  int &i_xres, int &i_yres);
630 
631  // This is the function called by multiple threads to cook the tiles
632  // of a node.
633  void processTile(COP2_ThreadCookParms *p);
634 
635  void setInputBlocked(bool blocked, int thread);
636 
637  // Remove all the regions for this node. This method is called when
638  // a node is uncheckpointed.
639  void removeRegions();
640 
641  // Allows you to define which inputs (or nodes) are opened and closed
642  // by this node.
643  virtual int getNumInputsToOpen() const { return nInputs(); }
644  virtual COP2_Node *getInputToOpen(int i)
645  { return CAST_COP2NODE(getInput(i, true)); }
646 
647  // For the output area (an area of a plane belonging to this node)
648  // and a set of input areas, determine which input areas and which
649  // parts of these areas are needed to cook the output area.
650  virtual void getInputDependenciesForOutputArea(
651  COP2_CookAreaInfo &output_area,
652  const COP2_CookAreaList &input_areas,
653  COP2_CookAreaList &needed_areas);
654 
655  // A checkpoint wrapper is a data structure that's internal to the
656  // cook scheduler. However, it's convenient to have a fast mapping
657  // from a node to a wrapper, the the node stores a pointer to the wrapper.
658  COP2_CheckpointWrapper *getCheckpointWrapper(int array_index);
659  void setCheckpointWrapper(int array_index,
660  COP2_CheckpointWrapper *wrap);
661 
662  // these are basically private for the cook scheduler ----- vvvvvv
663  // COP2_CheckpointWrapper is not a public class.
664  int getNumCheckpointWrappers() const;
665  COP2_CheckpointWrapper *getWrapper(int i) const;
666  void resetCheckpointWrappers();
667  // --------------------------------------------------------- ^^^^^^
668 
669  virtual void modifyViewMatrix(int input,
670  COP2_Context &context,
671  UT_Matrix4 &matrix,
672  float zoom);
673 
674  virtual COP2_Node *selectInput(int px, int py, const char *plane_name,
675  int array_index);
676  /// @{
677  /// Methods defined on OP_Node
678  //Absolute Width
679  fpreal getW() const override;
680  //Absolute Height
681  fpreal getH() const override;
682  /// @}
683 
684  // call to reset any missing or bad frames.
685  static void resetBadMissingFrames();
686 
687  // Global preferences controlled by the pref dialog.
688  static bool getShowPreviewPref();
689  static void setShowPreviewPref(bool show);
690 
691  unsigned referenceAllParameters(OP_Parameters *from,
692  bool relative_references = true) override;
693 
694 protected:
695  COP2_Node(OP_Network *net, const char *name, OP_Operator *entry);
696  ~COP2_Node() override;
697 
698  OP_ERROR cookMe(OP_Context &) override { return UT_ERROR_NONE; }
699  bool cook(OP_Context &) override;
700  OP_ERROR bypassMe(OP_Context &, int &) override
701  { return UT_ERROR_NONE; }
702 
703  static unsigned int getCookScore(float cooktime);
704 
705  // Set this appropriately if $W, $H should use the full resolution,
706  // and not the proxy resolution. By default, we use the proxy
707  // resolution, but if the node itself performs the correction, we
708  // want to use the full resolution.
709  void setVariableUseFullRes(bool onoff);
710 
711  bool evalVariableValue(fpreal &val, int index,
712  int thread) override;
714  int thr) override
715  { return OP_Network::evalVariableValue(v, i, thr); }
716 
718  UT_StringArray &reflist,
719  UT_StringArray *nodelist =0,
720  bool collapse = false,
721  bool check_missing = false,
722  bool show_missing_only=false) override;
723 
724  void launchViewer(TIL_ViewerType view);
725 
726  // call these methods when an error occurs during cookSequenceInfo().
727  void addError(int code, const char *msg = 0);
728  void addSystemError(const char *msg = 0);
729  void addWarning(int code, const char *msg = 0);
730  void addSystemWarning(const char *msg = 0);
731  void addMessage(int code, const char *msg = 0);
732 
733  // Call these methods when an error occurs during cooking.
734  void addCookError(int code, const char *msg = 0);
735  void addCookSystemError(const char *msg = 0);
736  void addCookWarning(int code, const char *msg = 0);
737  void addCookSystemWarning(int code, const char *msg = 0);
738  void addCookMessage(int code, const char *msg = 0);
739 
741 
742  // normally, an image cooked at 100x100 will look similar to the same image
743  // cooked at 200x200. If your node does NOT scale with resolution, return 1
744  virtual int isScaledImageDifferent() const { return 0; }
745 
746  // inputOpenFailed is called if the node fails to open.
747  virtual void inputOpenFailed(int ) { }
748 
749 
751  { return COP2_THREAD_NO_PREF; }
752 
753  // returns a short phrase describing the operation.
754  virtual const char *getOperationInfo();
755 
756  // cooks the information for the sequence.
757  virtual TIL_Sequence * cookSequenceInfo(OP_ERROR &error) = 0;
758 
759  bool isInputBlocked(int thread);
760 
761  // gets a specific tile of an input.
762  TIL_TileList *inputTile(int input_index,
763  COP2_Context &context,
764  const TIL_Plane *plane,
765  int array_index,
766  float t,
767  int xstart,
768  int ystart,
769  OP_ERROR *err = 0,
770  int block = 1,
771  bool *mask = 0,
772  COP2_Node *fromtile = 0,
773  bool correctorig = true,
774  bool *blocked = 0,
775  bool *was_corrected = 0);
776 
777  // gets a tile out of the plane specified by the context.
778  inline TIL_TileList *inputTile(int input_index,
779  COP2_Context &context,
780  int xstart,
781  int ystart,
782  OP_ERROR *err = 0,
783  int block = 1,
784  bool *mask = 0,
785  bool *blocked = 0,
786  bool *was_corrected = 0);
787 
788  // gets a specific tile of an input that corresponds to this tile.
789  inline TIL_TileList *inputTile(int input,
790  COP2_Context &context,
791  TIL_TileList *mytile,
792  float t,
793  OP_ERROR *err = 0,
794  int block = 1,
795  bool *mask = 0,
796  bool *blocked = 0,
797  bool *was_corrected = 0);
798 
799  // gets a specific tile specified by the tilelist and the context.
800  inline TIL_TileList *inputTile(int input,
801  COP2_Context &context,
802  TIL_TileList *mytile,
803  OP_ERROR *err = 0,
804  int block = 1,
805  bool *mask = 0,
806  bool *blocked = 0,
807  bool *was_corrected = 0);
808 
809  // copies the input tile specified in tilelist.
810  bool copyInput(int input,
811  COP2_Context &context,
812  TIL_TileList *tilelist,
813  float t,
814  OP_ERROR *err = 0,
815  int block = 1,
816  bool *mask = 0);
817 
818  bool copyInput(int input,
819  COP2_Context &context,
820  TIL_TileList *mytile,
821  OP_ERROR *err = 0,
822  int block = 1,
823  bool *mask = 0);
824 
825  // this is a modified version of inputTile() which should be called from
826  // passThroughTiles() only, instead of inputTile().
827  TIL_TileList *passInputTile(int input_index,
828  COP2_Context &context,
829  const TIL_Plane *plane,
830  int array_index,
831  float t,
832  int xstart,
833  int ystart,
834  int block,
835  bool *blocked,
836  bool *mask,
837  COP2_Node *fromTile = 0);
838 
839  // must be used to release a tile returned by inputTile when you are
840  // finished working with it. 'reset' removes the tiles from the cache.
841  void releaseTile(TIL_TileList *&, bool reset = false);
842 
843  // gets a region of an input channel, cooking tiles where necessary.
844  // region_data holds a list of num_region regions, which are allocated
845  // by the caller. returns 0 if errors were encountered.
846  TIL_Region * inputRegion(int input_index,
847  COP2_Context &context,
848  const TIL_Plane *plane,
849  int array_index,
850  float t,
851  int xstart,
852  int ystart,
853  int xend,
854  int yend,
856  int share = 1,
857  void *regionmem[PLANE_MAX_VECTOR_SIZE]=0,
858  bool correct_aspect = true,
859  bool correct_bounds = true,
860  int scan_alignment = 0);
861 
862  // gets a region out of an input. Plane & array index are specified in the
863  // context.
864  inline TIL_Region * inputRegion(int input_index,
865  COP2_Context &context,
866  int xstart,
867  int ystart,
868  int xend,
869  int yend,
871  int share = 1,
872  void *regionmem[PLANE_MAX_VECTOR_SIZE]=0,
873  bool correct_aspect = true,
874  bool correct_bounds = true,
875  int scan_alignment = 0);
876 
877  // gets an input region corresponding to a tilelist, an optional shift and
878  // an option to write the region data directly into the tilelist data.
879  TIL_Region * inputRegion(int input_index,
880  COP2_Context &context,
881  const TIL_Plane *plane,
882  int array_index,
883  float t,
884  TIL_TileList *tilelist,
885  int xshift=0,
886  int yshift=0,
887  int copy = 0,
888  TIL_RegionExtend hold = TIL_BLACK);
889 
890 
891  // gets a region out of an input. Plane & array index are specified in the
892  // context, while the region is determined by the tile dimensions.
893  inline TIL_Region * inputRegion(int input_index,
894  COP2_Context &context,
895  TIL_TileList *tilelist,
896  int xshift=0,
897  int yshift=0,
898  int copy = 0,
899  TIL_RegionExtend hold = TIL_BLACK);
900 
901  // allocates a region for output (ie, files read in scanline by scanline
902  // require temporary storage before being divided into tiles for
903  // efficiency.
904  inline TIL_Region * outputRegion(const TIL_Plane *plane, int array_index,
905  float t, int xres, int yres, int thread,
906  int xstart, int ystart,
907  int xend, int yend,
908  int share = 1,
909  int rindex = 0,
910  int alignment = 0);
911 
912  TIL_Region * outputRegion(COP2_Context &context,
913  int xstart, int ystart,
914  int xend, int yend,
915  int share = 1,
916  int rindex = 0,
917  int alignment = 0);
918 
919  // The following version of outputRegion takes a reference plane to use
920  // to compute the bounds. This is useful, for example, when the region
921  // we wish to store only has one channel, but we wish the plane to have
922  // 3 channels in our sequence info.
923  TIL_Region * outputRegion(const TIL_Plane *plane,
924  const TIL_Plane *ref_plane,
925  int array_index, float t,
926  int xres, int yres, int thread,
927  int xstart, int ystart,
928  int xend, int yend,
929  int share = 1,
930  int rindex = 0,
931  int alignment = 0);
932 
933  ////////////////////////////////////////////////////////////////////////
934  // Simple Scale related functions
935  // Implemented in COP2_NodeScale.C
936 
937  // This method simply scales the input to the current resolution and
938  // copies it into the given tilelist.
939  void scaleInput(int input, COP2_Context &context,
940  const TIL_Plane *plane, int array_index,
941  float t, UT_FilterType xfilter,
942  UT_FilterType yfilter,
943  TIL_TileList *tilelist);
944 
945  // This utility method is used to scale the supplied image bounds by
946  // the specified factors.
947  static void scaleImageArea(float sx, float sy,
948  int ix1, int iy1, int ix2, int iy2,
949  int &x1, int &y1, int &x2, int &y2);
950 
951  ////////////////////////////////////////////////////////////////////////
952  // Transform Related Fucntions
953  // Implemented in COP2_NodeTransform.C
954 
955  // given an area, this grabs the transformed image data from the input.
956  TIL_Region * transformRegion(int input,
957  COP2_Context &context,
958  const TIL_Plane *plane,
959  int aindex,
960  float t,
961  int xres,
962  int yres,
963  int xstart,
964  int ystart,
965  int xend,
966  int yend,
967  const COP2_TransformParms &parms,
968  bool input_aspect_adjust = true,
969  bool streak_off_frame = false);
970 
971  // transforms the input area/plane given by the region.
972  // The region bounds should be in the input's canvas space, if they aren't,
973  // set bounds_in_canvas_space to false;
974  bool transformRegion(int input,
975  COP2_Context &context,
976  TIL_Region *region,
977  const COP2_TransformParms &parms,
978  bool input_aspect_adjust = true,
979  bool bounds_in_canvas_space = true,
980  bool streak_off_frame = false);
981 
982  bool isFullTransform(int input,
983  COP2_Context &context,
984  const COP2_TransformParms &cparms,
985  bool input_aspect_adjust=true,
986  COP2_Node **source_node=0,
987  int *source_index=0,
988  float *aspectx1=0,
989  float *aspectx2=0,
990  float *aspecty1=0,
991  float *aspecty2=0,
992  COP2_TransformParms *prepped_parms=0);
993 
994  TIL_Region * transformBlurRegion(int input,
995  COP2_Context &context,
996  const TIL_Plane *plane,
997  int aindex,
998  float t,
999  int xres,
1000  int yres,
1001  int xstart,
1002  int ystart,
1003  int xend,
1004  int yend,
1005  float amount,
1006  float bias,
1008  bool deformation = false);
1009 
1010  bool transformBlurRegion(int input,
1011  COP2_Context &context,
1012  TIL_Region *region,
1013  float amount,
1014  float bias,
1016  bool deformation = false,
1017  bool bounds_in_canvas_space = true);
1018 
1019  // Helper function for transformRegion. It is called when all the
1020  // transform has to do is translate the region.
1021  bool translateRegion(COP2_Context &context,
1022  COP2_Node &source_node,
1023  int source_input,
1024  TIL_Region *region, float tx, float ty,
1025  TIL_RegionExtend hold,
1026  bool bounds_in_canvas_space,
1027  bool streak_off_frame);
1028 
1029  // Helper function for transformRegion. It is called on to do a full
1030  // transform.
1031  bool fullTransformRegion(COP2_Context &context,
1032  COP2_Node &source_node,
1033  int source_input,
1034  TIL_Region *region,
1035  COP2_TransformParms &parms,
1036  float haspect, float input_haspect,
1037  float vaspect, float input_vaspect,
1038  bool bounds_in_canvas_space);
1039 
1040  UT_Matrix4 getShiftedInverseTransformMatrix(COP2_Context &context,
1041  COP2_Node &source_node,
1042  int source_input,
1043  const TIL_Plane *iplane,
1044  int array_index,
1045  const COP2_TransformParms &parms,
1046  int &dx, int &dy);
1047 
1048  // Helper function for transformRegion and computeImageBounds. It is called
1049  // to prepare the transform parms for extraction. This method will do all
1050  // the collapsing of transforms as well. "source_node" will contain the
1051  // node whose input at "source_index" should be read for the data.
1052  // "source_node" will be initialized, but "source_index" needs to be the
1053  // index of the input for which we wish to prepare the parms (it may be
1054  // modified if transforms have collapsed).
1055  void prepareTransformParms(COP2_Context &context,
1056  COP2_TransformParms &parms,
1057  COP2_Node *& source_node,
1058  int &source_index,
1059  bool input_aspect_adjust);
1060 
1061  // adjustPivotParms adjusts the pivot and translate parms in order to
1062  // account for aspect ratios (it is a helper function to
1063  // prepareTransformParms).
1064  void adjustPivotParms(int input_index,
1065  COP2_TransformParms &parms,
1066  bool input_aspect_adjust);
1067 
1068  // Helper function for transformBlurRegion and computeImageBounds. It is
1069  // called to copy the set of transform parms and it prepares the new copies
1070  // for use.
1071  void copyAndPrepareTransformParms(
1073  &source_parms,
1075 
1076  //
1077  ////////////////////////////////////////////////////////////////////////
1078 
1079 
1080  void extractFromOutputRegion(TIL_TileList *tiles,
1081  TIL_Region *output);
1082 
1083  // like releaseTile for regions... call when you're finished with the
1084  // region.
1085  void releaseRegion(TIL_Region *, int output = 0);
1086 
1087  // gets tiles to process for this node. Normally, you just process the
1088  // nodes passed into cookMyTile(); however, if you need more to complete
1089  // the cook efficiently, request more using this function.
1090  // If block is 0, this function may return null. Only COP2_Node should
1091  // ever call this method with block set to 1.
1092  TIL_TileList *requestWorkingTiles(COP2_Context &context,
1093  const TIL_Plane *plane,
1094  int array_index,
1095  float t,
1096  int xstart, int ystart,
1097  int *cache_flag = 0,
1098  int ignore_bypass = 0,
1099  int block = 0);
1100 
1101  // once you're done processing the tiles requested with requestWorkingTiles
1102  // you must call this function. Do not call this function on the tilelist
1103  // passed in to cookMyTile().
1104  void releaseWorkingTiles(TIL_TileList *list);
1105 
1106  // Passes tiles from the input to the output.
1107  virtual void passThroughTiles(COP2_Context &context,
1108  const TIL_Plane *plane,
1109  int array_index,
1110  float t,
1111  int xstart, int ystart,
1112  TIL_TileList *&tile,
1113  int block = 1,
1114  bool *mask = 0,
1115  bool *blocked = 0);
1116 
1117  // return 1 if you want to pass a specific tile through; allows you to
1118  // scope regions of the data.
1119  virtual int passThrough(COP2_Context &context,
1120  const TIL_Plane *plane, int comp_index,
1121  int array_index, float t,
1122  int xstart, int ystart);
1123 
1124  TIL_TileList *getBlackTile(const TIL_Plane *plane, int aindex,
1125  float t, int xres, int yres, int thread,
1126  int xstart, int ystart, bool *mask =0);
1127 
1128  // Called to cook a single tile. Called for each tile in the image.
1129  virtual OP_ERROR cookMyTile(COP2_Context &context,
1130  TIL_TileList *tiles);
1131 
1132 
1133  OP_ERROR cookFullImage(COP2_Context &context,
1134  TIL_TileList *tiles,
1135  COP2_FullImageCB callback,
1136  UT_Lock &fullimagelock,
1137  bool use_float);
1138 
1139  inline void lockParms(bool lock);
1140 
1141  // Returns a new context. Overide to return your context derived from
1142  // COP2_ContextData and initialize it. This should only ever be called from
1143  // getContextData().
1144  virtual COP2_ContextData *newContextData(const TIL_Plane *plane,
1145  int array_index,
1146  float t,
1147  int xres,
1148  int yres,
1149  int thread,
1150  int max_threads);
1151 
1152  // retrieves only the context, without creating a context data.
1153  COP2_Context *getContext(const TIL_Plane *plane,
1154  int array_index,
1155  float t,
1156  int xres,
1157  int yres,
1158  int thread);
1159 
1160  // Copies the bounds of the input specified into the context. The pointers
1161  // are optional; they are assigned to the new bounds if non-null.
1162  bool copyInputBounds(int input, COP2_Context &context,
1163  int *x1 = 0, int *y1 = 0,
1164  int *x2 = 0, int *y2 = 0);
1165 
1166  // Override if your operation expands the op bounds. This method should set
1167  // the bounds in the context using setBounds()
1168  virtual void computeImageBounds(COP2_Context &context);
1169 
1170  // Scoping
1171  virtual bool isFrameScoped(int /*image_index*/) { return true; }
1172  // Override to return a scope string if the COP has a scope field. If there
1173  // is a valid scope, return 1, otherwise 0.
1174  virtual int scope(UT_String & /*scope*/) { return 0; }
1175  virtual int frameScope(UT_String & /*scope*/) { return 0; }
1176 
1177  OP_ERROR save(std::ostream &os, const OP_SaveFlags &flags,
1178  const char *pathPrefix,
1179  const UT_String &name_override = UT_String()
1180  ) override;
1181  OP_ERROR saveIntrinsic(std::ostream &os,
1182  const OP_SaveFlags &flags) override;
1183  bool load(UT_IStream &is, const char *extension,
1184  const char *path=0) override;
1185 
1186  // This function will convert a tile at index in the tilelist
1187  // to floating point or return the image data pointer if the tile
1188  // is already FP. This function returns true if it allocated memory that
1189  // you need to free (with delete [])
1190  bool getTileInFP(TIL_TileList *tilelist, float *&dest,
1191  int index, void *dtile =0);
1192 
1193  // This function will write a block of floating point data back to the
1194  // tile at index in the tilelist, converting it if necessary. It's
1195  // assumed that the FP source data is the proper size (tilelist->mySize).
1196  void writeFPtoTile(TIL_TileList *tilelist, float *&src,
1197  int index);
1198 
1199  void setCOPColoring(COP2_OpColorType type, bool enable);
1200 
1201  void getOvercookStats(int &redone, int &total);
1202  void clearOvercookStats();
1203 
1204  void ensureSequenceContainsColorAndAlpha();
1205 
1206  // This method is overridden by COP2_SubNet because its "input" is
1207  // special.
1208  virtual void cleanUpInputsRecursively();
1209 
1210 
1211  // This method returns the cook area info for a given context. Can
1212  // only be called during cookMyTile().
1213  const COP2_CookAreaInfo *getAreaInfo(COP2_Context &context) const;
1214 
1215  // This method makes the output area of the plane depend on all parts of
1216  // all input planes, regardless of the size of the output area.
1217  void makeOutputAreaDependOnAllInputAreas(
1218  COP2_CookAreaInfo &output_area,
1219  const COP2_CookAreaList &input_areas,
1220  COP2_CookAreaList &needed_areas);
1221 
1222  // This method makes the output area depended on all planes for a given
1223  // input.
1224  void makeOutputAreaDependOnInputAreas(int input,
1225  COP2_CookAreaInfo &output_area,
1226  const COP2_CookAreaList &input_areas,
1227  COP2_CookAreaList &needed_areas);
1228 
1229  // Selects a plane from the input to be dependent on. Returns the plane
1230  // added to the needed_areas list.
1231  COP2_CookAreaInfo *makeOutputAreaDependOnInputPlane(int input,
1232  const char *planename, int array_index, float t,
1233  const COP2_CookAreaList &input_areas,
1234  COP2_CookAreaList &needed_areas);
1235 
1236  // selects the corresponding plane from an input to be dependent on.
1237  // Returns the plane added to the needed_areas list.
1238  COP2_CookAreaInfo *makeOutputAreaDependOnMyPlane(int input,
1239  COP2_CookAreaInfo &output_area,
1240  const COP2_CookAreaList &input_areas,
1241  COP2_CookAreaList &needed_areas);
1242 
1243  // This method will try to collapse the transforms in the input areas,
1244  // setting the real input node in the needed areas. It will delete
1245  // the contents of uncollapsed_input_areas.
1246  void getInputAreasForCollapsedTransformInputs(
1247  COP2_Context &context,
1248  const COP2_TransformParms &transform_parms,
1249  COP2_CookAreaInfo &output_area,
1250  COP2_CookAreaList &uncollapsed_input_areas,
1251  COP2_CookAreaList &needed_areas,
1252  bool input_aspect_adjust,
1253  bool clear_uncollapse_list);
1254 
1255  // Override this method if the derived COP does not support partially
1256  // scoped planes and uses the default scope mechanism inside
1257  // COP2_PixelBase.
1258  virtual bool allowPartiallyScopedPlanes() const {return true;}
1259 
1260 
1261  void registerVolatileParm(const char *name,PRM_Callback c,
1262  bool ignore_missing = false);
1263 
1264  // the following set methods will follow channel references, if any
1265  // are present on the parm.
1266  void deAnimateFollowChanRef(const char *parmname,
1267  int vecidx );
1268 
1269  void getDependencyInfo(fpreal t, UT_WorkBuffer &text);
1270  void getDependencyInfoTree(fpreal t, UT_InfoTree &tree);
1271 
1272  void swapParm(const char *name1,const char *name2,
1273  int vsize);
1274  void swapStringParm(const char *name1,const char *name2,
1275  int vsize);
1276 public:
1277  // these are the 'manager' methods for setting up, cooking tiles and
1278  // cleaning up. The functions 'setupCook' and 'cookMyTile' are the ones
1279  // that should be overridden for normal operations. These methods do things
1280  // like lock inputs, make sure the cook is setup, etc.
1281  virtual OP_ERROR setup(float t, int xres, int yres, int max_threads,
1282  bool doinput = true);
1283  OP_ERROR cookTile(TIL_TileList *&, float t,
1284  int xres, int yres, int thread_index,
1285  int max_threads);
1286 
1287  // Clean up this node and its inputs. Cleaning up involves cleaning up
1288  // cook contexts and updating the performance monitor.
1289  void recursivelyCleanUp();
1290  void cleanUpCookContexts();
1291 
1292  // Clean up all the regions. This method is not called as part of the
1293  // normal cleanup.
1294  void cleanUpAllRegions() override;
1295 
1296  void bumpCookSerial() { myCookSerial++; }
1297  int getCookSerial() { return myCookSerial; }
1298 protected:
1301  unsigned char myCop2RecurseFlag :1,
1302  myFramesAllScopedFlag:1;
1306 
1307 private:
1308  UT_ValArray<COP2_Context *> myCookContexts;
1309  UT_ValArray<TIL_Region *> myNonSharedRegions;
1310 
1311  int myInitCook;
1312  int64 myTotalCookTime[TIL_MAX_THREADS];
1313  int64 myInputTileCookTime[TIL_MAX_THREADS];
1314  int64 myTotalTileCookTime[TIL_MAX_THREADS];
1315  unsigned char myCookStateFlags[TIL_MAX_THREADS];
1316  UT_IntArray myInputOpenKeys;
1317  int myCookDepth;
1318  int myCacheHits;
1319  int myCacheMisses;
1320  UT_ValArray<cop2LockInfo *> myLockedPlanes;
1321  int myPreviewPlaneIndex;
1322  int myPreviewPlaneArrayIndex;
1323  OP_ERROR myCookError;
1324  OP_ERROR myLastCop2CookError;
1325  OP_VERSION myCookSequenceVersion;
1326  float myLastErrorTime;
1327  bool myProxyEnable;
1328  bool myCop2DirtyFlag;
1329 
1330  // The following serial counter is included in the image identifier
1331  // string for this node. Forcing a recook will increment this counter,
1332  // thus preventing use of any cached tiles or images.
1333  int myCookSerial;
1334 
1335  // locks
1336  static TIL_FastLock theParmEvalLock;
1337  static TIL_FastLock theParmHashCodeLock;
1338  TIL_FastLock mySingleThreadedLock;
1339  TIL_FastLock mySetupFuncLock;
1340  TIL_FastLock myCookVarLock;
1341  TIL_FastLock myRegionLock;
1342  TIL_FastLock myErrorLock;
1343  TIL_FastLock myIntrLock;
1344  TIL_FastLock myInputBlockLock;
1345  TIL_FastLock myContextDataLock;
1346 
1347  // Viewer image source
1348  TIL_ImageSource *myImageSource;
1349 
1350  // Local variables
1351  int myVarResX[TIL_MAX_THREADS];
1352  int myVarResY[TIL_MAX_THREADS];
1353  int myVarImageIndex[TIL_MAX_THREADS];
1354  float myVarImageTime[TIL_MAX_THREADS];
1355  int myVarImageArray[TIL_MAX_THREADS];
1356  int myVarPlaneIndex[TIL_MAX_THREADS];
1357  int myVarPlaneChannels[TIL_MAX_THREADS];
1358 
1359  unsigned char myVarResUsed :1,
1360  myVarImageArrayUsed :1,
1361  myVarImagePlaneUsed :1,
1362  myVarUseFullRes :1,
1363  myCookOccurred :1;
1364  // Overcooking detection
1365  int myNumCookedTiles;
1366  int myDupCookedTiles;
1367 
1368  UT_Array<COP2_CheckpointWrapper *> myCheckpointWrapper;
1369 
1370  COP2_VolatileParmManager *myVolatileParms;
1371 
1372  // stuff for caching the image bounds.
1373  COP2_BoundsCache myBoundsCache;
1374  TIL_FastLock myBoundsLock;
1375 
1376  // This variable keeps track of the thread that opened the node.
1377  // If the node is not open, then it is set to UT_INVALID_THREAD_ID.
1378  ut_thread_id_t myOpenThreadId;
1379 
1380  // This variable locks the sections in the open() and close()
1381  // functions.
1382  UT_Lock myOpenLock;
1383 
1384  static bool theShowPreviewPref;
1385 
1386 private:
1387  // Sets node's opener thread id. Pass in UT_INVALID_THREAD_ID
1388  // to signal that the node is closed.
1389  void setOpenerThread(ut_thread_id_t thread_id)
1390  { myOpenThreadId = thread_id; }
1391 
1392  // Returns true if the current thread is the same thread that
1393  // opened the node. Returns false if the threads do not match or
1394  // if the node is closed.
1395  bool isOpenerThread() const
1396  { return myOpenThreadId
1397  == UT_Thread::getMyThreadId(); }
1398 
1399  virtual float copTimeTransform(int input, COP2_Context &context,
1400  float t);
1401 
1402  void setupVariables(const TIL_Plane *plane,
1403  int array,
1404  int xres,
1405  int yres,
1406  float t,
1407  int thread);
1408 
1409  // checks for parameter time dependency, and out-of-range keyframes.
1410  void checkTimeDepAndRange();
1411 
1412  // mostly used for debugging & correcting cache problems.
1413  void verifyCacheIntegrity() { }
1414 
1415  // Methods to fetch tiles from the cache or from an input.
1416  int getWorkingTiles(COP2_Context &context,
1417  const TIL_Plane *plane,
1418  int array_index,
1419  float t,
1420  int xstart,int ystart,
1421  TIL_TileList *tilelist,
1422  int ignore_bypass = 0,
1423  int block = 1,
1424  bool *mask = 0,
1425  double *passtime = 0);
1426 
1427  bool fillInteractiveTile(COP2_Context &context,
1428  const TIL_Plane *plane,
1429  int array_index, float t,
1430  int xstart,int ystart,
1431  TIL_Tile *tile, int cindex,
1432  int findex);
1433 
1434  // used only by inputTile, to resolve tile size/offset problems introduced
1435  // by the workspace & scoping channels.
1436  TIL_TileList * correctInputTile(int input_index,
1437  COP2_Context &context,
1438  const TIL_Plane *plane,
1439  int array_index,
1440  int xstart, int ystart,
1441  TIL_TileList *tilelist,
1442  int block, bool *blocked, bool *mask);
1443 
1444  void doneCookOnTiles(TIL_TileList *tiles, OP_ERROR errstate,
1445  int thread_index);
1446 
1447  // This function is used by processTile to send data to a tile devide.
1448  // This is nontrivial because the tile may extend outside the bounds
1449  // of the region of interest for the tile device.
1450  bool writeSafeDeepTile(COP2_ThreadCookParms *p,
1451  TIL_TileList *tilelist) const;
1452 
1453  // performance related functions
1454  void markTimerStart(int64 *now) const;
1455  void getElapsedTime(int64 *now) const;
1456  void appendCookTimesToPerformanceMonitor();
1457  void setCookDepth(int d);
1458 
1459  // Allocates or returns a pointer to a previously allocated region.
1460  TIL_Region * allocateRegion(const TIL_Plane *plane, int input_index,
1461  int array_index, float t,
1462  int xres, int yres,
1463  int x1, int y1, int x2, int y2,
1464  int bx1, int by1, int bx2, int by2,
1465  TIL_RegionExtend hold,
1466  int output, int share,
1467  int scan_alignment);
1468 
1469  // Preps a region for use; only called by allocateRegion & inputRegion.
1470  void openRegion(TIL_Region *region, void *regionmem[4],
1471  bool output);
1472 
1473  // called by the multiprocessor cooks as the 'thread method'.
1474  static void * threadCookTile(void *data);
1475 
1476  // These methods do the actual work of manipulating the rasters.
1477 
1478  // insert into full raster, possibly with a colour subrange.
1479  void insertIntoRaster(TIL_Raster *r, TIL_Tile *t,int tindex,
1480  float low=0.0F,float high=1.0F) const;
1481 
1482  // insert into subregion of a raster, possibly with a colour subrange.
1483  // (x1,y1) -> (x2,y2) defines the rectangular region to be updated.
1484  // (x,y)shift defines how the tile origins are translated to fit into the
1485  // region.
1486  void insertIntoRaster(TIL_Raster *r, TIL_Tile *t,int tindex,
1487  int x1, int y1, int x2, int y2,
1488  int xshift=0, int yshift=0,
1489  float low=0.0F,float high=1.0F,
1490  int greyscale = 0,
1491  int ignore_points =0,
1492  float gamma = 1.0F) const;
1493 
1494  void highlightTile(int thread, int onoff);
1495  void resetHighlight();
1496 
1497  // These methods compute a number of bounds related variables.
1498  void computeBoundsVariables(const OP_Context &context,
1499  const TIL_Plane *rplane,
1500  int array_index, TIL_Raster *raster,
1501  int thread_index,
1502  int orig_xstart, int orig_ystart,
1503  int orig_xend, int orig_yend,
1504  int &xstart, int &ystart, int &xend, int &yend,
1505  int &xtile1, int &ytile1,
1506  int &xtile2, int &ytile2,
1507  int &x1, int &y1, int &x2, int &y2,
1508  int &xshift, int &yshift,
1509  int &bounds_xstart, int &bounds_ystart,
1510  int &bounds_xend, int &bounds_yend,
1511  bool flipbook);
1512 
1513  void computeBoundsVariables(const TIL_Plane *rplane,
1514  float time, int xres, int yres,
1515  int array_index, TIL_Raster *raster,
1516  int thread_index,
1517  int orig_xstart, int orig_ystart,
1518  int orig_xend, int orig_yend,
1519  int &xstart, int &ystart, int &xend, int &yend,
1520  int &xtile1, int &ytile1, int &xtile2, int &ytile2,
1521  int &x1, int &y1, int &x2, int &y2,
1522  int &xshift, int &yshift,
1523  int &bounds_xstart, int &bounds_ystart,
1524  int &bounds_xend, int &bounds_yend,
1525  bool flipbook);
1526 
1527  // This convenience method returns the token string for the plane and
1528  // the tile indices for the area of interest. The area of interest
1529  // (xstart,ystart)-(xend,yend) is in frame space.
1530  UT_TokenString *getPlaneIdentifierAndTileBoundaries(
1531  COP2_Context &context,
1532  const TIL_Plane &refplane,
1533  int xstart, int ystart, int xend, int yend,
1534  int &xtile1, int &ytile1, int &xtile2, int &ytile2,
1535  bool flipbook);
1536 
1537  TIL_Region * getTransformRegionGPU(
1538  COP2_Node &source_node, int source_input,
1539  COP2_Context &context,
1540  const TIL_Plane *plane, int array_index,
1541  int x1, int y1, int x2, int y2,
1542  int input_origx, int input_origy,
1543  int input_xres, int input_yres,
1544  int filt_xoffset, int filt_yoffset,
1545  const COP2_TransformParms &parms,
1546  bool bounds_in_canvas_space,
1547  int &tx1, int &ty1, int &tx2, int &ty2,
1548  int preoffset[2], int postoffset[2]);
1549 
1550  bool fullTransformRegionCPU(COP2_Context &context,
1551  COP2_Node &source_node,
1552  int source_input,
1553  TIL_Region *region,
1554  const COP2_TransformParms &parms,
1555  int x1, int y1, int x2, int y2,
1556  int input_x1, int input_y1,
1557  int input_x2, int input_y2,
1558  int input_xres, int input_yres,
1559  int full_input_xres, int full_input_yres,
1560  int filt_xoffset, int filt_yoffset,
1561  float haspect, float input_haspect,
1562  float vaspect, float input_vaspect,
1563  bool bounds_in_canvas_space,
1564  const UT_Matrix4 &xform);
1565 
1566  bool fullTransformRegionGPU(COP2_Context &context,
1567  COP2_Node &source_node,
1568  int source_input,
1569  TIL_Region *region,
1570  const COP2_TransformParms &parms,
1571  int x1, int y1, int x2, int y2,
1572  int input_x1, int input_y1,
1573  int node_x1, int node_y1,
1574  int node_x2, int node_y2,
1575  int input_xres, int input_yres,
1576  int full_input_xres, int full_input_yres,
1577  int filt_xoffset, int filt_yoffset,
1578  float haspect, float input_haspect,
1579  float vaspect, float input_vaspect,
1580  bool bounds_in_canvas_space,
1581  const UT_Matrix4 &xform);
1582 
1583  bool transformBlurRegionCPU(int input,
1584  COP2_Context &context,
1585  TIL_Region *region,
1587  bool deformation,
1588  float prev, float next, int numtimes,
1589  float itime[3], float ifact[3],
1590  bool bounds_in_canvas_space,
1591  int filt_xoffset, int filt_yoffset,
1592  int input_origx, int input_origy,
1593  int ixres, int iyres,
1594  int x1, int y1, int x2, int y2,
1595  float startt, float endt, float incr,
1596  float bfact);
1597 
1598  bool transformBlurRegionGPU(int input,
1599  COP2_Context &context,
1600  TIL_Region *region,
1602  int deformation,
1603  float prev, float next, int numtimes,
1604  float itime[3], float ifact[3],
1605  bool bounds_in_canvas_space,
1606  int filt_xoffset, int filt_yoffset,
1607  int input_origx, int input_origy,
1608  int ixres, int iyres,
1609  int x1, int y1, int x2, int y2,
1610  float startt, float endt, float incr,
1611  float bfact);
1612 
1613  // These virtuals are methods that nobody should override...
1614  //
1615  // I/O methods
1616  //
1617  bool loadPacket(UT_IStream &is, short class_id, short sig,
1618  const char *path=0) override;
1619  bool loadPacket(UT_IStream &is, const char *token,
1620  const char *path=0) override;
1621 
1622  void deleteCookedData() override {}
1623  int saveCookedData(const char *, OP_Context &) override;
1624  int saveCookedData(std::ostream &, OP_Context &,
1625  int = 0) override
1626  { return 0; }
1627  const char *getFileExtension(int binary) const override
1628  { return binary ? "bcop2" : "cop2"; }
1629 
1630  static void installExpressions();
1631 
1632  friend class COP2_CookScheduler;
1633  friend class COP2_VexVariableMap;
1634  friend class COP2_PixelOp;
1635  friend class COP2_VexOp;
1636  friend class COP2_MaskOp;
1637 };
1638 
1639 inline TIL_TileList *
1640 COP2_Node::inputTile(int input_index, COP2_Context &context,
1641  int xstart, int ystart, OP_ERROR *err, int block,
1642  bool *mask, bool *blocked, bool *was_corrected)
1643 {
1644  return inputTile(input_index, context,
1645  context.myPlane, context.myArrayIndex,
1646  context.myTime, xstart, ystart, err, block, mask, 0,
1647  true, blocked, was_corrected);
1648 }
1649 
1650 
1651 inline TIL_TileList *
1652 COP2_Node::inputTile(int input_index, COP2_Context &context,
1653  TIL_TileList *tiles, OP_ERROR *err, int block,
1654  bool *mask, bool *blocked, bool *was_corrected)
1655 {
1656  return inputTile(input_index, context,
1657  context.myPlane, context.myArrayIndex,
1658  context.myTime,
1659  tiles->myX1,
1660  tiles->myY1,
1661  err, block, mask, 0, true, blocked, was_corrected);
1662 }
1663 
1664 inline TIL_TileList *
1666  TIL_TileList *tilelist, float t,
1667  OP_ERROR *err,int block, bool *mask, bool *blocked,
1668  bool *was_corrected)
1669 {
1670  return inputTile(index, context, tilelist->myPlane, tilelist->myArrayIndex,
1671  t, tilelist->myX1, tilelist->myY1, err, block, mask,
1672  0, true, blocked, was_corrected);
1673 }
1674 
1675 inline TIL_Region *
1676 COP2_Node::inputRegion(int input_index,
1677  COP2_Context &context,
1678  TIL_TileList *tilelist,
1679  int xshift,int yshift, int copy, TIL_RegionExtend hold)
1680 {
1681  return inputRegion(input_index, context,
1682  context.myPlane, context.myArrayIndex,
1683  context.myTime, tilelist, xshift, yshift, copy, hold);
1684 }
1685 
1686 inline TIL_Region *
1687 COP2_Node::inputRegion(int input_index, COP2_Context &context,
1688  int xstart, int ystart, int xend, int yend,
1689  TIL_RegionExtend hold, int share,
1690  void *regionmem[PLANE_MAX_VECTOR_SIZE],
1691  bool correct_aspect, bool correct_bounds,
1692  int scan_alignment)
1693 {
1694  return inputRegion(input_index, context,
1695  context.myPlane, context.myArrayIndex,
1696  context.myTime, xstart, ystart, xend, yend,
1697  hold, share, regionmem, correct_aspect,
1698  correct_bounds, scan_alignment);
1699 }
1700 
1701 inline TIL_Region *
1702 COP2_Node::outputRegion(const TIL_Plane *plane, int array_index, float seqt,
1703  int xres, int yres, int thread,
1704  int xstart, int ystart, int xend, int yend, int share,
1705  int rindex, int alignment)
1706 {
1707  return outputRegion(plane, plane, array_index, seqt, xres, yres, thread,
1708  xstart, ystart, xend, yend, share, rindex,alignment);
1709 }
1710 
1711 inline void
1713 {
1714  if(lock)
1715  TIL_LOCK(theParmEvalLock);
1716  else
1717  TIL_UNLOCK(theParmEvalLock);
1718 }
1719 
1720 inline bool
1722  int &x1, int &y1, int &x2, int &y2)
1723 {
1724  return getInputBounds(input, context.myPlane, context.myArrayIndex,
1725  context.myTime, context.myXres, context.myYres,
1726  context.myThreadIndex, x1,y1, x2,y2);
1727 }
1728 
1729 inline void
1731  int &x1,int &y1, int &x2,int &y2)
1732 {
1733  getImageBounds(context.myPlane, context.myArrayIndex, context.myTime,
1734  context.myXres, context.myYres, context.myThreadIndex,
1735  x1,y1, x2,y2);
1736 }
1737 
1738 // Some common defines.
1739 extern "C" {
1741 };
1742 
1743 #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:297
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:265
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
uint64 OP_VERSION
Definition: OP_Version.h:6
#define COP2_MULTITHREADED
Definition: COP2_Common.h:214
virtual int getNetOverviewColor(UT_Color &color)
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:1299
#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:744
const GLdouble * v
Definition: glcorearb.h:837
OP_OpTypeId getChildTypeID() const override
Definition: COP2_Node.h:591
void bumpCookSerial()
Definition: COP2_Node.h:1296
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:264
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
void lockParms(bool lock)
Definition: COP2_Node.h:1712
int myInterruptFlags
Definition: COP2_Node.h:1303
virtual bool preferredViewPlane(UT_WorkBuffer &)
Definition: COP2_Node.h:575
TIL_RegionExtend
Definition: TIL_Region.h:24
virtual void forceRecook(bool evensmartcache=true)
int myCop2OpenCount
Definition: COP2_Node.h:1300
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:1702
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:740
virtual void getNodeSpecificInfoText(OP_Context &context, OP_NodeInfoParms &parms)
OP_ERROR bypassMe(OP_Context &, int &) override
Definition: COP2_Node.h:700
UT_FilterType
Definition: UT_FilterType.h:16
static OP_VariablePair myVariablePair
Definition: COP2_Node.h:619
static const char * theChildTableName
Definition: COP2_Node.h:585
virtual int getNumInputsToOpen() const
Definition: COP2_Node.h:643
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:713
< returns > If no error
Definition: snippets.dox:2
virtual unsigned nInputs() const
virtual bool isTimeDepOperation()
Definition: COP2_Node.h:346
virtual bool allowPartiallyScopedPlanes() const
Definition: COP2_Node.h:1258
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:698
OP_ERROR(* COP2_FullImageCB)(COP2_Context &, const TIL_Region *, TIL_Region *, COP2_Node *)
Definition: COP2_Node.h:73
virtual bool isGenerator() const
Definition: COP2_Node.h:353
virtual int scope(UT_String &)
Definition: COP2_Node.h:1174
virtual void cleanUpAllRegions()=0
GLboolean reset
Definition: glad.h:5138
virtual void raiseImageTooLargeError()=0
virtual COP2_ThreadPref getThreadPreference() const
Definition: COP2_Node.h:750
virtual int getNumThreadsToUse() const =0
void opChanged(OP_EventType reason, void *data=0) override
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:167
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:1297
bool getInputBounds(int input, COP2_Context &context, int &x1, int &y1, int &x2, int &y2)
Definition: COP2_Node.h:1721
GLenum GLenum GLsizei void * table
Definition: glad.h:5129
int myInputBlockFlags
Definition: COP2_Node.h:1304
GLdouble t
Definition: glad.h:2397
TIL_ViewerType
Definition: TIL_Defines.h:139
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
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 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:277
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()
virtual bool loadPacket(UT_IStream &is, short class_id, short sig, const char *path=0)
OP_EventType
Definition: OP_Value.h:22
A global error manager scope.
OP_DataType
Definition: OP_DataTypes.h:28
virtual void getMyExternalReferences(UT_StringArray &reflist, UT_StringArray *nodelist=0, bool collapse=false, bool check_missing=false, bool show_missing_only=false)
static OP_TemplatePair myTemplatePair
Definition: COP2_Node.h:618
virtual bool evalVariableValue(UT_String &val, int index, int thread)
#define TIL_MAX_THREADS
Definition: TIL_Defines.h:38
Definition: core.h:982
virtual void waitForLastFile()=0
virtual bool isFrameScoped(int)
Definition: COP2_Node.h:1171
virtual bool isGPUAssisted(const TIL_Plane &, int, float, int, int, int)
Definition: COP2_Node.h:347
bool load(UT_IStream &is, const char *ext="", const char *path=0) override
virtual int frameScope(UT_String &)
Definition: COP2_Node.h:1175
const TIL_Plane * myPlane
Definition: COP2_Context.h:74
virtual OP_ERROR save(std::ostream &os, const OP_SaveFlags &flags, const char *path_prefix="", const UT_String &name_override=UT_String())
virtual COP2_Node * getInputToOpen(int i)
Definition: COP2_Node.h:644
GLboolean r
Definition: glcorearb.h:1222
GLdouble GLdouble GLdouble y2
Definition: glad.h:2349
COP2_ThreadPref myThreadPreference
Definition: COP2_Node.h:1305
type
Definition: core.h:1059
**Note that the tasks the thread_id
Definition: thread.h:637
virtual void inputOpenFailed(int)
Definition: COP2_Node.h:747
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:895
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