I'm trying to make a simple WYSIWYG viewer addon for 3D objects in blender and I want to match the output of the camera to the view in the window so it's easy to position the object for rendering.
For simplicity I want to use only the orthographic view. So what I need is to set the orthographic scale to the same value that what it's currently used in the 3D view and set the resolution in a way that it matches up with the current aspect ratio. If I also set the camera to current view it should match up.
But I cannot figure out how to get the current aspect ratio of the 3D view and the current orthographic scale.
Is this possible? If so what what are the objects for those values?
And would there be a similar way to do this using the perspective view and camera?
Thanks a lot