[Bf-committers] Numpy integration

Campbell Barton ideasman42 at gmail.com
Mon Apr 23 13:02:40 CEST 2012


For people reading this who aren't so familier with blender/python
module stuff - you can use numpy (or any py module) with blender now,
its just a hassle if you want to re-distribute your scripts for others
to use, you need to instruct them on how to include the module or
bundle blender with it yourself.
for many python modules I would not want to bundle them but numpy is
quite a popular math library for python.

Though I never used numpy seriously (extending mathutils instead) but
there are many things numpy can do that mathutils will never be able
to do (and wouldn't want it to do).


a few things we need to consider / agree on...
- how does this fit with mathutils? (IMHO its fairly clear - mathutils
is graphics oriented, numpy is for people who need multi-dim matrices
and more advanced functionality, mathutils is integrated with
bpy/bmesh/bge, numpy stays as an added extra you can use if you need
it).
--  core blender scripts can stay with mathutils unless they really
need to use numpy.
-- addons are free to use numpy.
- blender should not depend on numpy (at least to begin with, numpy
has headers we could include and integrate with it- but for now I
prefer have it as optional for py devs).
- download size - managed to get it down to 1.1mb compresed. 4.3m
uncompressed (64bit Linux). don't think this is too bad.
- numpy would be pre-compiled as python is now for osx and windows,
for linux it can copy from the systems installation.
- when to do this ? (think we could have it by 2.64)
- who does this? - we need people to build on all platforms, after
that theres no much to it (just extract ).

+1 from me.

On Mon, Apr 23, 2012 at 7:37 PM,  <mgschwan at blensor.org> wrote:
> Hi,
>
> I was talking to Campbell about integrating this patch
>
> http://projects.blender.org/tracker/?func=detail&atid=127&aid=30908&group_id=9
>
> which would expose several matrix solvers from the Eigen3 library
> (included with blender) to python.
>
>
> The question came up if it would be better to integrate numpy istead.
>
> First of all why would this be good/needed:
>
> I can't speak for everyone but having the least squares solvers
> available within
> Blenders python interface would be quite nice for plane fitting, camera
> calibration, ...,
> and in my case the mesh alignment
> (http://www.youtube.com/watch?v=LvF3ydZTzvM and
> http://www.blensor.org/misc/media/videos/align_vertex.mkv)
>
> Campbell asked me to check on how much this would add to blender,
> and thats where it gets bad:
>
> Even if all testing modules are removed from numpy it still clocks in
> at ~12MB (bzip2 compressed ~3.7MB) which is not what one would call
> lightweight :)
>
> So I ask everyone that needs it to comment on one of the three possible
> solutions:
>
> 1. Include a stripped numpy version, which will add ~3.7MB to the
> Blender download
> 2. Use the above mentioned patch to expose some of the Eigen3
> functionality that is
>    shipped with Blender anyway
> 3. Don't care, don't need
>
> I also would call to those devs who need numpy for other reasons, since
> it is also
> good for performance hungry computations.
>
> Best regards
> Michael
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers



-- 
- Campbell


More information about the Bf-committers mailing list