@@ -52,12 +52,29 @@ IE_CORE_DEFINERUNTIMETYPED( RATDeepImageWriter );
52
52
const DeepImageWriter::DeepImageWriterDescription<RATDeepImageWriter> RATDeepImageWriter::g_writerDescription ( " rat" );
53
53
54
54
RATDeepImageWriter::RATDeepImageWriter ()
55
+ #if UT_MAJOR_VERSION_INT >= 13
56
+
57
+ : DeepImageWriter( " Writes Houdini RAT deep texture file format." ), m_outputFile( 0 ), m_ratPixel( 0 )
58
+
59
+ #else
60
+
55
61
: DeepImageWriter( " Writes Houdini RAT deep texture file format." ), m_outputFile( 0 )
62
+
63
+ #endif
56
64
{
57
65
}
58
66
59
67
RATDeepImageWriter::RATDeepImageWriter ( const std::string &fileName )
68
+ #if UT_MAJOR_VERSION_INT >= 13
69
+
70
+ : DeepImageWriter( " Writes Houdini RAT deep texture file format." ), m_outputFile( 0 ), m_ratPixel( 0 )
71
+
72
+ #else
73
+
60
74
: DeepImageWriter( " Writes Houdini RAT deep texture file format." ), m_outputFile( 0 )
75
+
76
+ #endif
77
+
61
78
{
62
79
m_fileNameParameter->setTypedValue ( fileName );
63
80
}
@@ -68,7 +85,13 @@ RATDeepImageWriter::~RATDeepImageWriter()
68
85
{
69
86
m_outputFile->close ();
70
87
}
71
-
88
+
89
+ #if UT_MAJOR_VERSION_INT >= 13
90
+
91
+ delete m_ratPixel;
92
+
93
+ #endif
94
+
72
95
delete m_outputFile;
73
96
}
74
97
@@ -105,7 +128,20 @@ void RATDeepImageWriter::doWritePixel( int x, int y, const DeepPixel *pixel )
105
128
106
129
y = m_resolutionParameter->getTypedValue ().y - y - 1 ;
107
130
131
+ #if UT_MAJOR_VERSION_INT >= 13
132
+
133
+ if ( !m_ratPixel->open ( x, y ) )
134
+ {
135
+ return ;
136
+ }
137
+
138
+ m_ratPixel->writeRawSamples ( true );
139
+
140
+ #else
141
+
108
142
m_outputFile->pixelStart ( x, y );
143
+
144
+ #endif
109
145
110
146
unsigned numChannels = pixel->numChannels ();
111
147
unsigned numSamples = pixel->numSamples ();
@@ -130,10 +166,28 @@ void RATDeepImageWriter::doWritePixel( int x, int y, const DeepPixel *pixel )
130
166
}
131
167
}
132
168
169
+ #if UT_MAJOR_VERSION_INT >= 13
170
+
171
+ m_ratPixel->writeOrdered ( pixel->getDepth ( i ), adjustedData, m_dataSize );
172
+
173
+ #else
174
+
133
175
m_outputFile->pixelWriteOrdered ( pixel->getDepth ( i ), adjustedData, m_dataSize );
176
+
177
+ #endif
178
+
134
179
}
135
180
181
+ #if UT_MAJOR_VERSION_INT >= 13
182
+
183
+ m_ratPixel->close ();
184
+
185
+ #else
186
+
136
187
m_outputFile->pixelClose ();
188
+
189
+ #endif
190
+
137
191
}
138
192
139
193
void RATDeepImageWriter::open ()
@@ -144,6 +198,13 @@ void RATDeepImageWriter::open()
144
198
return ;
145
199
}
146
200
201
+ #if UT_MAJOR_VERSION_INT >= 13
202
+
203
+ delete m_ratPixel;
204
+ m_ratPixel = 0 ;
205
+
206
+ #endif
207
+
147
208
delete m_outputFile;
148
209
m_outputFile = new IMG_DeepShadow;
149
210
m_outputFileName = " " ;
@@ -213,6 +274,8 @@ void RATDeepImageWriter::open()
213
274
214
275
#if UT_MAJOR_VERSION_INT >= 13
215
276
277
+ m_ratPixel = new IMG_DeepPixelWriter ( *m_outputFile );
278
+
216
279
UT_SharedPtr<UT_Options> options = m_outputFile->getTextureOptions ();
217
280
218
281
#else
@@ -228,6 +291,14 @@ void RATDeepImageWriter::open()
228
291
}
229
292
else
230
293
{
294
+
295
+ #if UT_MAJOR_VERSION_INT >= 13
296
+
297
+ delete m_ratPixel;
298
+ m_ratPixel = 0 ;
299
+
300
+ #endif
301
+
231
302
delete m_outputFile;
232
303
m_outputFile = 0 ;
233
304
m_outputFileName = " " ;
0 commit comments