When using a custom multiview setup with many cameras to render, how can the views be accessed via Python? While I can access the individual views in the UI, I have not found a way to access them through the Python API.
There is no Python API access yet for multiview or multilayer images as far as I know.
How difficult would it be to add it for 2.8? I could try to put a hand at it myself…
Depends what you want to do with it exactly. To make a really complete and clean API is quite a bit of work.
If you just want to read the pixels from a multiview render it may not be so complicated, since the RenderResult
data structure that contains this is already wrapped for the render API.
It’s the latter thing I am after, just read the pixels/images
Here is the usecase: https://github.com/Looking-Glass/blenderLKG/issues/11
The Looking Glass device uses 45 individual views. It renders using Blender’s multiview system, but in order to view a rendered image, in the addon the image files for each are getting parsed via Python and then it replaces the filepath of a datablock, loads the image, runs gl_load() and then copies the result to a texture loaded in memory.
I’d rather load an image using the multiview system and run gl_load() on the individual views because I think that is a more Blenderish way and hope that would integrate nicely with Blender’s caching.
They ways to access the views should work somewhat like:
bpy.data.images[‘yourimage’].views[x].gl_load()
So it should work just like accessing images…
I think it makes more sense to just run gl_load()
in the image itself and expect all the views to be updated. What is blocking here? Performance?
Is there a way to access the views of an image after gl_load() ? That would help tremendously.
I don’t think so. But it is reasonable to have and I would approve said design if someone can come up with a patch for this.
And just to clarify, what you need is to access the views the same way you access the images, right? Which part of the API is needed there?
Yes, I want to access the views the same way as I would images.
Currently I load each view individually as an image, then I do
image.gl_load()
image.bindcode
[…]