HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_Save.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Side Effects Software Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef __HUSD_Save_h__
19 #define __HUSD_Save_h__
20 
21 #include "HUSD_API.h"
22 #include "HUSD_DataHandle.h"
23 #include "HUSD_OutputProcessor.h"
24 #include <UT/UT_PathPattern.h>
25 #include <UT/UT_StringHolder.h>
26 #include <UT/UT_UniquePtr.h>
27 #include <SYS/SYS_Types.h>
28 
34 };
35 
36 // Some simple structs that just handle lumping bits of save configuration
37 // data together.
39 {
40 public:
46  { }
47 
52 };
53 
55 {
56 public:
58  : myConfigNode(nullptr),
59  myConfigTime(0.0)
60  { }
61 
65 };
66 
68 {
69 public:
71  : myRequireDefaultPrim(false)
72  { }
73 
76 };
77 
79 {
80 public:
82  : myClearHoudiniCustomData(false),
83  myFlattenFileLayers(false),
84  myFlattenSopLayers(false),
87  mySaveFilesFromDisk(false),
88  myEnsureMetricsSet(false)
89  { }
90 
98 };
99 
101 {
102 public:
103  HUSD_Save();
104  ~HUSD_Save();
105 
106  bool addCombinedTimeSample(const HUSD_AutoReadLock &lock);
107  bool saveCombined(const UT_StringRef &filepath,
108  UT_StringArray &saved_paths);
109  bool save(const HUSD_AutoReadLock &lock,
110  const UT_StringRef &filepath,
111  UT_StringArray &saved_paths);
112 
114  { return mySaveStyle; }
115  void setSaveStyle(HUSD_SaveStyle save_style)
116  { mySaveStyle = save_style; }
117 
118  bool resuireDefaultPrim() const
119  { return myDefaultPrimData.myRequireDefaultPrim; }
120  void setRequireDefaultPrim(bool require_default_prim)
121  { myDefaultPrimData.
122  myRequireDefaultPrim = require_default_prim; }
123 
125  { return myDefaultPrimData.myDefaultPrim; }
126  void setDefaultPrim(const UT_StringHolder &defaultprim)
127  { myDefaultPrimData.myDefaultPrim = defaultprim; }
128 
130  { return myFlags.myClearHoudiniCustomData; }
131  void setClearHoudiniCustomData(bool clear_data)
132  { myFlags.myClearHoudiniCustomData = clear_data; }
133 
134  bool flattenFileLayers() const
135  { return myFlags.myFlattenFileLayers; }
136  void setFlattenFileLayers(bool flatten_file_layers)
137  { myFlags.myFlattenFileLayers = flatten_file_layers; }
138 
139  bool flattenSopLayers() const
140  { return myFlags.myFlattenSopLayers; }
141  void setFlattenSopLayers(bool flatten_sop_layers)
142  { myFlags.myFlattenSopLayers = flatten_sop_layers; }
143 
145  { return myFlags.myErrorSavingImplicitPaths; }
147  { myFlags.myErrorSavingImplicitPaths = error; }
148 
150  { return myFlags.myIgnoreSavingImplicitPaths; }
152  { myFlags.myIgnoreSavingImplicitPaths = ignore; }
153 
154  bool saveFilesFromDisk() const
155  { return myFlags.mySaveFilesFromDisk; }
156  void setSaveFilesFromDisk(bool save)
157  { myFlags.mySaveFilesFromDisk = save; }
158 
159  bool ensureMetricsSet() const
160  { return myFlags.myEnsureMetricsSet; }
161  void setEnsureMetricsSet(bool set)
162  { myFlags.myEnsureMetricsSet = set; }
163 
165  { return mySaveFilesPattern.get(); }
167  {
168  if (pattern.isstring())
169  mySaveFilesPattern.reset(
170  new UT_PathPattern(pattern));
171  else
172  mySaveFilesPattern.reset();
173  }
174 
176  { return myTimeData.myStartFrame; }
177  void setStartFrame(fpreal64 start_time = -SYS_FP64_MAX)
178  { myTimeData.myStartFrame = start_time; }
179 
181  { return myTimeData.myEndFrame; }
183  { myTimeData.myEndFrame = end_time; }
184 
186  { return myTimeData.myTimeCodesPerSecond; }
188  { myTimeData.myTimeCodesPerSecond = tps; }
189 
191  { return myTimeData.myFramesPerSecond; }
193  { myTimeData.myFramesPerSecond = fps; }
194 
196  { return myProcessorData.myProcessors; }
198  const HUSD_OutputProcessorArray &aps)
199  { myProcessorData.myProcessors = aps; }
200 
202  { return myProcessorData.myConfigNode; }
204  { myProcessorData.myConfigNode = config_node; }
205 
207  { return myProcessorData.myConfigTime; }
209  { myProcessorData.myConfigTime = t; }
210 
211 
212 
213 private:
214  class husd_SavePrivate;
215 
217  UT_UniquePtr<UT_PathPattern> mySaveFilesPattern;
218  HUSD_SaveStyle mySaveStyle;
219  husd_SaveProcessorData myProcessorData;
220  husd_SaveDefaultPrimData myDefaultPrimData;
221  husd_SaveTimeData myTimeData;
222  husd_SaveConfigFlags myFlags;
223 };
224 
225 #endif
226 
fpreal64 startFrame() const
Definition: HUSD_Save.h:175
fpreal64 myTimeCodesPerSecond
Definition: HUSD_Save.h:50
bool myClearHoudiniCustomData
Definition: HUSD_Save.h:91
void setDefaultPrim(const UT_StringHolder &defaultprim)
Definition: HUSD_Save.h:126
fpreal64 endFrame() const
Definition: HUSD_Save.h:180
bool errorSavingImplicitPaths() const
Definition: HUSD_Save.h:144
#define HUSD_API
Definition: HUSD_API.h:32
void setSaveStyle(HUSD_SaveStyle save_style)
Definition: HUSD_Save.h:115
fpreal64 framesPerSecond() const
Definition: HUSD_Save.h:190
void setSaveFilesPattern(const UT_StringHolder &pattern)
Definition: HUSD_Save.h:166
const UT_StringHolder & defaultPrim() const
Definition: HUSD_Save.h:124
bool ignoreSavingImplicitPaths() const
Definition: HUSD_Save.h:149
#define SYS_FP64_MAX
Definition: SYS_Types.h:220
bool ensureMetricsSet() const
Definition: HUSD_Save.h:159
fpreal64 myStartFrame
Definition: HUSD_Save.h:48
OP_Node * outputProcessorsConfigNode() const
Definition: HUSD_Save.h:201
void setOutputProcessorsConfigNode(OP_Node *config_node)
Definition: HUSD_Save.h:203
double fpreal64
Definition: SYS_Types.h:196
void setTimeCodesPerSecond(fpreal64 tps=SYS_FP64_MAX)
Definition: HUSD_Save.h:187
void setFlattenSopLayers(bool flatten_sop_layers)
Definition: HUSD_Save.h:141
fpreal64 timeCodesPerSecond() const
Definition: HUSD_Save.h:185
HUSD_SaveStyle
Definition: HUSD_Save.h:29
HUSD_OutputProcessorArray myProcessors
Definition: HUSD_Save.h:62
bool myIgnoreSavingImplicitPaths
Definition: HUSD_Save.h:95
void setRequireDefaultPrim(bool require_default_prim)
Definition: HUSD_Save.h:120
bool myErrorSavingImplicitPaths
Definition: HUSD_Save.h:94
fpreal outputProcessorsTime() const
Definition: HUSD_Save.h:206
const HUSD_OutputProcessorArray & outputProcessors() const
Definition: HUSD_Save.h:195
void setEnsureMetricsSet(bool set)
Definition: HUSD_Save.h:161
fpreal64 myFramesPerSecond
Definition: HUSD_Save.h:51
bool flattenFileLayers() const
Definition: HUSD_Save.h:134
double fpreal
Definition: SYS_Types.h:276
void setFramesPerSecond(fpreal64 fps=SYS_FP64_MAX)
Definition: HUSD_Save.h:192
const UT_PathPattern * saveFilesPattern() const
Definition: HUSD_Save.h:164
OP_Node * myConfigNode
Definition: HUSD_Save.h:63
bool flattenSopLayers() const
Definition: HUSD_Save.h:139
void setErrorSavingImplicitPaths(bool error)
Definition: HUSD_Save.h:146
UT_StringHolder myDefaultPrim
Definition: HUSD_Save.h:74
void setOutputProcessors(const HUSD_OutputProcessorArray &aps)
Definition: HUSD_Save.h:197
void setIgnoreSavingImplicitPaths(bool ignore)
Definition: HUSD_Save.h:151
bool clearHoudiniCustomData() const
Definition: HUSD_Save.h:129
fpreal64 myEndFrame
Definition: HUSD_Save.h:49
GLubyte * pattern
Definition: glew.h:5711
void setStartFrame(fpreal64 start_time=-SYS_FP64_MAX)
Definition: HUSD_Save.h:177
void setEndFrame(fpreal64 end_time=SYS_FP64_MAX)
Definition: HUSD_Save.h:182
bool saveFilesFromDisk() const
Definition: HUSD_Save.h:154
void setSaveFilesFromDisk(bool save)
Definition: HUSD_Save.h:156
void setOutputProcessorsTime(fpreal t)
Definition: HUSD_Save.h:208
GLdouble GLdouble t
Definition: glew.h:1398
SYS_FORCE_INLINE bool isstring() const
void setFlattenFileLayers(bool flatten_file_layers)
Definition: HUSD_Save.h:136
void setClearHoudiniCustomData(bool clear_data)
Definition: HUSD_Save.h:131
HUSD_SaveStyle saveStyle() const
Definition: HUSD_Save.h:113
bool resuireDefaultPrim() const
Definition: HUSD_Save.h:118