[#18678] Swizzle properties for Mathutils.Vector

patch from Alex Fraser (z0r)

eg.
  - vec.xyz = vec.zyx
  - vec.xy = vec.zw
  - vec.xxy = vec.wzz
  - vec.yzyz = vec.yxyx

See http://en.wikipedia.org/wiki/Swizzling_(computer_graphics)

made some minor modifications to this patch.

tested access times and adding 336 attributes to vectors doesn't make a noticeable differences to speed of existing axis attributes (x,y,z,w) - thanks to python dict lookups.
This commit is contained in:
2009-05-03 17:52:03 +00:00
parent 03a0770df5
commit 8a83aff9f5
7 changed files with 347 additions and 7 deletions

View File

@@ -43,6 +43,10 @@ typedef struct {
short wrapped; /* is wrapped data? */
} VectorObject;
void Vector_Free(void);
int Vector_Init(void);
/*prototypes*/
PyObject *Vector_Zero( VectorObject * self );
PyObject *Vector_Normalize( VectorObject * self );