Page 1 of 1

Python access to GUI limits/possible workarounds?

Posted: Wed Nov 16, 2005 7:51 am
by Duoas
I was trying to write a python script that used the Video Sequence Editor (which methinks is not likely to happen now...)

One thing I was trying to do is just to change the current area to the Sequence Editor. You can do this by hand by pressing Shift+F8, but using something like:

Code: Select all

area = Window.GetAreaID()
Window.SetKeyQualifiers( Window.Qual.SHIFT )
Window.QAdd( area, F8KEY, 1 )
Window.QAdd( area, F8KEY, 0 )
Window.SetKeyQualifiers( 0 )
...
Window.QHandle( area )
(and variations) doesn't want to work. The only workaround would be to 1) check to see if the VSE is already open in the current screen, 2) check to see if the screen '4-Sequencer' is available and change to it, 3) give up and complain to the user...

(But, of course, once I get to the sequencer options are limited anyway...)


My question is this: currently python scripting in Blender seems a bit disconnected. Are there any plans to integrate it more tightly? (And/Or is there a way to do what I want above?)

Thanks for any help...

Posted: Wed Nov 16, 2005 5:10 pm
by an-toni
the strategy has been to use Blender via Python directly, not as via the GUI. perhaps in the future the GUI is written in Python using the API :)

so to use the sequence editor, the way would be to add a Sequencer module to bpy, and add the required object types and functions there.

what would you need from it? something like:

from Blender import Sequencer

clip1 = Sequencer.add("myvideo.avi")
clip1.start = 10
clip1.end = 146
(and then add an effect somehow?)

or what?

~Toni

Posted: Wed Nov 16, 2005 10:04 pm
by Duoas
Yes, that's pretty much it. I figured that greater access to the sequencer would require writing a python interface module (which I don't currently have time for...)...

Even so, there's currently no way to access a lot of internals. Say, for example, you want to get or set the 'subsurf' flag for a particular mesh. (Not so weird a thing: a number of extant scripts would benefit from that ability.)


Oh well... for now my project has been put on hold so we'll see what happens later...

Posted: Wed Nov 16, 2005 10:30 pm
by LetterRip
subsurf flag was accessible in 2.37a and prior, subsurf has become a modifier and so we need to change the interface.

LetterRip

Posted: Wed Nov 16, 2005 11:12 pm
by Duoas
Heh, so it is. I've looked over that one a zillion times and never seen it... :oops: