Deriving from Integrator class in Python #1560
-
Hi I'm trying to create a custom integrator in Python that derives from the Integrator class directly (not from Sampling Integrator). class MyIntegrator(mi.Integrator):
def __init__(self, props):
#mi.Integrator.__init__(self, props)
pass
def aov_names(self):
return []
def should_stop(self):
return False
def render(self, scene, sensor, seed=0, spp=0, develop=True, evaluate=True):
no_channels = sensor.m_film.base_channels_count()
size = sensor.m_film.size()
ret = dr.TensorXf(shape=(size.x, size.y, no_channels))
return ret
def cancel(self):
print("Bye!")
mi.register_integrator("myintegrator", lambda props: MyIntegrator(props))
test = mi.load_dict({'type' : 'myintegrator'}) The issue is that I cannot use the
Can I derive from the Integrator class directly, and if so, how can I make it work? Do I have to call some |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello @mkloczko-tango, As far as I know, you can only inherit from the classes for which trampoline classes have been bound, i.e. mitsuba3/src/render/python/integrator_v.cpp Line 308 in 95ff1c1 mitsuba3/src/render/python/integrator_v.cpp Line 375 in 95ff1c1 |
Beta Was this translation helpful? Give feedback.
Hello @mkloczko-tango,
As far as I know, you can only inherit from the classes for which trampoline classes have been bound, i.e.
SamplingIntegrator
andAdjointIntegrator
:mitsuba3/src/render/python/integrator_v.cpp
Line 308 in 95ff1c1
mitsuba3/src/render/python/integrator_v.cpp
Line 375 in 95ff1c1