HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
COP_Node_Common.h
Go to the documentation of this file.
1 #pragma once
2 #include "COP_API.h"
3 
4 #include <OP/OP_Error.h>
5 
6 #include <UT/UT_Array.h>
7 #include <UT/UT_Rect.h>
8 #include <UT/UT_Thread.h>
9 
10 class OP_Context;
11 class OP_Node;
12 
13 class IMG_TileOptions;
14 
15 class TIL_Plane;
16 class TIL_Raster;
17 class TIL_TileArray;
18 class TIL_TileMPlay;
19 class TIL_Sequence;
20 
21 class UT_Interrupt;
22 class UT_StringArray;
23 
24 typedef void (*UpdateCallback)(float, bool, bool);
25 
27 {
28 public:
29 
31 
32  virtual ~COP_Node_Common() { }
33 
34  static UpdateCallback getUpdateCallback();
35  static void setUpdateCallback(UpdateCallback updateCallback);
36  static bool isCookAborted();
37  static void resetAbortFlag();
38  static void abortCook();
39 
40  bool isCookAborted(int thread_index);
41  virtual bool isInterrupted(int thread) = 0;
42 
43  static UT_Interrupt *getInterrupt();
44  static void setInterrupt(UT_Interrupt *);
45 
46  virtual void setInterrupted(int) = 0;
47 
48  virtual OP_Node* getOp() = 0;
49 
50  // cooks this OP into a file (which should not be open yet). If scope isn't
51  // null, only the scoped planes in that sequence will be writen to the file.
52  int cookToFile(const UT_StringArray &filenames,
53  const IMG_TileOptions *,
54  const TIL_Sequence *scope,
55  const UT_IntArray &image_index,
56  const UT_StringHolder &ocio_ospace = UT_StringHolder(),
57  const UT_StringHolder &ocio_look = UT_StringHolder(),
58  const UT_StringHolder &ocio_display = UT_StringHolder(),
59  const UT_StringHolder &ocio_view = UT_StringHolder(),
60  const char *uselut = 0,
61  float gamma = 1.0F,
62  UT_InclusiveRect *bounds = 0,
63  bool single_frame = false,
64  bool thread_io = false,
65  bool env_map = false,
66  bool use_progress_dialog=true);
67 
68  int cookToFile(const UT_StringArray &filenames,
69  const IMG_TileOptions *,
70  OP_Context &context,
71  const UT_IntArray &image_index,
72  const char *cplane, const char *aplane = 0,
73  const UT_StringHolder &ocio_ospace = UT_StringHolder(),
74  const UT_StringHolder &ocio_look = UT_StringHolder(),
75  const UT_StringHolder &ocio_display = UT_StringHolder(),
76  const UT_StringHolder &ocio_view = UT_StringHolder(),
77  const char *uselut = 0,
78  float gamma = 1.0F,
79  UT_InclusiveRect *bounds = 0,
80  bool single_frame = false,
81  bool thread_io = false,
82  bool env_map = false,
83  bool use_progress_dialog=true);
84 
85  // Does a flipbook render. 'info' should contain the planes to render,
86  // the frame range and image size.
87  int cookFlipbook(const TIL_Sequence &info,
88  int step = 1,
89  float gamma = 1.0f,
90  const char *lut = 0,
91  bool startnew=true,
92  bool (*updateCallback)(void *) = 0,
93  void *updateEntity = 0,
94  bool write_houdini_frame = true,
95  const char *session_label = NULL,
96  const UT_StringHolder &ocio_ospace = UT_StringHolder(),
97  const UT_StringHolder &ocio_look = UT_StringHolder(),
98  const UT_StringHolder &ocio_display = UT_StringHolder(),
99  const UT_StringHolder &ocio_view = UT_StringHolder());
100 
101  virtual OP_ERROR open(short& key, int clear_errors = 0) = 0;
102  virtual void close(short key) = 0;
103 
104  virtual TIL_Sequence& getSequence() = 0;
105 
106  virtual void getImageBounds(const TIL_Plane *plane, int array,
107  float t, int xres, int yres, int thread,
108  int &x1, int &y1,int &x2, int &y2) = 0;
109 
110  virtual void waitForLastFile() = 0;
111 
112  virtual void cleanUpAllRegions() = 0;
113 
114  virtual float getPercentageComplete(int num_extra_tiles_cooked) const = 0;
115  virtual int getNumThreadsToUse() const = 0;
116 
117  virtual void raiseImageTooLargeError() = 0;
118 
119  virtual int cookToRaster(UT_ValArray<TIL_Raster *> &rasters,
120  UT_ValArray<OP_Context *> &contexts,
122  UT_IntArray &array_index,
123  UT_ValArray<const int *> &comp_map,
125  int subregion = 1, int clear = 1,
126  float black = 0.0F, float white = 1.0F,
127  int compindex = -1,
128  int ignore_bwpoints=0,
129  float gamma = 1.0F,
130  bool interactive = false,
131  UT_ValArray<TIL_Raster *> *tiles = 0,
132  int tile_index = 0, TIL_TileMPlay * =0,
133  bool cleanup_after = true,
134  const UT_StringHolder &ocio_ospace = UT_StringHolder(),
135  const UT_StringHolder &ocio_look = UT_StringHolder(),
136  const UT_StringHolder &ocio_display = UT_StringHolder(),
137  const UT_StringHolder &ocio_view = UT_StringHolder()) = 0;
138 
139  static const char *getColorPlaneName();
140 
141  int getThreadIndex() const;
142 
143  ut_thread_id_t getThreadID(int thread);
144 
145  // These functions setup and reset the table which translates thread
146  // process id's into our thread indices (0-TIL_MAX_THREADS).
147  static void setWorkingThreadId(int thread_index);
148  static void clearWorkingThreadId(int thread_index);
149 };
150 
void
Definition: png.h:1083
UT_ErrorSeverity
Definition: UT_Error.h:25
void close() override
GLdouble GLdouble x2
Definition: glad.h:2349
GLfloat f
Definition: glcorearb.h:1926
IMATH_NAMESPACE::V2f float
int open(float queuesize) override
GLdouble y1
Definition: glad.h:2349
virtual ~COP_Node_Common()
GLdouble t
Definition: glad.h:2397
**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
Base Integer Rectangle class.
void(* UpdateCallback)(float, bool, bool)
#define COP_API
Definition: COP_API.h:8
GLdouble GLdouble GLdouble y2
Definition: glad.h:2349