Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1082)

Issue 5449088: Mathutils n-dimension patch by Andrew Hale

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 5 months ago by ideasman42
Modified:
12 years, 5 months ago
Reviewers:
bf-codereview
CC:
trumanblending_gmail.com
Base URL:
https://svn.blender.org/svnroot/bf-blender/trunk/blender/
Visibility:
Public.

Patch Set 1 #

Total comments: 12
Unified diffs Side-by-side diffs Delta from patch set Stats (+434 lines, -198 lines) Patch
M source/blender/blenkernel/intern/DerivedMesh.c View 1 chunk +1 line, -0 lines 0 comments Download
M source/blender/blenlib/BLI_math_vector.h View 1 chunk +1 line, -0 lines 0 comments Download
M source/blender/blenlib/intern/math_vector.c View 1 chunk +9 lines, -0 lines 0 comments Download
M source/blender/python/mathutils/mathutils.h View 1 chunk +1 line, -0 lines 0 comments Download
M source/blender/python/mathutils/mathutils.c View 3 chunks +78 lines, -29 lines 1 comment Download
M source/blender/python/mathutils/mathutils_Vector.h View 1 chunk +2 lines, -1 line 0 comments Download
M source/blender/python/mathutils/mathutils_Vector.c View 30 chunks +342 lines, -168 lines 11 comments Download

Messages

Total messages: 1
ideasman42
12 years, 5 months ago (2011-12-05 03:49:29 UTC) #1
comments inline, mostly api usage.

http://codereview.appspot.com/5449088/diff/1/source/blender/python/mathutils/...
File source/blender/python/mathutils/mathutils.c (right):

http://codereview.appspot.com/5449088/diff/1/source/blender/python/mathutils/...
source/blender/python/mathutils/mathutils.c:163: {
array_min is not getting checked in this case

http://codereview.appspot.com/5449088/diff/1/source/blender/python/mathutils/...
File source/blender/python/mathutils/mathutils_Vector.c (right):

http://codereview.appspot.com/5449088/diff/1/source/blender/python/mathutils/...
source/blender/python/mathutils/mathutils_Vector.c:112: if
(!PyArg_ParseTuple(args, "i|f", &size, &fill)) {
to avoid hand writing exceptions for PyArg_ParseTuple you can replace "i|f" with
"i|f":Vector.Fill", then just return NULL.

http://codereview.appspot.com/5449088/diff/1/source/blender/python/mathutils/...
source/blender/python/mathutils/mathutils_Vector.c:345: static PyObject
*Vector_resize(VectorObject *self, PyObject *args)
(picky) for functions which recieve a single argument you can use METH_O, in the
methoddef and then take the PyObject and get its an int (not deal with args
tuples). enough examples of this in the code.

http://codereview.appspot.com/5449088/diff/1/source/blender/python/mathutils/...
source/blender/python/mathutils/mathutils_Vector.c:381: self->vec[i]= 0.0f;
(picky) why not use range_vn_fl fill function here? - just need to offset the
array.

http://codereview.appspot.com/5449088/diff/1/source/blender/python/mathutils/...
source/blender/python/mathutils/mathutils_Vector.c:694: static PyObject
*Vector_dot(VectorObject *self, PyObject *value)
(picky), this is an example of where you can use cleanup...

697 ยป PyObject *ret= NULL;
....
 if (some error)
   goto cleanup;

cleanup:
    PyMem_Free(tvec);
    return ret;
----

since its simple func its not going to confuse anyway, but would do it this way
all the same.

http://codereview.appspot.com/5449088/diff/1/source/blender/python/mathutils/...
source/blender/python/mathutils/mathutils_Vector.c:885: if
(mathutils_array_parse_alloc(&tvec, size, value, "Vector.lerp(other), invalid
'other' arg") == -1) {
again, suggest using a `cleanup` goto at the end.

http://codereview.appspot.com/5449088/diff/1/source/blender/python/mathutils/...
source/blender/python/mathutils/mathutils_Vector.c:1128: vec=
PyMem_Malloc(vec1->size * sizeof(float));
no check on fail here.

http://codereview.appspot.com/5449088/diff/1/source/blender/python/mathutils/...
source/blender/python/mathutils/mathutils_Vector.c:1192: vec=
PyMem_Malloc(vec1->size * sizeof(float));
also no check on fail.

http://codereview.appspot.com/5449088/diff/1/source/blender/python/mathutils/...
source/blender/python/mathutils/mathutils_Vector.c:1279: tvec=
PyMem_Malloc(vec->size * sizeof(float));
no check on fail.

http://codereview.appspot.com/5449088/diff/1/source/blender/python/mathutils/...
source/blender/python/mathutils/mathutils_Vector.c:1480: vec=
PyMem_Malloc(vec1->size * sizeof(float));
no check on fail.

http://codereview.appspot.com/5449088/diff/1/source/blender/python/mathutils/...
source/blender/python/mathutils/mathutils_Vector.c:2422: /*{"func",
(PyCFunction) Vector_func, METH_VARARGS, NULL},*/
think the to_2/3/4 d funcs can stay for now, at least not to break the api, see
how resized is more flexible tho.

http://codereview.appspot.com/5449088/diff/1/source/blender/python/mathutils/...
source/blender/python/mathutils/mathutils_Vector.c:2598: static PyObject
*Vector_CreatePyObject_alloc(float *vec, const int size, const int type,
PyTypeObject *base_type)
no need for type argument
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b