forked from bartvdbraak/blender
added Mesh.calc_tessface(), needed to update mesh tessface after bmesh edits.
also add py api BMDeformVert.clear()
This commit is contained in:
parent
f87c5b3453
commit
20e2330434
@ -75,6 +75,16 @@ its good practice to call :class:`bmesh.types.BMesh.free` which will remove all
|
||||
further access.
|
||||
|
||||
|
||||
EditMode Tessellation
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
When writing scripts that operate on editmode data you will normally want to re-calculate the tessellation after
|
||||
running the script, this needs to be called explicitly.
|
||||
|
||||
The BMesh its self does not store the triangulated faces, they are stored in the :class:`bpy.types.Mesh`,
|
||||
to refresh tessellation faces call :class:`bpy.types.Mesh.calc_tessface`.
|
||||
|
||||
|
||||
CustomData Access
|
||||
-----------------
|
||||
|
||||
|
@ -261,6 +261,7 @@ void ED_mesh_vertices_remove(struct Mesh *mesh, struct ReportList *reports, int
|
||||
|
||||
void ED_mesh_transform(struct Mesh *me, float *mat);
|
||||
void ED_mesh_calc_normals(struct Mesh *me);
|
||||
void ED_mesh_calc_tessface(struct Mesh *mesh);
|
||||
void ED_mesh_material_link(struct Mesh *me, struct Material *ma);
|
||||
void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges, int calc_tessface);
|
||||
|
||||
|
@ -1182,3 +1182,13 @@ void ED_mesh_calc_normals(Mesh *mesh)
|
||||
NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ED_mesh_calc_tessface(Mesh *mesh)
|
||||
{
|
||||
if (mesh->edit_btmesh) {
|
||||
BMEdit_RecalcTessellation(mesh->edit_btmesh);
|
||||
}
|
||||
else {
|
||||
BKE_mesh_tessface_calc(mesh);
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,9 @@ void RNA_api_mesh(StructRNA *srna)
|
||||
func = RNA_def_function(srna, "calc_normals", "ED_mesh_calc_normals");
|
||||
RNA_def_function_ui_description(func, "Calculate vertex normals");
|
||||
|
||||
func = RNA_def_function(srna, "calc_tessface", "ED_mesh_calc_tessface");
|
||||
RNA_def_function_ui_description(func, "Calculate face tessellation (supports editmode too)");
|
||||
|
||||
func = RNA_def_function(srna, "update", "ED_mesh_update");
|
||||
RNA_def_boolean(func, "calc_edges", 0, "Calculate Edges", "Force recalculation of edges");
|
||||
RNA_def_boolean(func, "calc_tessface", 0, "Calculate Tessellation", "Force recalculation of tessellation faces");
|
||||
|
@ -525,12 +525,26 @@ static PyObject *bpy_bmdeformvert_get(BPy_BMDeformVert *self, PyObject *args)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PyDoc_STRVAR(bpy_bmdeformvert_clear_doc,
|
||||
".. method:: clear()\n"
|
||||
"\n"
|
||||
" Clears all weights.\n"
|
||||
);
|
||||
static PyObject *bpy_bmdeformvert_clear(BPy_BMDeformVert *self)
|
||||
{
|
||||
defvert_clear(self->data);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static struct PyMethodDef bpy_bmdeformvert_methods[] = {
|
||||
{"keys", (PyCFunction)bpy_bmdeformvert_keys, METH_NOARGS, bpy_bmdeformvert_keys_doc},
|
||||
{"values", (PyCFunction)bpy_bmdeformvert_values, METH_NOARGS, bpy_bmdeformvert_values_doc},
|
||||
{"items", (PyCFunction)bpy_bmdeformvert_items, METH_NOARGS, bpy_bmdeformvert_items_doc},
|
||||
{"get", (PyCFunction)bpy_bmdeformvert_get, METH_VARARGS, bpy_bmdeformvert_get_doc},
|
||||
/* BMESH_TODO */
|
||||
/* BMESH_TODO pop, popitem, update */
|
||||
{"clear", (PyCFunction)bpy_bmdeformvert_clear, METH_NOARGS, bpy_bmdeformvert_clear_doc},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@ -586,3 +600,4 @@ void BPy_BM_init_types_meshdata(void)
|
||||
bm_init_types_bmloopcol();
|
||||
bm_init_types_bmdvert();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user