[Bf-blender-cvs] [6ff60d99829] master: PyAPI: avoid normal calculation for tessellate_polygon
Campbell Barton
noreply at git.blender.org
Wed Oct 9 08:10:50 CEST 2019
Commit: 6ff60d998295afe860872894e24215ff69cc3c5d
Author: Campbell Barton
Date: Wed Oct 9 17:08:51 2019 +1100
Branches: master
https://developer.blender.org/rB6ff60d998295afe860872894e24215ff69cc3c5d
PyAPI: avoid normal calculation for tessellate_polygon
Use fixed normal for 2D input, no need to calculate it.
===================================================================
M source/blender/python/mathutils/mathutils_geometry.c
===================================================================
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. */
More information about the Bf-blender-cvs
mailing list