Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-06-25 14:11:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-06-25 14:11:37 +0400
commitd428ba1de8074e8b0ca2b7c0b060c18ebf7d6b0c (patch)
tree0200656374d9d08125eba99ecc009ca3e70cc7fb /source/blender/python/generic/Mathutils.h
parent7a357cba3994bee7d05c7a8bf5736eb94067d564 (diff)
PyAPI RNA/BGE
* all mathutils types now have optional callbacks * PyRNA returns mathutils quat and euler types automatically when they have the rotation subtype. * PyRNA, reuse the BPy_StructRNA PyObject rather name making a new one for each function returned. * use more arithb.c functions for Mathutils quaternion type (less inline cruft). * BGE Mathutils integration mostly finished- KX_PyMath now converts to Mathutils types rather then lists. * make all mathutils types share the same header so they can share a number of functions - dealloc, getWrapped, getOwner.
Diffstat (limited to 'source/blender/python/generic/Mathutils.h')
-rw-r--r--source/blender/python/generic/Mathutils.h41
1 files changed, 26 insertions, 15 deletions
diff --git a/source/blender/python/generic/Mathutils.h b/source/blender/python/generic/Mathutils.h
index a89b779ecbb..d234ebf1452 100644
--- a/source/blender/python/generic/Mathutils.h
+++ b/source/blender/python/generic/Mathutils.h
@@ -38,6 +38,24 @@
#include "quat.h"
#include "euler.h"
+/* Can cast different mathutils types to this, use for generic funcs */
+
+typedef struct {
+ PyObject_VAR_HEAD
+ float *data; /*array of data (alias), wrapped status depends on wrapped status */
+ PyObject *cb_user; /* if this vector references another object, otherwise NULL, *Note* this owns its reference */
+ unsigned char cb_type; /* which user funcs do we adhere to, RNA, GameObject, etc */
+ unsigned char cb_subtype; /* subtype: location, rotation... to avoid defining many new functions for every attribute of the same type */
+ unsigned char wrapped; /* wrapped data type? */
+} BaseMathObject;
+
+PyObject *BaseMathObject_getOwner( BaseMathObject * self, void * );
+PyObject *BaseMathObject_getWrapped( BaseMathObject *self, void * );
+void BaseMathObject_dealloc(BaseMathObject * self);
+
+
+
+
PyObject *Mathutils_Init( const char * from );
PyObject *quat_rotation(PyObject *arg1, PyObject *arg2);
@@ -75,22 +93,15 @@ struct Mathutils_Callback {
int Mathutils_RegisterCallback(Mathutils_Callback *cb);
-int _Vector_ReadCallback(VectorObject *self);
-int _Vector_WriteCallback(VectorObject *self);
-int _Vector_ReadIndexCallback(VectorObject *self, int index);
-int _Vector_WriteIndexCallback(VectorObject *self, int index);
+int _BaseMathObject_ReadCallback(BaseMathObject *self);
+int _BaseMathObject_WriteCallback(BaseMathObject *self);
+int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index);
+int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index);
/* since this is called so often avoid where possible */
-#define Vector_ReadCallback(_self) (((_self)->cb_user ? _Vector_ReadCallback(_self):1))
-#define Vector_WriteCallback(_self) (((_self)->cb_user ?_Vector_WriteCallback(_self):1))
-#define Vector_ReadIndexCallback(_self, _index) (((_self)->cb_user ? _Vector_ReadIndexCallback(_self, _index):1))
-#define Vector_WriteIndexCallback(_self, _index) (((_self)->cb_user ? _Vector_WriteIndexCallback(_self, _index):1))
-
-
-int _Matrix_ReadCallback(MatrixObject *self);
-int _Matrix_WriteCallback(MatrixObject *self);
-
-#define Matrix_ReadCallback(_self) (((_self)->cb_user ?_Matrix_ReadCallback(_self):1))
-#define Matrix_WriteCallback(_self) (((_self)->cb_user ?_Matrix_WriteCallback(_self):1))
+#define BaseMath_ReadCallback(_self) (((_self)->cb_user ? _BaseMathObject_ReadCallback((BaseMathObject *)_self):1))
+#define BaseMath_WriteCallback(_self) (((_self)->cb_user ?_BaseMathObject_WriteCallback((BaseMathObject *)_self):1))
+#define BaseMath_ReadIndexCallback(_self, _index) (((_self)->cb_user ? _BaseMathObject_ReadIndexCallback((BaseMathObject *)_self, _index):1))
+#define BaseMath_WriteIndexCallback(_self, _index) (((_self)->cb_user ? _BaseMathObject_WriteIndexCallback((BaseMathObject *)_self, _index):1))
#endif /* EXPP_Mathutils_H */