[Bf-python] Fwd: [pygame] BufferProxy (was Flood Filling Images)

Theo de Ridder theo.de.ridder at planet.nl
Thu Apr 17 09:04:07 CEST 2008


Toni,

thanks for the notice;

after the last Blender conference where I presented my numpy wrapping
of keyshapes I changed my buffer approach a bit to make it
robust and generic for any contiguous datastructure in Blender:
	it is now using a copy of (a slice of) of the original data
	which is copied back as a whole by a single explicit assignment;
this idea solved all the tricky lost pointer pointer problems.
can be implemented with a few lines, uses more memory but is
orders of magnitude faster than looping through individual
accesfunctions in Python;
it also fits in quite nice with my current work on remote Blender /  
python
access for debugging, profiling, tracing, testing and viewing with my
renewed glassboard publish/subscribe ambient infrastructure;

(by the way: without (event)facilities for change
propagation within the Blender DNA the new buffer protocol will
remain problematic to solve invalid pointers I supppose)

Theo


On 17 apr 2008, at 01:55, Toni Alatalo wrote:

> just noticed that there has been some update to the buffer protocol,
> which is of interest to some people here .. i don't know which will
> come sooner, or if they come at the same time: Blender using py 2.6  
> for
> other reasons, or Blender using the (old) buffer protocol (which i
> guess is the same in 2.3 - 2.5?) to get/give numpy array sypport.
> anyhow i guess that kind of locking business that is the concern in
> pygame is not an issue with the blender things..?
>
> so just for info / general interest,
>
> ~Toni
>
> Begin forwarded message:
>
>> From: "René Dudfield" <renesd at gmail.com>
>> Date: April 17, 2008 2:20:56 AM EEST
>> To: pygame-users at seul.org
>> Subject: Re: [pygame] BufferProxy (was Flood Filling Images)
>> Reply-To: pygame-users at seul.org
>>
>> hi,
>>
>> I'm pretty sure they are back porting it to python 2.6.
>>
>> "It is intended that this PEP will be back-ported to Python 2.6 by
>> adding the C-API and the two functions to the existing buffer
>> protocol."
>>    -- http://www.python.org/dev/peps/pep-3118/#issues-and-details
>>
>>
>>
>> On Thu, Apr 17, 2008 at 5:04 AM, Lenard Lindstrom <len-l at telus.net>
>> wrote:
>>> Greg Ewing wrote:
>>>
>>>> René Dudfield wrote:
>>>>
>>>>
>>>>
>>>>> [G]etting a buffer proxy helps with surface locking semantics.
>>>>>
>>>>> When you get a BufferProxy the surface is locked (which you need  
>>>>> to
>>>>> do
>>>>> when you are modifying Surface->pixels - when the BufferProxy is
>>>>> destroyed, the surface lock is released.
>>>>>
>>>>
>>>>
>>>> That's a good reason. Although the new buffer protocol
>>>> has locking facilities built in, so it wouldn't strictly
>>>> be needed then.
>>>>
>>>>
>>> The new buffer protocol is for Python 3.0. I believe it breaks
>>> things so
>>> will ever be available for the 2.x series.
>>>
>>>
>>>
>>> --
>>> Lenard Lindstrom
>>> <len-l at telus.net>
>>>
>>>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python




More information about the Bf-python mailing list