Skip to content

Commit

Permalink
whitespace and test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gkocov committed Feb 1, 2024
1 parent b5ade1c commit cdfdc98
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
23 changes: 19 additions & 4 deletions python/IECoreDelightTest/RendererTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) :

Expand Down
18 changes: 9 additions & 9 deletions src/IECoreDelight/ProceduralAlgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit cdfdc98

Please sign in to comment.