diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-02 18:46:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-02 18:46:14 +0400 |
commit | 63f5b96fe33eaa438969c59508b5fc47b40d3402 (patch) | |
tree | 2b3b066afd8d75a3dc3de0ea5e539b317c7c8f6b /source | |
parent | 8856a9cbcd78387d6f9e30ede2cf4868f63d2634 (diff) |
mesh.update() now has option to calculate tessellation faces.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/include/ED_mesh.h | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_data.c | 13 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh_api.c | 1 |
3 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 4b43233fe40..986c2abad69 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -292,7 +292,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_material_link(struct Mesh *me, struct Material *ma); -void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges); +void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges, int calc_tessface); int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me, const char *name, int active_set); int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me); diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 526672b8b4b..4259f7fc558 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -751,19 +751,24 @@ void MESH_OT_sticky_remove(wmOperatorType *ot) /************************** Add Geometry Layers *************************/ -void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges) +void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface) { int *polyindex = NULL; float (*face_nors)[3]; - if(mesh->totface > 0 && mesh->totpoly == 0) + if(mesh->totface > 0 && mesh->totpoly == 0) { convert_mfaces_to_mpolys(mesh); + /* would only be converting back again, dont bother */ + calc_tessface = FALSE; + } + if(calc_edges || (mesh->totpoly && mesh->totedge == 0)) BKE_mesh_calc_edges(mesh, calc_edges); - /* TODO, make this optional, we dont always want this! */ - BKE_mesh_tessface_calc(mesh); + if (calc_tessface) { + BKE_mesh_tessface_calc(mesh); + } polyindex = CustomData_get_layer(&mesh->fdata, CD_POLYINDEX); /* add a normals layer for tesselated faces, a tessface normal will diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index 9bee359bbf5..3eb08a91d19 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -67,6 +67,7 @@ void RNA_api_mesh(StructRNA *srna) 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 Tesselation", "Force recalculation of tesselation faces"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func= RNA_def_function(srna, "unit_test_compare", "rna_Mesh_unit_test_compare"); |