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