bmesh api function: BM_edge_face_tangent()
was used by inset but make into an api function since scripts can use this too.
This commit is contained in:
@@ -1243,6 +1243,36 @@ static PyObject *bpy_bmedge_calc_face_angle(BPy_BMEdge *self)
|
||||
return PyFloat_FromDouble(BM_edge_face_angle(self->e));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(bpy_bmedge_calc_tangent_doc,
|
||||
".. method:: calc_tangent(loop)\n"
|
||||
"\n"
|
||||
" Return the tangent at this edge relative to a face (pointing inward into the face).\n"
|
||||
" This uses the face normal for calculation.\n"
|
||||
"\n"
|
||||
" :arg loop: The loop used for tangent calculation.\n"
|
||||
" :type loop: :class:`BMLoop`\n"
|
||||
" :return: a normalized vector.\n"
|
||||
" :rtype: :class:`mathutils.Vector`\n"
|
||||
);
|
||||
static PyObject *bpy_bmedge_calc_tangent(BPy_BMEdge *self, PyObject *args)
|
||||
{
|
||||
BPy_BMLoop *py_loop;
|
||||
BPY_BM_CHECK_OBJ(self);
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O!:BMEdge.calc_face_tangent",
|
||||
&BPy_BMLoop_Type, &py_loop))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
float vec[3];
|
||||
BPY_BM_CHECK_OBJ(py_loop);
|
||||
/* no need to check if they are from the same mesh or even connected */
|
||||
BM_edge_face_tangent(self->e, py_loop->l, vec);
|
||||
return Vector_CreatePyObject(vec, 3, Py_NEW, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PyDoc_STRVAR(bpy_bmedge_other_vert_doc,
|
||||
".. method:: other_vert(vert)\n"
|
||||
@@ -2078,8 +2108,9 @@ static struct PyMethodDef bpy_bmedge_methods[] = {
|
||||
|
||||
{"other_vert", (PyCFunction)bpy_bmedge_other_vert, METH_O, bpy_bmedge_other_vert_doc},
|
||||
|
||||
{"calc_length", (PyCFunction)bpy_bmedge_calc_length, METH_NOARGS, bpy_bmedge_calc_length_doc},
|
||||
{"calc_face_angle", (PyCFunction)bpy_bmedge_calc_face_angle, METH_NOARGS, bpy_bmedge_calc_face_angle_doc},
|
||||
{"calc_length", (PyCFunction)bpy_bmedge_calc_length, METH_NOARGS, bpy_bmedge_calc_length_doc},
|
||||
{"calc_face_angle", (PyCFunction)bpy_bmedge_calc_face_angle, METH_NOARGS, bpy_bmedge_calc_face_angle_doc},
|
||||
{"calc_tangent", (PyCFunction)bpy_bmedge_calc_tangent, METH_VARARGS, bpy_bmedge_calc_tangent_doc},
|
||||
|
||||
{"normal_update", (PyCFunction)bpy_bmedge_normal_update, METH_NOARGS, bpy_bmedge_normal_update_doc},
|
||||
|
||||
|
Reference in New Issue
Block a user