Script Window Height when using GUI and Parent Order

Hi Everyone,

I am starting to add a GUI to my export script, does anyone know how to get the height of the script window, so I can invert the Y coordinate to start from the top rather than the bottom.

Is there also a way to get the order in which objects were parented to another object. What I want to get is the first object parented then the second and so on…

Thanks

Chris

To get the height of the script window:


from Blender.BGL import *

vp = Buffer(GL_FLOAT, 4)
glGetFloatv(GL_VIEWPORT, vp) #can also use GL_SCISSOR_BOX

The result vp contains the window x, y location in vp[0], vp[1]. And the window width and height in vp[2], vp[3].

Example to get parent objects, old API:


ob= Blender.Object.Get(name)
while ob.parent:
    print ob.name, "child of", ob.parent.name
    ob = ob.parent

new API:


ob = Blender.Object.get(name)
pr = ob.getParent()
while pr
    print ob.name, "child of:", pr.name
    ob = pr
    pr = ob.getParent()

Is there a difference between GL_VIEWPORT and GL_SCISSOR_BOX?

Martin

No, both return the same result.
btw, both actually return integer values (not that the above example was wrong):


from Blender.BGL import * 

vp = Buffer(GL_INT, 4) 
glGetIntegerv(GL_VIEWPORT, vp)

Thanks Guys,

The script window stuff helps me a lot.

I was able to get the parent information, what I am trying to get is the order in which that were parented to the parent object. I don’t believe that this is possible.

Thanks

Chris