[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50200] trunk/blender: minor code cleanup

Campbell Barton ideasman42 at gmail.com
Sat Aug 25 14:55:14 CEST 2012


Revision: 50200
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50200
Author:   campbellbarton
Date:     2012-08-25 12:55:14 +0000 (Sat, 25 Aug 2012)
Log Message:
-----------
minor code cleanup

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bpy_extras/anim_utils.py
    trunk/blender/source/blender/blenkernel/intern/object.c
    trunk/blender/source/blender/blenlib/BLI_math_rotation.h
    trunk/blender/source/blender/blenlib/intern/math_rotation.c
    trunk/blender/source/blender/python/intern/bpy_rna.c
    trunk/blender/source/blender/python/mathutils/mathutils_Euler.c
    trunk/blender/source/blender/python/mathutils/mathutils_Euler.h
    trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c

Modified: trunk/blender/release/scripts/modules/bpy_extras/anim_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_extras/anim_utils.py	2012-08-25 12:37:15 UTC (rev 50199)
+++ trunk/blender/release/scripts/modules/bpy_extras/anim_utils.py	2012-08-25 12:55:14 UTC (rev 50200)
@@ -68,7 +68,7 @@
     # Helper Functions
 
     def pose_frame_info(obj):
-        from mathutils import Matrix, Euler
+        from mathutils import Matrix
 
         info = {}
 
@@ -201,14 +201,14 @@
             elif rotation_mode == 'AXIS_ANGLE':
                 pbone.keyframe_insert("rotation_axis_angle", -1, f, name)
             else:  # euler, XYZ, ZXY etc
-                
+
                 if euler_prev is not None:
                     euler = pbone.rotation_euler.copy()
                     euler.make_compatible(euler_prev)
                     pbone.rotation_euler = euler
                     euler_prev = euler
                     del euler
-                
+
                 pbone.keyframe_insert("rotation_euler", -1, f, name)
 
                 if euler_prev is None:

Modified: trunk/blender/source/blender/blenkernel/intern/object.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/object.c	2012-08-25 12:37:15 UTC (rev 50199)
+++ trunk/blender/source/blender/blenkernel/intern/object.c	2012-08-25 12:55:14 UTC (rev 50200)
@@ -1514,7 +1514,7 @@
 			/* end drot correction */
 
 			if (use_compat) mat3_to_compatible_eulO(ob->rot, ob->rot, ob->rotmode, tmat);
-			else mat3_to_eulO(ob->rot, ob->rotmode, tmat);
+			else            mat3_to_eulO(ob->rot, ob->rotmode, tmat);
 		}
 	}
 }

Modified: trunk/blender/source/blender/blenlib/BLI_math_rotation.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_rotation.h	2012-08-25 12:37:15 UTC (rev 50199)
+++ trunk/blender/source/blender/blenlib/BLI_math_rotation.h	2012-08-25 12:55:14 UTC (rev 50200)
@@ -151,10 +151,10 @@
 void mat4_to_eulO(float eul[3], const short order, float mat[4][4]);
 void axis_angle_to_eulO(float eul[3], const short order, const float axis[3], const float angle);
 
-void mat3_to_compatible_eulO(float eul[3], float old[3], short order, float mat[3][3]);
-void mat4_to_compatible_eulO(float eul[3], float old[3], short order, float mat[4][4]);
+void mat3_to_compatible_eulO(float eul[3], float old[3], const short order, float mat[3][3]);
+void mat4_to_compatible_eulO(float eul[3], float old[3], const short order, float mat[4][4]);
 
-void rotate_eulO(float eul[3], short order, char axis, float angle);
+void rotate_eulO(float eul[3], const short order, char axis, float angle);
 
 /******************************* Dual Quaternions ****************************/
 

Modified: trunk/blender/source/blender/blenlib/intern/math_rotation.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_rotation.c	2012-08-25 12:37:15 UTC (rev 50199)
+++ trunk/blender/source/blender/blenlib/intern/math_rotation.c	2012-08-25 12:55:14 UTC (rev 50200)
@@ -1231,7 +1231,7 @@
 }
 
 /* returns two euler calculation methods, so we can pick the best */
