def testEmptyProceduralIsIgnored(self): class EmptyProcedural(IECore.Renderer.Procedural): def __init__(self): IECore.Renderer.Procedural.__init__(self) def bound(self): return IECore.Box3f() def render(self, renderer): pass def hash(self): h = IECore.MurmurHash() return h r = IECoreArnold.Renderer() r.display("test", "ieDisplay", "rgba", { "driverType": "ImageDisplayDriver", "handle": "testHandle" }) messageCallback = arnold.AtMsgCallBack(self.arnoldMessageCallback) arnold.AiMsgSetCallback(messageCallback) self.__arnoldMessages = "" with IECore.WorldBlock(r): r.procedural(EmptyProcedural()) self.failIf("ignoring parameter max" in self.__arnoldMessages)
def testProceduralsShareInstances(self): class PlaneProcedural(IECore.Renderer.Procedural): def __init__(self): IECore.Renderer.Procedural.__init__(self) def bound(self): return IECore.Box3f(IECore.V3f(-10, -10, -0.01), IECore.V3f(10, 10, 0.01)) def render(self, renderer): IECore.MeshPrimitive.createPlane( IECore.Box2f(IECore.V2f(-10), IECore.V2f(10))).render(renderer) def hash(self): h = IECore.MurmurHash() return h def arnoldMessageCallback(logMask, severity, msg, tabs): self.__arnoldMessages.append(msg) r = IECoreArnold.Renderer() r.display("test", "driver_null", "rgba", {}) messageCallback = arnold.AtMsgCallBack(arnoldMessageCallback) arnold.AiMsgSetCallback(messageCallback) self.__arnoldMessages = [] with IECore.WorldBlock(r): r.concatTransform( IECore.M44f.createTranslated(IECore.V3f(0, 0, -5))) for i in range(0, 100): r.procedural(PlaneProcedural()) # we can't check for the existence of ginstances by examining the nodes after rendering, # because it seems that after rendering, arnold reports the type of ginstances # as being the type of the thing they point to, rather than "ginstance". so instead we # check for evidence in the log. polyMeshStats = [ m for m in self.__arnoldMessages if m.startswith("polymeshes") ][0] self.failUnless("99" in polyMeshStats) # check that there are no bounding box warnings boundingBoxWarnings = [ m for m in self.__arnoldMessages if "bounding box" in m ] self.assertEqual(len(boundingBoxWarnings), 0)
def testTransformingProceduralBounds( self ) : r = IECoreArnold.Renderer() messageCallback = arnold.AtMsgCallBack( self.arnoldMessageCallback ) arnold.AiMsgSetCallback( messageCallback ) self.__arnoldMessages = "" r.display( "test", "ieDisplay", "rgba", { "driverType" : "ImageDisplayDriver", "handle" : "testHandle" } ) with IECore.WorldBlock( r ) : r.procedural( self.TransformingProcedural( IECore.M44f.createTranslated( IECore.V3f( 0, 0, -5 ) ), self.SphereProcedural() ) ) self.failIf( "incorrect user bounds" in self.__arnoldMessages )