[Bf-python] event ID questions (long post - sorry)

Thomas Bleicher tbleicher at arcor.de
Wed Aug 3 15:31:23 CEST 2005


Hello everyone.

I'm new to the list and from reading the archive I hope I've finally
found the right place to ask my questions.

I'm working on some kind of general export interface and try to make
it as good and instructive for others as I can. It's getting more and
more complex and I fear I'll have to review its design from the start
soon. To Make It Right(tm) this time I hope to find some information
about how things are supposed to work in BPY.

BTW: Download and Screenshots of a first release are available here
for those who are interested in exporters:

    http://home.arcor.de/tbleicher/exif/index.html


Now the questions:


1) I have up to 80 buttons to create at one time. This is no problem
   but I don't know where to find a large enough range of IDs for
   these buttons that's not already used for other signals (ie.
   event 8 was generated when a menu button was left _without_ changing
   its value).
   If there is no continuous range where can I find events which are
   already assigned to something? Other toolkits offer a way to
   generate/access the next usable ID; for example wxWindows:
   
        id = newId() # iirc; haven't used it for some time
    
   Would this be possible/a good idea for BPY?


2) If my feeble grasp on the Draw process is right, I "register"
   three functions for drawing and event processing:

        Draw.Register(myDrawFunc, myEvtFunc, myButtonEvtFunc)
   
   If "myEvtFunc" and "myButtonEvtFunc" contain a call to Draw.Redraw()
   this will result in a redraw of the interface elements with every
   event like ie. a mouse move.

   Currently I do all my stuff to create the interface within
   "myDrawFunc" which causes noticeable response problems when time
   consuming calculations have to be done (display lists do help but
   they have to be generated first which takes it's time as well).
   
   Is there an easy way to solve this situation? GUIs use seperate
   threads for drawing and updating their interfaces, so the drawing
   has always something to show. I tried to import the threading module
   but couldn't make it work and I'd prefer to stay with the Blender
   tools if possible.


3) Window.FileSelector() accepts a class method since 2.37. I could only
   make this work with methods of the same class that defines "myDrawFunc"
   etc. as its methods; ie. the toplevel class of the interface.
   
   I need to access a FileSelector window in other classes as well. The
   sequence roughly looks like this:
   
   Interface.myButtonEvtFunc()
   | 
   +-> calls SubPage.ButtonEvent()
             |
             +-> calls SubSubPage.ButtonEvent()
                       |
                       +-> where Window.FileSelecter()  is called (but
                                                        does not appear)
                                                       
                       SubSubPage.ButtonEvent()  now returns to
                       |
                       v   
             SubPage.ButtonEvent()  which returns to
             |
             v
   Interface.myButtonEvtFunc()  where Draw.Redraw() is called which would
                                be needed for the FileSelector.
                           
   At least this is the conclusion from my experience and experiments
   with the FileSelector. If anyone has a nice solution for me I'd be
   glad to hear it. My workaround would be to set the filename in the 
   Interface class and pass it down to the sublevel classes - looks ugly
   to me, though.
   

4) Small one: I start Blender in xterm to see some log messages I
   generate. Blender produces it's own output to STDERR which contains
   binary sequences that sooner or later mess up xterm. I can redirect
   STDERR to /dev/null in Linux and get rid of the problem. But this
   redirects deprecation warnings as well and doesn't help on Windows.

   Why does Blender produce this output and can I get rid of it in
   a clean way? I use the 2.37 binary tar balls from the download
   page; no CVS or distribution packages.


5) Even shorter one: If I'll ever get things right I'd like to document
   these concepts in short exaples which I miss in the API documentation.
   Could these be included in the docs and how could I help with it?


These are the itches I need to scratch now. Thanks to those who are still
with me and sorry for the long post. I hope I could explain my problems.


Thomas


PS: I learned from the list archive that a new design overhaul is
    imminent. I'd like to share my experince with the BPy API from
    the point of view of a somewhat experienced Python user if there
    is still need to discuss this.




   
   



More information about the Bf-python mailing list