def _callback(x, y, width, height, buffer, data): #print("+++ _callback:", x, y, width, height, ctypes.cast(buffer, ctypes.c_void_p)) if buffer: try: if new_data.poll(): arnold.AiRenderInterrupt() else: #print("+++ _callback: tile", x, y, width, height) _buffer = ctypes.cast(buffer, ctypes.POINTER(ctypes.c_ubyte)) a = numpy.ctypeslib.as_array(_buffer, shape=(height, width, 4)) rect[y:y + height, x:x + width] = a redraw_event.set() return finally: arnold.AiFree(buffer) elif not new_data.poll(): return arnold.AiRenderAbort()
def free_buffer(self, buffer): arnold.AiFree(buffer)