Skip to content

Commit d564b2b

Browse files
committed
Fixing IMG_DeepShadow interface changes
1 parent 1e038b9 commit d564b2b

File tree

2 files changed

+62
-3
lines changed

2 files changed

+62
-3
lines changed

src/IECoreHoudini/RATDeepImageReader.cpp

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
#include "UT/UT_Matrix.h"
3838
#include "UT/UT_Options.h"
39+
#include "UT/UT_Version.h"
3940

4041
#include "IECore/FileNameParameter.h"
4142

@@ -76,9 +77,18 @@ RATDeepImageReader::~RATDeepImageReader()
7677
bool RATDeepImageReader::canRead( const std::string &fileName )
7778
{
7879
IMG_DeepShadow file;
79-
80+
81+
#if UT_MAJOR_VERSION_INT >= 13
82+
83+
if ( file.open( fileName.c_str() ) && file.getDepthInterp() == IMG_DI_DISCRETE )
84+
85+
#else
86+
8087
if ( file.open( fileName.c_str() ) && file.depthInterp() == IMG_COMPRESS_DISCRETE )
88+
89+
#endif
8190
{
91+
file.close();
8292
return true;
8393
}
8494

@@ -188,7 +198,16 @@ bool RATDeepImageReader::open( bool throwOnFailure )
188198
m_worldToNDC = Imath::M44f();
189199

190200
bool success = true;
201+
202+
#if UT_MAJOR_VERSION_INT >= 13
203+
204+
if ( m_inputFile->open( fileName().c_str() ) && m_inputFile->getDepthInterp() == IMG_DI_DISCRETE )
205+
206+
#else
207+
191208
if ( m_inputFile->open( fileName().c_str() ) && m_inputFile->depthInterp() == IMG_COMPRESS_DISCRETE )
209+
210+
#endif
192211
{
193212
m_inputFileName = fileName();
194213
m_ratPixel = new IMG_DeepPixelReader( *m_inputFile );
@@ -244,7 +263,17 @@ bool RATDeepImageReader::open( bool throwOnFailure )
244263
// applying a matrix that seems to fix the issues in several examples
245264
Imath::M44f fix;
246265
fix.makeIdentity();
266+
267+
#if UT_MAJOR_VERSION_INT >= 13
268+
269+
UT_SharedPtr<UT_Options> options = m_inputFile->getTextureOptions();
270+
271+
#else
272+
247273
UT_Options *options = m_inputFile->getTBFOptions();
274+
275+
#endif
276+
248277
if ( options->hasOption( "camera:clip" ) )
249278
{
250279
const UT_Vector2D clip = options->getOptionV2( "camera:clip" );

src/IECoreHoudini/RATDeepImageWriter.cpp

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
#include "UT/UT_Matrix.h"
3838
#include "UT/UT_Options.h"
39+
#include "UT/UT_Version.h"
3940

4041
#include "IECore/CompoundParameter.h"
4142
#include "IECore/FileNameParameter.h"
@@ -73,7 +74,17 @@ RATDeepImageWriter::~RATDeepImageWriter()
7374

7475
bool RATDeepImageWriter::canWrite( const std::string &fileName )
7576
{
77+
78+
#if UT_MAJOR_VERSION_INT >= 13
79+
80+
return IMG_DeepShadow().create( fileName.c_str(), 2, 2 );
81+
82+
#else
83+
7684
return IMG_DeepShadow().open( fileName.c_str(), 2, 2 );
85+
86+
#endif
87+
7788
}
7889

7990
void RATDeepImageWriter::doWritePixel( int x, int y, const DeepPixel *pixel )
@@ -186,12 +197,31 @@ void RATDeepImageWriter::open()
186197

187198
const Imath::V2i &resolution = m_resolutionParameter->getTypedValue();
188199

189-
if ( m_outputFile->open( fileName().c_str(), resolution.x, resolution.y ) )
200+
#if UT_MAJOR_VERSION_INT >= 13
201+
202+
bool success = m_outputFile->create( fileName().c_str(), resolution.x, resolution.y );
203+
204+
#else
205+
206+
bool success = m_outputFile->open( fileName().c_str(), resolution.x, resolution.y );
207+
208+
#endif
209+
210+
if ( success )
190211
{
191212
m_outputFileName = fileName();
192213

193-
// set the worldToCamera matrix
214+
#if UT_MAJOR_VERSION_INT >= 13
215+
216+
UT_SharedPtr<UT_Options> options = m_outputFile->getTextureOptions();
217+
218+
#else
219+
194220
UT_Options *options = m_outputFile->getTBFOptions();
221+
222+
#endif
223+
224+
// set the worldToCamera matrix
195225
options->setOptionM4( "space:world", IECore::convert<UT_Matrix4>( worldToCameraParameter()->getTypedValue() ) );
196226

197227
/// \todo: set the cameraToNDC parameters

0 commit comments

Comments
 (0)