[Bf-python] FW: [Bf-blender-cvs] CVS commit: blender/source/blender/python/api2_2xObject.c

Ken Hughes khughes at pacific.edu
Thu Nov 3 16:39:05 CET 2005


Gilbert, Joseph wrote:

> This was part of the mathutils update and in response to the
> vector_proxy issue. However, it seems that this has generated a bit of
> confusion. We need to label in the documentation which methods return
> WRAP'ed data (i.e. give thin access) and what does not. Even then script
> writers will still do x = y by mistake and not realize why that have to
> reinvert a matrix for instance.

It's not just here, it's in a number of places.  For example, NMesh, 
Mesh and Object deal with a list of materials instead of a sequence 
operator; the individual Material objects are wrapped but the list 
isn't.  So to assign new materials, you have to assign the whole list, 
not just a single material:

    matlist = obj.materials
    obj.materials = [matlist[0],matlist[1],mat2]

instead of
    obj.materials[2]=mat2

The problem is we would also need to implement a bunch of new sequence 
operators for these types, and there may not be any guarantee that the 
way Blender internally represents one type is the same as another (could 
use array in one case, linked list in another).

Ken



More information about the Bf-python mailing list