[Bf-python] mathutil PyNumberMethods behaving badly

Ken Hughes khughes at pacific.edu
Thu Jul 20 20:28:34 CEST 2006


Cam discovered a problem in the mathutils with expressions like this:

me = Mesh.Get('Cube')
x = -me.verts[0].co
print x
print me.verts[0].co

You get this:

[-0.565980, -1.386673, 0.000000](vector)
[-0.565980, -1.386673, 0.000000](vector)

Joseph put in code which modifies the original object, since script 
users wanted to concatenate operations, but I don't think we really want 
to this with math operations (i.e., PyNumberMethods).

Seems to me we need two type of operations in mathutils: one modify the 
original data and return it and ones that don't (now on three: 1, 2, 3, 
"Duh").  Obviously the math operations shouldn't do this, but looks like 
we need to "un-deprecate" some of the original methods like vector.negate()

Ken



More information about the Bf-python mailing list