View Port Access

(aayers) #1

Is it possible to access 3DWindow properties from python script?

For example, I’d like to ,

  1. Load Screens
  2. Change the method of drawing objects (wireframe, solid, boxes) of a view port.
  3. Switch the Camera Mode and Perspective Mode of a view port.

Let me know if this is possible using the Blender or Blender210 modules?


(theeth) #2

it’s not possible :frowning:


(aayers) #3

Hi again,

I found a way to change the draw type method (wire frame, OpenGL solid, etc… ) for a view port. The Blender210 module gives us this capability.


Python> import Blender210 as B210
Python> D = B210.getDisplaySettings()
Python> print D.setDrawType.__doc__
DisplaySettings.setDrawType(self, mode)
                 In Blender you can set the draw type for objects
                 Individually (ZKEY, SHIFT+ZKEY, or ALT+ZKEY) or for the
                 Whole 3D window (DKEY). This function allows you to do the
                 Same within Python (mode 1 = bounding box, 2 = wireframe,
                 3 = solid, 4 = shaded solid, 5 = textured).

Now, it would be great if I could control in which view ports these changes occur. Any insight?


(aayers) #4

For anyone who has experience with OpenGL or building Blender GUIs,

My objective is to select a view port from script.

This might be accomplished by “fooling” Blender into believing that my mouse pointer floats above a certain view port. I’ve come up with some ideas and would like some opinion or insight regarding their feasibility.

  1. Use functions from the Blender.Draw module to emulate mouse motion? (We use Register() to handle input events, can we do the opposite?)

  2. Use OpenGL commands from Blender.BGL to select a viewport.
    (Blender.BGL.glViewport specifies characteristics of a viewport, is there an OpenGL command to select a viewport?)

  3. Use a python module to enter an ascii character into the keyboard buffer - or somthing to signal the computer that a key has been pressed without actually pressing the key itself.

I’m currently investigating these possibilities, but my experience in OpenGL is rather scarce. Any help, tips, links to OpenGL would also be appreciated.

Thank you,