[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43545] branches/bmesh/blender/source/ blender/blenkernel/intern: for CDDM' s dmcalcNormals now call CDDM_calc_normals(), not CDDM_calc_normals_mapping (), this means calculating normals will calculate MPoly and MVert normals but not tesselate the mesh (which is overkill for normal calculation anyway).

Campbell Barton ideasman42 at gmail.com
Fri Jan 20 00:34:59 CET 2012


Revision: 43545
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43545
Author:   campbellbarton
Date:     2012-01-19 23:34:53 +0000 (Thu, 19 Jan 2012)
Log Message:
-----------
for CDDM's dmcalcNormals now call CDDM_calc_normals(), not CDDM_calc_normals_mapping(), this means calculating normals will calculate MPoly and MVert normals but not tesselate the mesh (which is overkill for normal calculation anyway).

use CDDM_calc_normals over CDDM_calc_normals_mapping for editmode and ensure the final dm has tessfaces.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/blenkernel/intern/DerivedMesh.c
    branches/bmesh/blender/source/blender/blenkernel/intern/cdderivedmesh.c

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/DerivedMesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/DerivedMesh.c	2012-01-19 22:04:13 UTC (rev 43544)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/DerivedMesh.c	2012-01-19 23:34:53 UTC (rev 43545)
@@ -362,13 +362,13 @@
 	if ( (numTessFaces == 0) && (numPolys != 0)) {
 		dm->recalcTesselation(dm);
 
-		if (dm->getNumTessFaces(dm)) {
+		if (dm->getNumTessFaces(dm) != 0) {
+			/* printf("info %s: polys -> ngons calculated\n", __func__); */
+		}
+		else {
 			printf("warning %s: could not create tessfaces from %d polygons, dm->type=%d\n",
 			       __func__, numPolys, dm->type);
 		}
-		else {
-			printf("info %s: polys -> ngons calculated\n", __func__);
-		}
 	}
 }
 
@@ -1765,7 +1765,7 @@
 		if(!(cage_r && dm == *cage_r)) dm->release(dm);
 
 		CDDM_apply_vert_coords(*final_r, deformedVerts);
-		CDDM_calc_normals_mapping(*final_r);
+		CDDM_calc_normals(*final_r); /* was CDDM_calc_normals_mapping - campbell */
 	} else if (dm) {
 		*final_r = dm;
 		(*final_r)->calcNormals(*final_r); /* BMESH_ONLY - BMESH_TODO. check if this is needed */
@@ -1778,6 +1778,8 @@
 		(*final_r)->calcNormals(*final_r); /* BMESH_ONLY - BMESH_TODO. check if this is needed */
 	}
 
+	DM_ensure_tessface(*final_r); /* BMESH_ONLY */
+
 	/* add an orco layer if needed */
 	if(dataMask & CD_MASK_ORCO)
 		add_orco_dm(ob, em, *final_r, orcodm, CD_ORCO);

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/cdderivedmesh.c	2012-01-19 22:04:13 UTC (rev 43544)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/cdderivedmesh.c	2012-01-19 23:34:53 UTC (rev 43545)
@@ -1659,7 +1659,7 @@
 	dm->getEdgeDataArray = DM_get_edge_data_layer;
 	dm->getTessFaceDataArray = DM_get_tessface_data_layer;
 
-	dm->calcNormals = CDDM_calc_normals_mapping;
+	dm->calcNormals = CDDM_calc_normals;
 	dm->recalcTesselation = CDDM_recalc_tesselation;
 
 	dm->getVertCos = cdDM_getVertCos;



More information about the Bf-blender-cvs mailing list