From cdfdc9879c1d0737c837558c017086a73724b1d4 Mon Sep 17 00:00:00 2001 From: Goran Kocov Date: Thu, 1 Feb 2024 00:58:20 -0500 Subject: [PATCH] whitespace and test fixes --- python/IECoreDelightTest/RendererTest.py | 23 +++++++++++++++++++---- src/IECoreDelight/ProceduralAlgo.cpp | 18 +++++++++--------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/python/IECoreDelightTest/RendererTest.py b/python/IECoreDelightTest/RendererTest.py index 0b777aceec7..082d1851bbd 100644 --- a/python/IECoreDelightTest/RendererTest.py +++ b/python/IECoreDelightTest/RendererTest.py @@ -401,17 +401,32 @@ def testProcedural( self ) : r.object( "testProcedural", - IECoreScene.ExternalProcedural(), + IECoreScene.ExternalProcedural( + str( self.temporaryDirectory() / "testProc.nsi" ), + imath.Box3f( imath.V3f( -0.5, -0.5, -0.5 ), imath.V3f( 0.5, 0.5, 0.5 ) ), + IECore.CompoundData( { + "customParamFloat" : 1.0, + } ) + ), r.attributes( IECore.CompoundObject() ), ) r.render() del r - nsi = self.__parse( self.temporaryDirectory() / "test.nsia" ) + nsi = self.__parseDict( self.temporaryDirectory() / "test.nsia" ) + + self.assertIn( "testProcedural", nsi ) + self.assertEqual( nsi["testProcedural"]["nodeType"], "transform" ) + + procedurals = { k: v for k, v in nsi.items() if nsi[k]["nodeType"] == "procedural" } + self.assertEqual( len( procedurals ), 1 ) + + procedural = procedurals[next( iter( procedurals ) )] - self.__assertInNSI( '"procedural"', nsi ) - self.__assertInNSI( '"dynamiclibrary"', nsi ) + self.assertEqual( procedural["filename"], str( self.temporaryDirectory() / "testProc.nsi" ) ) + self.assertEqual( procedural["type"], "apistream" ) + self.assertEqual( procedural["customParamFloat"], 1.0 ) def testEnvironment( self ) : diff --git a/src/IECoreDelight/ProceduralAlgo.cpp b/src/IECoreDelight/ProceduralAlgo.cpp index e0ae8142cbf..480407efe07 100644 --- a/src/IECoreDelight/ProceduralAlgo.cpp +++ b/src/IECoreDelight/ProceduralAlgo.cpp @@ -81,17 +81,17 @@ bool convert( const IECoreScene::ExternalProcedural *object, NSIContext_t contex type = "dynamiclibrary"; } - /* 3Delight seems to behave weirdly when passed the boundingbox parameter: - doesn't render the procedural content when streaming the NSI scene initially, - yet always renders the procedural content when reading a NSI scene from disk. - Due to this commenting out the corresponding code for now. + // 3Delight seems to behave weirdly when passed the boundingbox parameter: + // doesn't render the procedural content when streaming the NSI scene initially, + // yet always renders the procedural content when reading a NSI scene from disk. + // Due to this commenting out the corresponding code for now. - const Box3f &bbox = object->getBound(); + // const Box3f &bbox = object->getBound(); - if ( bbox != Box3f( V3f( -0.5, -0.5, -0.5 ), V3f( 0.5, 0.5, 0.5 ) ) ) - { - procParameters.add( { "boundingbox", bbox.min.getValue(), NSITypePoint, 2, 1, NSIParamIsArray } ); - } */ + // if ( bbox != Box3f( V3f( -0.5, -0.5, -0.5 ), V3f( 0.5, 0.5, 0.5 ) ) ) + // { + // procParameters.add( { "boundingbox", bbox.min.getValue(), NSITypePoint, 2, 1, NSIParamIsArray } ); + // } procParameters.add( "type", type ); procParameters.add( "filename", filename );