-static void mat3_to_eulo2(float M[3][3], float *e1, float *e2, short order)
+static void mat3_to_eulo2(float M[3][3], float *e1, float *e2, const short order)
 {
 	RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
 	short i = R->axis[0], j = R->axis[1], k = R->axis[2];
@@ -1311,7 +1311,7 @@
 }
 
 /* uses 2 methods to retrieve eulers, and picks the closest */
-void mat3_to_compatible_eulO(float eul[3], float oldrot[3], short order, float mat[3][3])
+void mat3_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float mat[3][3])
 {
 	float eul1[3], eul2[3];
 	float d1, d2;
@@ -1331,7 +1331,7 @@
 		copy_v3_v3(eul, eul1);
 }
 
-void mat4_to_compatible_eulO(float eul[3], float oldrot[3], short order, float M[4][4])
+void mat4_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float M[4][4])
 {
 	float m[3][3];
 
@@ -1343,7 +1343,7 @@
 /* rotate the given euler by the given angle on the specified axis */
 // NOTE: is this safe to do with different axis orders?
 
-void rotate_eulO(float beul[3], short order, char axis, float ang)
+void rotate_eulO(float beul[3], const short order, char axis, float ang)
 {
 	float eul[3], mat1[3][3], mat2[3][3], totmat[3][3];
 

Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c	2012-08-25 12:37:15 UTC (rev 50199)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c	2012-08-25 12:55:14 UTC (rev 50200)
@@ -369,7 +369,7 @@
 
 static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop,
                                                   Py_ssize_t start, Py_ssize_t stop, Py_ssize_t length);
-static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback);
+static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, const short order_fallback);
 
 /* bpyrna vector/euler/quat callbacks */
 static unsigned char mathutils_rna_array_cb_index = -1; /* index for our callbacks */
@@ -571,7 +571,7 @@
 	NULL
 };
 
-static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback)
+static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, const short order_fallback)
 {
 	/* attempt to get order */
 	if (*prop_eul_order == NULL)

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Euler.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Euler.c	2012-08-25 12:37:15 UTC (rev 50199)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Euler.c	2012-08-25 12:55:14 UTC (rev 50200)
@@ -701,7 +701,7 @@
  * (i.e. it was allocated elsewhere by MEM_mallocN())
  * pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
  * (i.e. it must be created here with PyMEM_malloc())*/
-PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *base_type)
+PyObject *Euler_CreatePyObject(float *eul, const short order, int type, PyTypeObject *base_type)
 {
 	EulerObject *self;
 
@@ -738,7 +738,7 @@
 	return (PyObject *)self;
 }
 
-PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order,
+PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, const short order,
                                   unsigned char cb_type, unsigned char cb_subtype)
 {
 	EulerObject *self = (EulerObject *)Euler_CreatePyObject(NULL, order, Py_NEW, NULL);

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Euler.h
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Euler.h	2012-08-25 12:37:15 UTC (rev 50199)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Euler.h	2012-08-25 12:55:14 UTC (rev 50200)
@@ -48,8 +48,8 @@
  * blender (stored in blend_data). This is an either/or struct not both */
 
 //prototypes
-PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *base_type);
-PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order,
+PyObject *Euler_CreatePyObject(float *eul, const short order, int type, PyTypeObject *base_type);
+PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, const short order,
                                   unsigned char cb_type, unsigned char cb_subtype);
 
 short euler_order_from_string(const char *str, const char *error_prefix);

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c	2012-08-25 12:37:15 UTC (rev 50199)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Matrix.c	2012-08-25 12:55:14 UTC (rev 50200)
@@ -995,7 +995,7 @@
 
 	if (eul_compat) {
 		if (order == 1) mat3_to_compatible_eul(eul, eul_compatf, mat);
-		else mat3_to_compatible_eulO(eul, eul_compatf, order, mat);
+		else            mat3_to_compatible_eulO(eul, eul_compatf, order, mat);
 	}
 	else {
 		if (order == 1) mat3_to_eul(eul, mat);




More information about the Bf-blender-cvs mailing list