HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ROP_RenderCmdParms.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  * COMMENTS: A class encapsulating the input and output parameters used by
7  * the render commands of both hscript and hom.
8  */
9 
10 #ifndef __ROP_RenderCmdParms_h__
11 #define __ROP_RenderCmdParms_h__
12 
13 
14 #include "ROP_API.h"
15 #include <UT/UT_Assert.h>
16 #include <UT/UT_FloatArray.h>
17 #include <UT/UT_ValArray.h>
18 #include <UT/UT_Array.h>
19 #include <iosfwd>
20 
21 class ROP_Node;
22 class SOHO_ParmOverride;
23 
25 {
26 public:
28  myOutputFile(NULL),
29  myOutputFormat(NULL),
30  myToFlipbook(false),
31  myQuality(2),
32  myIgnoreInputs(false),
33  myInterleaveFrames(false),
34  myIgnoreBypass(false),
35  myIgnoreLock(false),
36  myTrackDependencies(false),
37  myPrintDependencies(false),
38  myPrintFullPath(false),
39  myCondenseRanges(false),
40  myFrameMerge(false),
41  myAlfred(false),
42  myOutStream(NULL),
43  myErrStream(NULL),
44  mySohoParms(NULL),
45  myValidationFlags(0) {}
47 
48  // Set and get the start and end frame of the frame range to be rendered.
49  // If getFrameRange returns false then no valid frame range has been
50  // set, and the values returned in start_fr and end_fr are undefined.
51  void setFrameRange(fpreal start_fr, fpreal end_fr);
52  bool getFrameRange(fpreal &start_fr, fpreal &end_fr);
53 
54  // Set and get the frame increment, which is only valid if there is
55  // a frame range. If getFrameIncrement returns false then no valid
56  // frame increment has been set, and the value returned in finc is
57  // undefined.
58  void setFrameIncrement(fpreal finc);
59  bool getFrameIncrement(fpreal &finc);
60 
61  SOHO_ParmOverride *getSohoParms() { return mySohoParms; }
62 
63  // Set and get the output file where the rendered image will go.
64  void setOutputFile(const char *output);
65  const char *getOutputFile() { return myOutputFile; }
66 
67  // Set and get the format of the rendered image.
68  void setOutputFormat(const char *fmt);
69  const char *getOutputFormat() { return myOutputFormat; }
70 
71  // Set the resolution scale (for SOHO)
72  void setResolutionScale(fpreal scale);
73 
74  // Set a specific resolution override
75  void setResolution(int xres, int yres);
76 
77  // Set and test if we're rendering to a flipbook.
78  void setToFlipbook(bool on = true);
79  bool isToFlipbook() { return myToFlipbook; }
80 
81  // Set and get the render quality.
82  void setQuality(int quality) { myQuality = quality; }
83  int getQuality() { return myQuality; }
84 
85  // Set and test if we should ignore inputs to the ROP.
86  void setIgnoreInputs(bool on = true) { myIgnoreInputs = on; }
87  bool isIgnoreInputs() { return myIgnoreInputs; }
88 
89  // Set and test if we're rendering frame by frame instead of Rop by Rop.
90  void setInterleaveFrames(bool on = true)
91  { myInterleaveFrames = on; }
92  bool isInterleaveFrames() { return myInterleaveFrames; }
93 
94  // Set and test if we should ignore the bypass flags on the ROPs.
95  void setIgnoreBypass(bool on = true) { myIgnoreBypass = on; }
96  bool isIgnoreBypass() { return myIgnoreBypass; }
97 
98  // Set and test if we should ignore the lock flags on the ROPs.
99  void setIgnoreLock(bool on = true) { myIgnoreLock = on; }
100  bool isIgnoreLock() { return myIgnoreLock; }
101 
102  // Set and test if we should track dependencies. If so, no rendering
103  // will be done and we will instead store the ROPs and frames that
104  // would have been rendered. These can be obtained after completion
105  // using getROPDendencies and getFrameDependencies.
106  void setTrackDependencies(bool on = true)
107  { myTrackDependencies = on; }
108  bool isTrackDependencies() { return myTrackDependencies; }
109 
110  // When enabled, frame ranges are consolidated with previous ranges on the
111  // same node if the dependencies are the same for the two ranges. This
112  // makes the render list smaller, but it may not be appropriate for farm
113  // jobs, where consolidation would reduce the benefit of parallel nature of
114  // the farm.
115  void setFrameMerge(bool merge = true) { myFrameMerge = merge; }
116  bool isFrameMerge() const { return myFrameMerge; }
117 
118  // Set and test if we should print dependencies. If so, an output
119  // stream must be given. When printing dependencies we also have
120  // the option to print the full path of the ROP and to condense
121  // the frame ranges that are output.
122  void setPrintDependencies(bool print_dependencies,
123  bool print_full_path,
124  bool condense_ranges)
125  {
126  myPrintDependencies = print_dependencies;
127  myPrintFullPath = print_full_path;
128  myCondenseRanges = condense_ranges;
129  }
131  {
132  if (myPrintDependencies)
133  UT_ASSERT(getOutStream());
134  return myPrintDependencies;
135  }
137  {
138  if (myPrintFullPath)
139  UT_ASSERT(isPrintDependencies());
140  return myPrintFullPath;
141  }
143  {
144  if (myCondenseRanges)
145  UT_ASSERT(isPrintDependencies());
146  return myCondenseRanges;
147  }
148 
149  void setOutStream(std::ostream *out) { myOutStream = out; }
150  std::ostream* getOutStream() { return myOutStream; }
151 
152  void setErrStream(std::ostream *err) { myErrStream = err; }
153  std::ostream* getErrStream() { return myErrStream; }
154 
155  /// @{
156  /// Handle alfred-style progress
157  void setAlfred(bool f) { myAlfred = f; }
158  bool getAlfred() const { return myAlfred; }
159  /// @}
160 
161  // Get an array of ROP that will be rendered by the command. This
162  // is only valid is isTrackDependencies() is true and only after
163  // the operation has completed.
165  {
166  UT_ASSERT(isTrackDependencies());
167  return myROPDependencies;
168  }
169 
170  // Get an array of frame lists indicating which frames will be
171  // rendered by the command. Each frame list corresponds to the
172  // respective ROP_Node in the getROPDependencies array.
174  {
175  UT_ASSERT(isTrackDependencies());
176  return myFrameDependencies;
177  }
178 
179  // Add a ROP_Node to the dependency array. Returns an identifier which
180  // should be used when adding frame dependencies.
181  int addROPDependency(ROP_Node *node);
182 
183  // Add a frame to the dependency array, using the node_id returned by
184  // addROPDependency.
185  void addFrameDependency(int node_id, fpreal frame);
186 
187  void setSohoString(const char *parm, const char *value);
188  void setSohoReal(const char*parm, fpreal *value, int vsize=1);
189  void setSohoInt(const char*parm, int *value, int vsize=1);
190 
191 private:
192  void setValidationFlag(int flag, bool on = true);
193  bool testValidationFlag(int flag);
194 
195  fpreal myStartFrame;
196  fpreal myEndFrame;
197  fpreal myFrameInc;
198  const char *myOutputFile;
199  const char *myOutputFormat;
200  bool myToFlipbook;
201  int myQuality;
202  bool myIgnoreInputs;
203  bool myInterleaveFrames;
204  bool myIgnoreBypass;
205  bool myIgnoreLock;
206  bool myTrackDependencies;
207  bool myPrintDependencies;
208  bool myPrintFullPath;
209  bool myCondenseRanges;
210  bool myFrameMerge;
211  bool myAlfred;
212  std::ostream *myOutStream;
213  std::ostream *myErrStream;
214  SOHO_ParmOverride *mySohoParms;
215 
216  UT_ValArray<ROP_Node*> myROPDependencies;
217  UT_Array<UT_FprealArray> myFrameDependencies;
218 
219  int myValidationFlags;
220 };
221 
222 #endif
void setInterleaveFrames(bool on=true)
void setIgnoreBypass(bool on=true)
void setIgnoreLock(bool on=true)
void setQuality(int quality)
const UT_ValArray< ROP_Node * > & getROPDependencies()
const UT_Array< UT_FprealArray > & getFrameDependencies()
void setPrintDependencies(bool print_dependencies, bool print_full_path, bool condense_ranges)
void setErrStream(std::ostream *err)
#define ROP_API
Definition: ROP_API.h:10
std::ostream * getErrStream()
const char * getOutputFormat()
GA_API const UT_StringHolder scale
GLfloat f
Definition: glcorearb.h:1926
void setIgnoreInputs(bool on=true)
void setOutStream(std::ostream *out)
std::ostream * getOutStream()
bool isFrameMerge() const
void setFrameMerge(bool merge=true)
const char * getOutputFile()
fpreal64 fpreal
Definition: SYS_Types.h:277
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
Definition: core.h:1131
void setTrackDependencies(bool on=true)
SOHO_ParmOverride * getSohoParms()