diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-10-09 09:08:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-10-09 09:08:51 +0300 |
commit | 6ff60d998295afe860872894e24215ff69cc3c5d (patch) | |
tree | b83406d5a82e39e42be85e8ba38030391b0cddd2 /source | |
parent | b718d659c9a51a7218c161e4be1ff511abd436e8 (diff) |
PyAPI: avoid normal calculation for tessellate_polygon
Use fixed normal for 2D input, no need to calculate it.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/mathutils/mathutils_geometry.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 13d36e5af91..f02fdf1fb80 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -1212,6 +1212,7 @@ static PyObject *M_Geometry_tessellate_polygon(PyObject *UNUSED(self), PyObject PyObject *tri_list; /*return this list of tri's */ PyObject *polyLine, *polyVec; int i, len_polylines, len_polypoints, ls_error = 0; + bool is_2d = true; /* Display #ListBase. */ ListBase dispbase = {NULL, NULL}; @@ -1269,6 +1270,7 @@ static PyObject *M_Geometry_tessellate_polygon(PyObject *UNUSED(self), PyObject fp[1] = ((VectorObject *)polyVec)->vec[1]; if (((VectorObject *)polyVec)->size > 2) { fp[2] = ((VectorObject *)polyVec)->vec[2]; + is_2d = false; } else { /* if its a 2d vector then set the z to be zero */ @@ -1295,8 +1297,7 @@ static PyObject *M_Geometry_tessellate_polygon(PyObject *UNUSED(self), PyObject } else if (totpoints) { /* now make the list to return */ - /* TODO, add normal arg */ - BKE_displist_fill(&dispbase, &dispbase, NULL, false); + BKE_displist_fill(&dispbase, &dispbase, is_2d ? ((const float[3]){0, 0, -1}) : NULL, false); /* The faces are stored in a new DisplayList * that's added to the head of the #ListBase. */ |