[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11257] branches/2-44-stable/blender/ source/blender/python/api2_2x/Draw.c: bugfix

Joe Eagar joeedh at gmail.com
Fri Jul 13 00:44:26 CEST 2007


Campbell Barton wrote:
> Revision: 11257
>           http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11257
> Author:   campbellbarton
> Date:     2007-07-12 22:14:16 +0200 (Thu, 12 Jul 2007)
>
> Log Message:
> -----------
> bugfix
> * sliders with realtime option enabled did not have the correct event offset. (probably my fault when adding UIBlock/callbacks)
> * callbacks could crash if they were free'd before the script ran them,
>   solved this by using weakrefs to the python function rather then the function its self in the buttons callback value.
>   Also store a list these weakref's in the Draw module's C file that are removed when the callback function is deallocated by python
>   (using pythons own weakref callback) - if the weakref is not in the weakref callback list then we know it has been deallocated and can report an error that it needs to be made global.
>
> Tested this to work in UIBlock and normal button drawing.
>   
> Some other small cleanup also.
>   
It'd kindof be nice if callbacks would be forced global by the API.  I 
did this a while back for pyconstraints (in fact I was going to send it 
to you, but I've been excruciatingly tired the last week) and it seemed 
to work pretty well.

I'll attach the raw relavent files I had.  Basically callbacks and 
button objects are stored in a list attached per spacetype, and this 
list is cleared before each draw event.  Also tooltips are stored in 
button objects onw.  Unfortunately I'm way too tired to update it for 
current svn (I have to keep up on GSoC), so um this might be less then 
useful in its current state.

Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-committers/attachments/20070712/5a37a708/attachment-0001.htm 


More information about the Bf-committers mailing list