diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-21 00:20:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-21 00:20:02 +0400 |
commit | c56a911cd966d4103b2c13903548dfe97b04742b (patch) | |
tree | defc49c9fbc7371b892bc7d7bc9a27aa9227b984 /source/blender/python/mathutils | |
parent | 80d3423b00583195c94d24aacfa7d841f6a581f7 (diff) |
style cleanup: comments
Diffstat (limited to 'source/blender/python/mathutils')
-rw-r--r-- | source/blender/python/mathutils/mathutils.c | 4 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Color.c | 138 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Color.h | 2 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Euler.c | 142 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Euler.h | 2 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Matrix.c | 42 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Quaternion.c | 158 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Quaternion.h | 2 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Vector.c | 12 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_geometry.c | 8 |
10 files changed, 249 insertions, 261 deletions
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c index c08165f9850..a4a4010005a 100644 --- a/source/blender/python/mathutils/mathutils.c +++ b/source/blender/python/mathutils/mathutils.c @@ -276,12 +276,12 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error } -//----------------------------------MATRIX FUNCTIONS-------------------- +/* ----------------------------------MATRIX FUNCTIONS-------------------- */ /* Utility functions */ -// LomontRRDCompare4, Ever Faster Float Comparisons by Randy Dillon +/* LomontRRDCompare4, Ever Faster Float Comparisons by Randy Dillon */ #define SIGNMASK(i) (-(int)(((unsigned int)(i)) >> 31)) int EXPP_FloatsAreEqual(float af, float bf, int maxDiff) diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index c14b4a0686b..747a23a719d 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -35,8 +35,8 @@ #define COLOR_SIZE 3 -//----------------------------------mathutils.Color() ------------------- -//makes a new color for you to play with +/* ----------------------------------mathutils.Color() ------------------- */ +/* makes a new color for you to play with */ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { float col[3] = {0.0f, 0.0f, 0.0f}; @@ -64,7 +64,7 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return Color_CreatePyObject(col, Py_NEW, type); } -//-----------------------------METHODS---------------------------- +/* -----------------------------METHODS---------------------------- */ /* note: BaseMath_ReadCallback must be called beforehand */ static PyObject *Color_ToTupleExt(ColorObject *self, int ndigits) @@ -113,8 +113,8 @@ static PyObject *Color_deepcopy(ColorObject *self, PyObject *args) return Color_copy(self); } -//----------------------------print object (internal)-------------- -//print the object to screen +/* ----------------------------print object (internal)-------------- */ +/* print the object to screen */ static PyObject *Color_repr(ColorObject *self) { @@ -146,8 +146,8 @@ static PyObject *Color_str(ColorObject *self) return mathutils_dynstr_to_py(ds); /* frees ds */ } -//------------------------tp_richcmpr -//returns -1 exception, 0 false, 1 true +/* ------------------------tp_richcmpr */ +/* returns -1 exception, 0 false, 1 true */ static PyObject *Color_richcmpr(PyObject *a, PyObject *b, int op) { PyObject *res; @@ -184,15 +184,15 @@ static PyObject *Color_richcmpr(PyObject *a, PyObject *b, int op) return Py_INCREF(res), res; } -//---------------------SEQUENCE PROTOCOLS------------------------ -//----------------------------len(object)------------------------ -//sequence length +/* ---------------------SEQUENCE PROTOCOLS------------------------ */ +/* ----------------------------len(object)------------------------ */ +/* sequence length */ static int Color_len(ColorObject *UNUSED(self)) { return COLOR_SIZE; } -//----------------------------object[]--------------------------- -//sequence accessor (get) +/* ----------------------------object[]--------------------------- */ +/* sequence accessor (get) */ static PyObject *Color_item(ColorObject *self, int i) { if (i < 0) i = COLOR_SIZE - i; @@ -210,13 +210,13 @@ static PyObject *Color_item(ColorObject *self, int i) return PyFloat_FromDouble(self->col[i]); } -//----------------------------object[]------------------------- -//sequence accessor (set) +/* ----------------------------object[]------------------------- */ +/* sequence accessor (set) */ static int Color_ass_item(ColorObject *self, int i, PyObject *value) { float f = PyFloat_AsDouble(value); - if (f == -1 && PyErr_Occurred()) { // parsed item not a number + if (f == -1 && PyErr_Occurred()) { /* parsed item not a number */ PyErr_SetString(PyExc_TypeError, "color[item] = x: " "argument not a number"); @@ -238,8 +238,8 @@ static int Color_ass_item(ColorObject *self, int i, PyObject *value) return 0; } -//----------------------------object[z:y]------------------------ -//sequence slice (get) +/* ----------------------------object[z:y]------------------------ */ +/* sequence slice (get) */ static PyObject *Color_slice(ColorObject *self, int begin, int end) { PyObject *tuple; @@ -260,8 +260,8 @@ static PyObject *Color_slice(ColorObject *self, int begin, int end) return tuple; } -//----------------------------object[z:y]------------------------ -//sequence slice (set) +/* ----------------------------object[z:y]------------------------ */ +/* sequence slice (set) */ static int Color_ass_slice(ColorObject *self, int begin, int end, PyObject *seq) { int i, size; @@ -361,7 +361,7 @@ static int Color_ass_subscript(ColorObject *self, PyObject *item, PyObject *valu } } -//-----------------PROTCOL DECLARATIONS-------------------------- +/* -----------------PROTCOL DECLARATIONS-------------------------- */ static PySequenceMethods Color_SeqMethods = { (lenfunc) Color_len, /* sq_length */ (binaryfunc) NULL, /* sq_concat */ @@ -792,7 +792,7 @@ static PyGetSetDef Color_getseters[] = { }; -//-----------------------METHOD DEFINITIONS ---------------------- +/* -----------------------METHOD DEFINITIONS ---------------------- */ static struct PyMethodDef Color_methods[] = { {"copy", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc}, {"__copy__", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc}, @@ -800,60 +800,60 @@ static struct PyMethodDef Color_methods[] = { {NULL, NULL, 0, NULL} }; -//------------------PY_OBECT DEFINITION-------------------------- +/* ------------------PY_OBECT DEFINITION-------------------------- */ PyDoc_STRVAR(color_doc, "This object gives access to Colors in Blender." ); PyTypeObject color_Type = { PyVarObject_HEAD_INIT(NULL, 0) - "Color", //tp_name - sizeof(ColorObject), //tp_basicsize - 0, //tp_itemsize - (destructor)BaseMathObject_dealloc, //tp_dealloc - NULL, //tp_print - NULL, //tp_getattr - NULL, //tp_setattr - NULL, //tp_compare - (reprfunc) Color_repr, //tp_repr - &Color_NumMethods, //tp_as_number - &Color_SeqMethods, //tp_as_sequence - &Color_AsMapping, //tp_as_mapping - NULL, //tp_hash - NULL, //tp_call - (reprfunc) Color_str, //tp_str - NULL, //tp_getattro - NULL, //tp_setattro - NULL, //tp_as_buffer - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, //tp_flags - color_doc, //tp_doc - (traverseproc)BaseMathObject_traverse, //tp_traverse - (inquiry)BaseMathObject_clear, //tp_clear - (richcmpfunc)Color_richcmpr, //tp_richcompare - 0, //tp_weaklistoffset - NULL, //tp_iter - NULL, //tp_iternext - Color_methods, //tp_methods - NULL, //tp_members - Color_getseters, //tp_getset - NULL, //tp_base - NULL, //tp_dict - NULL, //tp_descr_get - NULL, //tp_descr_set - 0, //tp_dictoffset - NULL, //tp_init - NULL, //tp_alloc - Color_new, //tp_new - NULL, //tp_free - NULL, //tp_is_gc - NULL, //tp_bases - NULL, //tp_mro - NULL, //tp_cache - NULL, //tp_subclasses - NULL, //tp_weaklist - NULL //tp_del + "Color", /* tp_name */ + sizeof(ColorObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)BaseMathObject_dealloc, /* tp_dealloc */ + NULL, /* tp_print */ + NULL, /* tp_getattr */ + NULL, /* tp_setattr */ + NULL, /* tp_compare */ + (reprfunc) Color_repr, /* tp_repr */ + &Color_NumMethods, /* tp_as_number */ + &Color_SeqMethods, /* tp_as_sequence */ + &Color_AsMapping, /* tp_as_mapping */ + NULL, /* tp_hash */ + NULL, /* tp_call */ + (reprfunc) Color_str, /* tp_str */ + NULL, /* tp_getattro */ + NULL, /* tp_setattro */ + NULL, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */ + color_doc, /* tp_doc */ + (traverseproc)BaseMathObject_traverse, /* tp_traverse */ + (inquiry)BaseMathObject_clear, /* tp_clear */ + (richcmpfunc)Color_richcmpr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + NULL, /* tp_iter */ + NULL, /* tp_iternext */ + Color_methods, /* tp_methods */ + NULL, /* tp_members */ + Color_getseters, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + NULL, /* tp_descr_get */ + NULL, /* tp_descr_set */ + 0, /* tp_dictoffset */ + NULL, /* tp_init */ + NULL, /* tp_alloc */ + Color_new, /* tp_new */ + NULL, /* tp_free */ + NULL, /* tp_is_gc */ + NULL, /* tp_bases */ + NULL, /* tp_mro */ + NULL, /* tp_cache */ + NULL, /* tp_subclasses */ + NULL, /* tp_weaklist */ + NULL /* tp_del */ }; -//------------------------Color_CreatePyObject (internal)------------- -//creates a new color object +/* ------------------------Color_CreatePyObject (internal)------------- */ +/* creates a new color object */ /* pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER * (i.e. it was allocated elsewhere by MEM_mallocN()) * pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON diff --git a/source/blender/python/mathutils/mathutils_Color.h b/source/blender/python/mathutils/mathutils_Color.h index d753b60d195..1c75766c2a9 100644 --- a/source/blender/python/mathutils/mathutils_Color.h +++ b/source/blender/python/mathutils/mathutils_Color.h @@ -46,7 +46,7 @@ typedef struct { * be stored in py_data) or be a wrapper for data allocated through * blender (stored in blend_data). This is an either/or struct not both*/ -//prototypes +/* prototypes */ PyObject *Color_CreatePyObject(float col[3], int type, PyTypeObject *base_type); PyObject *Color_CreatePyObject_cb(PyObject *cb_user, unsigned char cb_type, unsigned char cb_subtype); diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index 468ef3788c1..3592e1084fb 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -39,8 +39,8 @@ #define EULER_SIZE 3 -//----------------------------------mathutils.Euler() ------------------- -//makes a new euler for you to play with +/* ----------------------------------mathutils.Euler() ------------------- */ +/* makes a new euler for you to play with */ static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { PyObject *seq = NULL; @@ -122,8 +122,8 @@ static PyObject *Euler_ToTupleExt(EulerObject *self, int ndigits) return ret; } -//-----------------------------METHODS---------------------------- -//return a quaternion representation of the euler +/* -----------------------------METHODS---------------------------- + * return a quaternion representation of the euler */ PyDoc_STRVAR(Euler_to_quaternion_doc, ".. method:: to_quaternion()\n" @@ -145,7 +145,7 @@ static PyObject *Euler_to_quaternion(EulerObject *self) return Quaternion_CreatePyObject(quat, Py_NEW, NULL); } -//return a matrix representation of the euler +/* return a matrix representation of the euler */ PyDoc_STRVAR(Euler_to_matrix_doc, ".. method:: to_matrix()\n" "\n" @@ -277,8 +277,8 @@ static PyObject *Euler_make_compatible(EulerObject *self, PyObject *value) Py_RETURN_NONE; } -//----------------------------Euler.rotate()----------------------- -// return a copy of the euler +/* ----------------------------Euler.rotate()----------------------- + * return a copy of the euler */ PyDoc_STRVAR(Euler_copy_doc, ".. function:: copy()\n" @@ -305,8 +305,8 @@ static PyObject *Euler_deepcopy(EulerObject *self, PyObject *args) return Euler_copy(self); } -//----------------------------print object (internal)-------------- -//print the object to screen +/* ----------------------------print object (internal)-------------- + * print the object to screen */ static PyObject *Euler_repr(EulerObject *self) { @@ -374,15 +374,15 @@ static PyObject *Euler_richcmpr(PyObject *a, PyObject *b, int op) return Py_INCREF(res), res; } -//---------------------SEQUENCE PROTOCOLS------------------------ -//----------------------------len(object)------------------------ -//sequence length +/* ---------------------SEQUENCE PROTOCOLS------------------------ */ +/* ----------------------------len(object)------------------------ */ +/* sequence length */ static int Euler_len(EulerObject *UNUSED(self)) { return EULER_SIZE; } -//----------------------------object[]--------------------------- -//sequence accessor (get) +/* ----------------------------object[]--------------------------- */ +/* sequence accessor (get) */ static PyObject *Euler_item(EulerObject *self, int i) { if (i < 0) i = EULER_SIZE - i; @@ -400,13 +400,13 @@ static PyObject *Euler_item(EulerObject *self, int i) return PyFloat_FromDouble(self->eul[i]); } -//----------------------------object[]------------------------- -//sequence accessor (set) +/* ----------------------------object[]------------------------- */ +/* sequence accessor (set) */ static int Euler_ass_item(EulerObject *self, int i, PyObject *value) { float f = PyFloat_AsDouble(value); - if (f == -1 && PyErr_Occurred()) { // parsed item not a number + if (f == -1 && PyErr_Occurred()) { /* parsed item not a number */ PyErr_SetString(PyExc_TypeError, "euler[attribute] = x: " "argument not a number"); @@ -429,8 +429,8 @@ static int Euler_ass_item(EulerObject *self, int i, PyObject *value) return 0; } -//----------------------------object[z:y]------------------------ -//sequence slice (get) +/* ----------------------------object[z:y]------------------------ */ +/* sequence slice (get) */ static PyObject *Euler_slice(EulerObject *self, int begin, int end) { PyObject *tuple; @@ -451,8 +451,8 @@ static PyObject *Euler_slice(EulerObject *self, int begin, int end) return tuple; } -//----------------------------object[z:y]------------------------ -//sequence slice (set) +/* ----------------------------object[z:y]------------------------ */ +/* sequence slice (set) */ static int Euler_ass_slice(EulerObject *self, int begin, int end, PyObject *seq) { int i, size; @@ -553,7 +553,7 @@ static int Euler_ass_subscript(EulerObject *self, PyObject *item, PyObject *valu } } -//-----------------PROTCOL DECLARATIONS-------------------------- +/* -----------------PROTCOL DECLARATIONS-------------------------- */ static PySequenceMethods Euler_SeqMethods = { (lenfunc) Euler_len, /* sq_length */ (binaryfunc) NULL, /* sq_concat */ @@ -629,7 +629,7 @@ static PyGetSetDef Euler_getseters[] = { }; -//-----------------------METHOD DEFINITIONS ---------------------- +/* -----------------------METHOD DEFINITIONS ---------------------- */ static struct PyMethodDef Euler_methods[] = { {"zero", (PyCFunction) Euler_zero, METH_NOARGS, Euler_zero_doc}, {"to_matrix", (PyCFunction) Euler_to_matrix, METH_NOARGS, Euler_to_matrix_doc}, @@ -643,60 +643,60 @@ static struct PyMethodDef Euler_methods[] = { {NULL, NULL, 0, NULL} }; -//------------------PY_OBECT DEFINITION-------------------------- +/* ------------------PY_OBECT DEFINITION-------------------------- */ PyDoc_STRVAR(euler_doc, "This object gives access to Eulers in Blender." ); PyTypeObject euler_Type = { PyVarObject_HEAD_INIT(NULL, 0) - "Euler", //tp_name - sizeof(EulerObject), //tp_basicsize - 0, //tp_itemsize - (destructor)BaseMathObject_dealloc, //tp_dealloc - NULL, //tp_print - NULL, //tp_getattr - NULL, //tp_setattr - NULL, //tp_compare - (reprfunc) Euler_repr, //tp_repr - NULL, //tp_as_number - &Euler_SeqMethods, //tp_as_sequence - &Euler_AsMapping, //tp_as_mapping - NULL, //tp_hash - NULL, //tp_call - (reprfunc) Euler_str, //tp_str - NULL, //tp_getattro - NULL, //tp_setattro - NULL, //tp_as_buffer - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, //tp_flags - euler_doc, //tp_doc - (traverseproc)BaseMathObject_traverse, //tp_traverse - (inquiry)BaseMathObject_clear, //tp_clear - (richcmpfunc)Euler_richcmpr, //tp_richcompare - 0, //tp_weaklistoffset - NULL, //tp_iter - NULL, //tp_iternext - Euler_methods, //tp_methods - NULL, //tp_members - Euler_getseters, //tp_getset - NULL, //tp_base - NULL, //tp_dict - NULL, //tp_descr_get - NULL, //tp_descr_set - 0, //tp_dictoffset - NULL, //tp_init - NULL, //tp_alloc - Euler_new, //tp_new - NULL, //tp_free - NULL, //tp_is_gc - NULL, //tp_bases - NULL, //tp_mro - NULL, //tp_cache - NULL, //tp_subclasses - NULL, //tp_weaklist - NULL //tp_del + "Euler", /* tp_name */ + sizeof(EulerObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)BaseMathObject_dealloc, /* tp_dealloc */ + NULL, /* tp_print */ + NULL, /* tp_getattr */ + NULL, /* tp_setattr */ + NULL, /* tp_compare */ + (reprfunc) Euler_repr, /* tp_repr */ + NULL, /* tp_as_number */ + &Euler_SeqMethods, /* tp_as_sequence */ + &Euler_AsMapping, /* tp_as_mapping */ + NULL, /* tp_hash */ + NULL, /* tp_call */ + (reprfunc) Euler_str, /* tp_str */ + NULL, /* tp_getattro */ + NULL, /* tp_setattro */ + NULL, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */ + euler_doc, /* tp_doc */ + (traverseproc)BaseMathObject_traverse, /* tp_traverse */ + (inquiry)BaseMathObject_clear, /* tp_clear */ + (richcmpfunc)Euler_richcmpr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + NULL, /* tp_iter */ + NULL, /* tp_iternext */ + Euler_methods, /* tp_methods */ + NULL, /* tp_members */ + Euler_getseters, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + NULL, /* tp_descr_get */ + NULL, /* tp_descr_set */ + 0, /* tp_dictoffset */ + NULL, /* tp_init */ + NULL, /* tp_alloc */ + Euler_new, /* tp_new */ + NULL, /* tp_free */ + NULL, /* tp_is_gc */ + NULL, /* tp_bases */ + NULL, /* tp_mro */ + NULL, /* tp_cache */ + NULL, /* tp_subclasses */ + NULL, /* tp_weaklist */ + NULL /* tp_del */ }; -//------------------------Euler_CreatePyObject (internal)------------- -//creates a new euler object +/* ------------------------Euler_CreatePyObject (internal)------------- */ +/* creates a new euler object */ /* pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER * (i.e. it was allocated elsewhere by MEM_mallocN()) * pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON diff --git a/source/blender/python/mathutils/mathutils_Euler.h b/source/blender/python/mathutils/mathutils_Euler.h index e04d45e4630..69e4c086d03 100644 --- a/source/blender/python/mathutils/mathutils_Euler.h +++ b/source/blender/python/mathutils/mathutils_Euler.h @@ -47,7 +47,7 @@ typedef struct { * be stored in py_data) or be a wrapper for data allocated through * blender (stored in blend_data). This is an either/or struct not both */ -//prototypes +/* prototypes */ 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); diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 9a0a1b3ca95..e9f58526113 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -329,9 +329,9 @@ Mathutils_Callback mathutils_matrix_translation_cb = { /* matrix column callbacks, this is so you can do matrix.translation = Vector() */ -//----------------------------------mathutils.Matrix() ----------------- -//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. -//create a new matrix type +/* ----------------------------------mathutils.Matrix() ----------------- */ +/* mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. */ +/* create a new matrix type */ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { if (kwds && PyDict_Size(kwds)) { @@ -410,7 +410,7 @@ static void matrix_3x3_as_4x4(float mat[16]) /*-----------------------CLASS-METHODS----------------------------*/ -//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. +/* mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. */ PyDoc_STRVAR(C_Matrix_Identity_doc, ".. classmethod:: Identity(size)\n" "\n" @@ -518,7 +518,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args) const float angle_cos = cosf(angle); const float angle_sin = sinf(angle); - //2D rotation matrix + /* 2D rotation matrix */ mat[0] = angle_cos; mat[1] = angle_sin; mat[2] = -angle_sin; @@ -532,7 +532,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args) if (matSize == 4) { matrix_3x3_as_4x4(mat); } - //pass to matrix creation + /* pass to matrix creation */ return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls); } @@ -556,8 +556,8 @@ static PyObject *C_Matrix_Translation(PyObject *cls, PyObject *value) return Matrix_CreatePyObject(&mat[0][0], 4, 4, Py_NEW, (PyTypeObject *)cls); } -//----------------------------------mathutils.Matrix.Scale() ------------- -//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. +/* ----------------------------------mathutils.Matrix.Scale() ------------- */ +/* mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. */ PyDoc_STRVAR(C_Matrix_Scale_doc, ".. classmethod:: Scale(factor, size, axis)\n" "\n" @@ -601,7 +601,7 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args) return NULL; } } - if (vec == NULL) { //scaling along axis + if (vec == NULL) { /* scaling along axis */ if (matSize == 2) { mat[0] = factor; mat[3] = factor; @@ -645,11 +645,11 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args) if (matSize == 4) { matrix_3x3_as_4x4(mat); } - //pass to matrix creation + /* pass to matrix creation */ return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls); } -//----------------------------------mathutils.Matrix.OrthoProjection() --- -//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. +/* ----------------------------------mathutils.Matrix.OrthoProjection() --- */ +/* mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. */ PyDoc_STRVAR(C_Matrix_OrthoProjection_doc, ".. classmethod:: OrthoProjection(axis, size)\n" "\n" @@ -685,7 +685,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args) return NULL; } - if (PyUnicode_Check(axis)) { //ortho projection onto cardinal plane + if (PyUnicode_Check(axis)) { /* ortho projection onto cardinal plane */ Py_ssize_t plane_len; const char *plane = _PyUnicode_AsStringAndSize(axis, &plane_len); if (matSize == 2) { @@ -726,7 +726,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args) } } else { - //arbitrary plane + /* arbitrary plane */ int vec_size = (matSize == 2 ? 2 : 3); float tvec[4]; @@ -737,7 +737,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args) return NULL; } - //normalize arbitrary axis + /* normalize arbitrary axis */ for (x = 0; x < vec_size; x++) { norm += tvec[x] * tvec[x]; } @@ -766,7 +766,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args) if (matSize == 4) { matrix_3x3_as_4x4(mat); } - //pass to matrix creation + /* pass to matrix creation */ return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls); } @@ -869,7 +869,7 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args) if (matSize == 4) { matrix_3x3_as_4x4(mat); } - //pass to matrix creation + /* pass to matrix creation */ return Matrix_CreatePyObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls); } @@ -2335,8 +2335,8 @@ PyTypeObject matrix_Type = { NULL, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ matrix_doc, /*tp_doc*/ - (traverseproc)BaseMathObject_traverse, //tp_traverse - (inquiry)BaseMathObject_clear, //tp_clear + (traverseproc)BaseMathObject_traverse, /* tp_traverse */ + (inquiry)BaseMathObject_clear, /*tp_clear*/ (richcmpfunc)Matrix_richcmpr, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ NULL, /*tp_iter*/ @@ -2635,8 +2635,8 @@ PyTypeObject matrix_access_Type = { NULL, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ NULL, /*tp_doc*/ - (traverseproc)MatrixAccess_traverse, //tp_traverse - (inquiry)MatrixAccess_clear, //tp_clear + (traverseproc)MatrixAccess_traverse,/*tp_traverse*/ + (inquiry)MatrixAccess_clear, /*tp_clear*/ NULL /* (richcmpfunc)MatrixAccess_richcmpr */ /* TODO*/, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ (getiterfunc)MatrixAccess_iter, /* getiterfunc tp_iter; */ diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 2debff68af1..b9aba995973 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -44,7 +44,7 @@ static void quat__axis_angle_sanitize(float axis[3], float *angle); static PyObject *Quaternion_copy(QuaternionObject *self); static PyObject *Quaternion_deepcopy(QuaternionObject *self, PyObject *args); -//-----------------------------METHODS------------------------------ +/* -----------------------------METHODS------------------------------ */ /* note: BaseMath_ReadCallback must be called beforehand */ static PyObject *Quaternion_to_tuple_ext(QuaternionObject *self, int ndigits) @@ -124,7 +124,7 @@ static PyObject *Quaternion_to_euler(QuaternionObject *self, PyObject *args) return Euler_CreatePyObject(eul, order, Py_NEW, NULL); } -//----------------------------Quaternion.toMatrix()------------------ + PyDoc_STRVAR(Quaternion_to_matrix_doc, ".. method:: to_matrix()\n" "\n" @@ -144,7 +144,6 @@ static PyObject *Quaternion_to_matrix(QuaternionObject *self) return Matrix_CreatePyObject(mat, 3, 3, Py_NEW, NULL); } -//----------------------------Quaternion.toMatrix()------------------ PyDoc_STRVAR(Quaternion_to_axis_angle_doc, ".. method:: to_axis_angle()\n" "\n" @@ -176,8 +175,6 @@ static PyObject *Quaternion_to_axis_angle(QuaternionObject *self) return ret; } - -//----------------------------Quaternion.cross(other)------------------ PyDoc_STRVAR(Quaternion_cross_doc, ".. method:: cross(other)\n" "\n" @@ -205,7 +202,6 @@ static PyObject *Quaternion_cross(QuaternionObject *self, PyObject *value) return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(self)); } -//----------------------------Quaternion.dot(other)------------------ PyDoc_STRVAR(Quaternion_dot_doc, ".. method:: dot(other)\n" "\n" @@ -335,8 +331,8 @@ static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value) Py_RETURN_NONE; } -//----------------------------Quaternion.normalize()---------------- -//normalize the axis of rotation of [theta, vector] +/* ----------------------------Quaternion.normalize()---------------- */ +/* normalize the axis of rotation of [theta, vector] */ PyDoc_STRVAR(Quaternion_normalize_doc, ".. function:: normalize()\n" "\n" @@ -365,7 +361,6 @@ static PyObject *Quaternion_normalized(QuaternionObject *self) return quat__apply_to_copy((PyNoArgsFunction)Quaternion_normalize, self); } -//----------------------------Quaternion.invert()------------------ PyDoc_STRVAR(Quaternion_invert_doc, ".. function:: invert()\n" "\n" @@ -394,7 +389,6 @@ static PyObject *Quaternion_inverted(QuaternionObject *self) return quat__apply_to_copy((PyNoArgsFunction)Quaternion_invert, self); } -//----------------------------Quaternion.identity()----------------- PyDoc_STRVAR(Quaternion_identity_doc, ".. function:: identity()\n" "\n" @@ -413,7 +407,7 @@ static PyObject *Quaternion_identity(QuaternionObject *self) (void)BaseMath_WriteCallback(self); Py_RETURN_NONE; } -//----------------------------Quaternion.negate()------------------- + PyDoc_STRVAR(Quaternion_negate_doc, ".. function:: negate()\n" "\n" @@ -432,7 +426,7 @@ static PyObject *Quaternion_negate(QuaternionObject *self) (void)BaseMath_WriteCallback(self); Py_RETURN_NONE; } -//----------------------------Quaternion.conjugate()---------------- + PyDoc_STRVAR(Quaternion_conjugate_doc, ".. function:: conjugate()\n" "\n" @@ -461,7 +455,6 @@ static PyObject *Quaternion_conjugated(QuaternionObject *self) return quat__apply_to_copy((PyNoArgsFunction)Quaternion_conjugate, self); } -//----------------------------Quaternion.copy()---------------- PyDoc_STRVAR(Quaternion_copy_doc, ".. function:: copy()\n" "\n" @@ -487,8 +480,7 @@ static PyObject *Quaternion_deepcopy(QuaternionObject *self, PyObject *args) return Quaternion_copy(self); } -//----------------------------print object (internal)-------------- -//print the object to screen +/* print the object to screen */ static PyObject *Quaternion_repr(QuaternionObject *self) { PyObject *ret, *tuple; @@ -555,15 +547,15 @@ static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op) return Py_INCREF(res), res; } -//---------------------SEQUENCE PROTOCOLS------------------------ -//----------------------------len(object)------------------------ -//sequence length +/* ---------------------SEQUENCE PROTOCOLS------------------------ */ +/* ----------------------------len(object)------------------------ */ +/* sequence length */ static int Quaternion_len(QuaternionObject *UNUSED(self)) { return QUAT_SIZE; } -//----------------------------object[]--------------------------- -//sequence accessor (get) +/* ----------------------------object[]--------------------------- */ +/* sequence accessor (get) */ static PyObject *Quaternion_item(QuaternionObject *self, int i) { if (i < 0) i = QUAT_SIZE - i; @@ -581,8 +573,8 @@ static PyObject *Quaternion_item(QuaternionObject *self, int i) return PyFloat_FromDouble(self->quat[i]); } -//----------------------------object[]------------------------- -//sequence accessor (set) +/* ----------------------------object[]------------------------- */ +/* sequence accessor (set) */ static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob) { float scalar = (float)PyFloat_AsDouble(ob); @@ -608,8 +600,8 @@ static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob) return 0; } -//----------------------------object[z:y]------------------------ -//sequence slice (get) +/* ----------------------------object[z:y]------------------------ */ +/* sequence slice (get) */ static PyObject *Quaternion_slice(QuaternionObject *self, int begin, int end) { PyObject *tuple; @@ -630,8 +622,8 @@ static PyObject *Quaternion_slice(QuaternionObject *self, int begin, int end) return tuple; } -//----------------------------object[z:y]------------------------ -//sequence slice (set) +/* ----------------------------object[z:y]------------------------ */ +/* sequence slice (set) */ static int Quaternion_ass_slice(QuaternionObject *self, int begin, int end, PyObject *seq) { int i, size; @@ -734,9 +726,9 @@ static int Quaternion_ass_subscript(QuaternionObject *self, PyObject *item, PyOb } } -//------------------------NUMERIC PROTOCOLS---------------------- -//------------------------obj + obj------------------------------ -//addition +/* ------------------------NUMERIC PROTOCOLS---------------------- */ +/* ------------------------obj + obj------------------------------ */ +/* addition */ static PyObject *Quaternion_add(PyObject *q1, PyObject *q2) { float quat[QUAT_SIZE]; @@ -758,8 +750,8 @@ static PyObject *Quaternion_add(PyObject *q1, PyObject *q2) add_qt_qtqt(quat, quat1->quat, quat2->quat, 1.0f); return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(q1)); } -//------------------------obj - obj------------------------------ -//subtraction +/* ------------------------obj - obj------------------------------ */ +/* subtraction */ static PyObject *Quaternion_sub(PyObject *q1, PyObject *q2) { int x; @@ -875,7 +867,7 @@ static PyObject *Quaternion_neg(QuaternionObject *self) } -//-----------------PROTOCOL DECLARATIONS-------------------------- +/* -----------------PROTOCOL DECLARATIONS-------------------------- */ static PySequenceMethods Quaternion_SeqMethods = { (lenfunc) Quaternion_len, /* sq_length */ (binaryfunc) NULL, /* sq_concat */ @@ -1060,7 +1052,7 @@ static int Quaternion_axis_vector_set(QuaternionObject *self, PyObject *value, v return 0; } -//----------------------------------mathutils.Quaternion() -------------- +/* ----------------------------------mathutils.Quaternion() -------------- */ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { PyObject *seq = NULL; @@ -1140,7 +1132,7 @@ static void quat__axis_angle_sanitize(float axis[3], float *angle) } } -//-----------------------METHOD DEFINITIONS ---------------------- +/* -----------------------METHOD DEFINITIONS ---------------------- */ static struct PyMethodDef Quaternion_methods[] = { /* in place only */ {"identity", (PyCFunction) Quaternion_identity, METH_NOARGS, Quaternion_identity_doc}, @@ -1190,60 +1182,60 @@ static PyGetSetDef Quaternion_getseters[] = { {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; -//------------------PY_OBECT DEFINITION-------------------------- +/* ------------------PY_OBECT DEFINITION-------------------------- */ PyDoc_STRVAR(quaternion_doc, "This object gives access to Quaternions in Blender." ); PyTypeObject quaternion_Type = { PyVarObject_HEAD_INIT(NULL, 0) - "Quaternion", //tp_name - sizeof(QuaternionObject), //tp_basicsize - 0, //tp_itemsize - (destructor)BaseMathObject_dealloc, //tp_dealloc - NULL, //tp_print - NULL, //tp_getattr - NULL, //tp_setattr - NULL, //tp_compare - (reprfunc) Quaternion_repr, //tp_repr - &Quaternion_NumMethods, //tp_as_number - &Quaternion_SeqMethods, //tp_as_sequence - &Quaternion_AsMapping, //tp_as_mapping - NULL, //tp_hash - NULL, //tp_call - (reprfunc) Quaternion_str, //tp_str - NULL, //tp_getattro - NULL, //tp_setattro - NULL, //tp_as_buffer - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, //tp_flags - quaternion_doc, //tp_doc - (traverseproc)BaseMathObject_traverse, //tp_traverse - (inquiry)BaseMathObject_clear, //tp_clear - (richcmpfunc)Quaternion_richcmpr, //tp_richcompare - 0, //tp_weaklistoffset - NULL, //tp_iter - NULL, //tp_iternext - Quaternion_methods, //tp_methods - NULL, //tp_members - Quaternion_getseters, //tp_getset - NULL, //tp_base - NULL, //tp_dict - NULL, //tp_descr_get - NULL, //tp_descr_set - 0, //tp_dictoffset - NULL, //tp_init - NULL, //tp_alloc - Quaternion_new, //tp_new - NULL, //tp_free - NULL, //tp_is_gc - NULL, //tp_bases - NULL, //tp_mro - NULL, //tp_cache - NULL, //tp_subclasses - NULL, //tp_weaklist - NULL, //tp_del + "Quaternion", /* tp_name */ + sizeof(QuaternionObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)BaseMathObject_dealloc, /* tp_dealloc */ + NULL, /* tp_print */ + NULL, /* tp_getattr */ + NULL, /* tp_setattr */ + NULL, /* tp_compare */ + (reprfunc) Quaternion_repr, /* tp_repr */ + &Quaternion_NumMethods, /* tp_as_number */ + &Quaternion_SeqMethods, /* tp_as_sequence */ + &Quaternion_AsMapping, /* tp_as_mapping */ + NULL, /* tp_hash */ + NULL, /* tp_call */ + (reprfunc) Quaternion_str, /* tp_str */ + NULL, /* tp_getattro */ + NULL, /* tp_setattro */ + NULL, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */ + quaternion_doc, /* tp_doc */ + (traverseproc)BaseMathObject_traverse, /* tp_traverse */ + (inquiry)BaseMathObject_clear, /* tp_clear */ + (richcmpfunc)Quaternion_richcmpr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + NULL, /* tp_iter */ + NULL, /* tp_iternext */ + Quaternion_methods, /* tp_methods */ + NULL, /* tp_members */ + Quaternion_getseters, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + NULL, /* tp_descr_get */ + NULL, /* tp_descr_set */ + 0, /* tp_dictoffset */ + NULL, /* tp_init */ + NULL, /* tp_alloc */ + Quaternion_new, /* tp_new */ + NULL, /* tp_free */ + NULL, /* tp_is_gc */ + NULL, /* tp_bases */ + NULL, /* tp_mro */ + NULL, /* tp_cache */ + NULL, /* tp_subclasses */ + NULL, /* tp_weaklist */ + NULL, /* tp_del */ }; -//------------------------Quaternion_CreatePyObject (internal)------------- -//creates a new quaternion object +/* ------------------------Quaternion_CreatePyObject (internal)------------- */ +/* creates a new quaternion object */ /*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER * (i.e. it was allocated elsewhere by MEM_mallocN()) * pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON @@ -1266,7 +1258,7 @@ PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_ty } else if (type == Py_NEW) { self->quat = PyMem_Malloc(QUAT_SIZE * sizeof(float)); - if (!quat) { //new empty + if (!quat) { /* new empty */ unit_qt(self->quat); } else { diff --git a/source/blender/python/mathutils/mathutils_Quaternion.h b/source/blender/python/mathutils/mathutils_Quaternion.h index 4ffe8488843..b88715096bf 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.h +++ b/source/blender/python/mathutils/mathutils_Quaternion.h @@ -44,7 +44,7 @@ typedef struct { * be stored in py_data) or be a wrapper for data allocated through * blender (stored in blend_data). This is an either/or struct not both */ -//prototypes +/* prototypes */ PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_type); PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, unsigned char cb_type, unsigned char cb_subtype); diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index d461486d485..4a6891c41b9 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -1100,12 +1100,12 @@ static PyObject *Vector_project(VectorObject *self, PyObject *value) if (BaseMath_ReadCallback(self) == -1) return NULL; - //get dot products + /* get dot products */ for (x = 0; x < size; x++) { dot += (double)(self->vec[x] * tvec[x]); dot2 += (double)(tvec[x] * tvec[x]); } - //projection + /* projection */ dot /= dot2; for (x = 0; x < size; x++) { vec[x] = (float)dot * tvec[x]; @@ -2709,7 +2709,7 @@ static int row_vector_multiplication(float r_vec[MAX_DIMENSIONS], VectorObject * memcpy(vec_cpy, vec->vec, vec_size * sizeof(float)); r_vec[3] = 1.0f; - //muliplication + /* muliplication */ for (col = 0; col < mat->num_col; col++) { double dot = 0.0; for (row = 0; row < mat->num_row; row++) { @@ -2733,7 +2733,7 @@ static PyObject *Vector_negate(VectorObject *self) negate_vn(self->vec, self->size); - (void)BaseMath_WriteCallback(self); // already checked for error + (void)BaseMath_WriteCallback(self); /* already checked for error */ Py_RETURN_NONE; } @@ -2829,10 +2829,10 @@ PyTypeObject vector_Type = { /*** Assigned meaning in release 2.0 ***/ /* call function for all accessible objects */ - (traverseproc)BaseMathObject_traverse, //tp_traverse + (traverseproc)BaseMathObject_traverse, /* tp_traverse */ /* delete references to contained objects */ - (inquiry)BaseMathObject_clear, //tp_clear + (inquiry)BaseMathObject_clear, /* tp_clear */ /*** Assigned meaning in release 2.1 ***/ /*** rich comparisons ***/ diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 818f30ec284..22317636faa 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -51,7 +51,7 @@ PyDoc_STRVAR(M_Geometry_doc, "The Blender geometry module" ); -//---------------------------------INTERSECTION FUNCTIONS-------------------- +/* ---------------------------------INTERSECTION FUNCTIONS-------------------- */ PyDoc_STRVAR(M_Geometry_intersect_ray_tri_doc, ".. function:: intersect_ray_tri(v1, v2, v3, ray, orig, clip=True)\n" @@ -251,10 +251,6 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject } } - - - -//----------------------------geometry.normal() ------------------- PyDoc_STRVAR(M_Geometry_normal_doc, ".. function:: normal(v1, v2, v3, v4=None)\n" "\n" @@ -338,7 +334,7 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject *args) return Vector_CreatePyObject(n, 3, Py_NEW, NULL); } -//--------------------------------- AREA FUNCTIONS-------------------- +/* --------------------------------- AREA FUNCTIONS-------------------- */ PyDoc_STRVAR(M_Geometry_area_tri_doc, ".. function:: area_tri(v1, v2, v3)\n" |