Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-01-20 16:34:00 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-20 16:34:00 +0400
commitc8037fb56ae31f4edfdb4a0b1832a299e411e133 (patch)
tree4186b7de996464946792e9ce9dfabe0659c5ebf8 /source/blender/editors/mesh/mesh_data.c
parentc5adacff83e9d1c4a849ec80d05e7e988436df69 (diff)
parentf0fc8c22bb9f8fa4cab232fd88b9aed27ca6637f (diff)
svn merge ^/trunk/blender -r43530:43554
Diffstat (limited to 'source/blender/editors/mesh/mesh_data.c')
-rw-r--r--source/blender/editors/mesh/mesh_data.c90
1 files changed, 86 insertions, 4 deletions
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index b0512414a7f..194759bddfe 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -818,15 +818,15 @@ static void mesh_add_verts(Mesh *mesh, int len)
mesh->totvert= totvert;
}
-void ED_mesh_transform(Mesh *mesh, float *mat)
+void ED_mesh_transform(Mesh *me, float *mat)
{
int i;
- MVert *mvert= mesh->mvert;
+ MVert *mvert= me->mvert;
- for(i= 0; i < mesh->totvert; i++, mvert++)
+ for(i= 0; i < me->totvert; i++, mvert++)
mul_m4_v3((float (*)[4])mat, mvert->co);
- mesh_calc_normals_mapping(mesh->mvert, mesh->totvert, mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, NULL, NULL, 0, NULL, NULL);
+ mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
}
static void mesh_add_edges(Mesh *mesh, int len)
@@ -943,6 +943,46 @@ static void mesh_add_polys(Mesh *mesh, int len)
mesh->totpoly= totpoly;
}
+static void mesh_remove_verts(Mesh *mesh, int len)
+{
+ int totvert;
+
+ if(len == 0)
+ return;
+
+ totvert= mesh->totvert - len;
+ CustomData_free_elem(&mesh->vdata, totvert, len);
+
+ /* set final vertex list size */
+ mesh->totvert= totvert;
+}
+
+static void mesh_remove_edges(Mesh *mesh, int len)
+{
+ int totedge;
+
+ if(len == 0)
+ return;
+
+ totedge= mesh->totedge - len;
+ CustomData_free_elem(&mesh->edata, totedge, len);
+
+ mesh->totedge= totedge;
+}
+
+static void mesh_remove_faces(Mesh *mesh, int len)
+{
+ int totface;
+
+ if(len == 0)
+ return;
+
+ totface= mesh->totface - len; /* new face count */
+ CustomData_free_elem(&mesh->fdata, totface, len);
+
+ mesh->totface= totface;
+}
+
/*
void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges, int faces)
{
@@ -990,6 +1030,48 @@ void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
mesh_add_verts(mesh, count);
}
+void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count)
+{
+ if(mesh->edit_btmesh) {
+ BKE_report(reports, RPT_ERROR, "Can't remove faces in edit mode");
+ return;
+ }
+ else if(count > mesh->totface) {
+ BKE_report(reports, RPT_ERROR, "Can't remove more faces than the mesh contains");
+ return;
+ }
+
+ mesh_remove_faces(mesh, count);
+}
+
+void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
+{
+ if(mesh->edit_btmesh) {
+ BKE_report(reports, RPT_ERROR, "Can't remove edges in edit mode");
+ return;
+ }
+ else if(count > mesh->totedge) {
+ BKE_report(reports, RPT_ERROR, "Can't remove more edges than the mesh contains");
+ return;
+ }
+
+ mesh_remove_edges(mesh, count);
+}
+
+void ED_mesh_vertices_remove(Mesh *mesh, ReportList *reports, int count)
+{
+ if(mesh->edit_btmesh) {
+ BKE_report(reports, RPT_ERROR, "Can't remove vertices in edit mode");
+ return;
+ }
+ else if(count > mesh->totvert) {
+ BKE_report(reports, RPT_ERROR, "Can't remove more vertices than the mesh contains");
+ return;
+ }
+
+ mesh_remove_verts(mesh, count);
+}
+
void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
{
if(mesh->edit_btmesh) {