[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44605] trunk/blender/source/blender: mesh .update() now has option to calculate tessellation faces.
Campbell Barton
ideasman42 at gmail.com
Fri Mar 2 15:46:27 CET 2012
Revision: 44605
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44605
Author: campbellbarton
Date: 2012-03-02 14:46:14 +0000 (Fri, 02 Mar 2012)
Log Message:
-----------
mesh.update() now has option to calculate tessellation faces.
Modified Paths:
--------------
trunk/blender/source/blender/editors/include/ED_mesh.h
trunk/blender/source/blender/editors/mesh/mesh_data.c
trunk/blender/source/blender/makesrna/intern/rna_mesh_api.c
Modified: trunk/blender/source/blender/editors/include/ED_mesh.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_mesh.h 2012-03-02 14:39:18 UTC (rev 44604)
+++ trunk/blender/source/blender/editors/include/ED_mesh.h 2012-03-02 14:46:14 UTC (rev 44605)
@@ -292,7 +292,7 @@
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);
Modified: trunk/blender/source/blender/editors/mesh/mesh_data.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/mesh_data.c 2012-03-02 14:39:18 UTC (rev 44604)
+++ trunk/blender/source/blender/editors/mesh/mesh_data.c 2012-03-02 14:46:14 UTC (rev 44605)
@@ -751,19 +751,24 @@
/************************** 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
Modified: trunk/blender/source/blender/makesrna/intern/rna_mesh_api.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_mesh_api.c 2012-03-02 14:39:18 UTC (rev 44604)
+++ trunk/blender/source/blender/makesrna/intern/rna_mesh_api.c 2012-03-02 14:46:14 UTC (rev 44605)
@@ -67,6 +67,7 @@
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");
More information about the Bf-blender-cvs
mailing list