[Bf-python] Key/KeyBlock API bug?

Ken Hughes khughes at pacific.edu
Sat Nov 26 19:57:45 CET 2005


I started to fix a bug from the tracker related to the Keys module, but 
after staring at the BPy code and blender keys code I need a fresh set 
of brains to make sure I understand what I'm seeing.

The keyblock.getData() method is supposed to return one of three data 
types, depending on the key type: and NMVert for mesh data, a BezTriple 
for a curve, and a BPoint (four floats) for lattices.  After looking 
through the key code, though, I *think* I see two problems:

(1) lattices store 3 floats for the x/y/z coordinates of the lattice 
points, but getData() is reading 4 floats (see key_to_latt() function)
(2) curves can be NURBS or Bezier, so you can't just return BezTriples 
(look at key_to_curve() function, for example)

The first would be easy to fix, but the second not so much.  I can't see 
anything in the key structure which differentiates NURBS and Bezier; it 
seems it's based on the curve data itself (again see key_to_curve()). 
So it looks like we need to search the list of curves to see who is 
linked to that key to know how to interpret the data.

Ken



More information about the Bf-python mailing list