[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55835] branches/soc-2008-mxcurioni/source /blender: Removed Freestyle-specific code from DerivedMesh.c.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Sat Apr 6 08:09:09 CEST 2013


Revision: 55835
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55835
Author:   kjym3
Date:     2013-04-06 06:09:08 +0000 (Sat, 06 Apr 2013)
Log Message:
-----------
Removed Freestyle-specific code from DerivedMesh.c.

The removed code was necessary due to a logical bug in the use of CD_ORIGINDEX
layer entries.  Previously the index values were used to refer to the edges/polys
of the derived mesh, assuming that the derived mesh edges/polys consisted of those
from the original mesh plus newly added edges/polys.  This assumption was not
correct, although it worked well for several modifiers such as Mirror and Solidify.
Now the index values are specifically used to reference the edge/polys of the
original mesh.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/DerivedMesh.c
    branches/soc-2008-mxcurioni/source/blender/render/intern/source/convertblender.c

Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/DerivedMesh.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/DerivedMesh.c	2013-04-06 03:03:37 UTC (rev 55834)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/DerivedMesh.c	2013-04-06 06:09:08 UTC (rev 55835)
@@ -1841,36 +1841,6 @@
 		}
 	}
 
-#ifdef WITH_FREESTYLE
-	/* This Freestyle-specific code still needs to get the Subdivision Surface modifier working */
-	if (CustomData_has_layer(&me->edata, CD_FREESTYLE_EDGE)) {
-		FreestyleEdge *fed = DM_get_edge_data_layer(finaldm, CD_FREESTYLE_EDGE);
-		if (fed) {
-			FreestyleEdge *source = CustomData_get_layer(&me->edata, CD_FREESTYLE_EDGE);
-			int a;
-			for (a = 0; a < me->totedge; a++) {
-				fed[a].flag = source[a].flag;
-			}
-			for (; a < finaldm->numEdgeData; a++) {
-				fed[a].flag = 0;
-			}
-		}
-	}
-	if (CustomData_has_layer(&me->pdata, CD_FREESTYLE_FACE)) {
-		FreestyleFace *ffa = DM_get_poly_data_layer(finaldm, CD_FREESTYLE_FACE);
-		if (ffa) {
-			FreestyleFace *source = CustomData_get_layer(&me->pdata, CD_FREESTYLE_FACE);
-			int a;
-			for (a = 0; a < me->totpoly; a++) {
-				ffa[a].flag = source[a].flag;
-			}
-			for (; a < finaldm->numPolyData; a++) {
-				ffa[a].flag = 0;
-			}
-		}
-	}
-#endif
-
 #ifdef WITH_GAMEENGINE
 	/* NavMesh - this is a hack but saves having a NavMesh modifier */
 	if ((ob->gameflag & OB_NAVMESH) && (finaldm->type == DM_TYPE_CDDM)) {

Modified: branches/soc-2008-mxcurioni/source/blender/render/intern/source/convertblender.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/render/intern/source/convertblender.c	2013-04-06 03:03:37 UTC (rev 55834)
+++ branches/soc-2008-mxcurioni/source/blender/render/intern/source/convertblender.c	2013-04-06 06:09:08 UTC (rev 55835)
@@ -2696,7 +2696,7 @@
 #ifdef WITH_FREESTYLE
 			index_mf_to_mpoly= dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 			index_mp_to_orig= dm->getPolyDataArray(dm, CD_ORIGINDEX);
-			ffa= dm->getPolyDataArray(dm, CD_FREESTYLE_FACE);
+			ffa= CustomData_get_layer(&((Mesh *)ob->data)->pdata, CD_FREESTYLE_FACE);
 #endif
 
 			for (a=0; a<end; a++, mface++) {
@@ -3243,7 +3243,7 @@
 }
 
 #ifdef WITH_FREESTYLE
-static EdgeHash *make_freestyle_edge_mark_hash(DerivedMesh *dm)
+static EdgeHash *make_freestyle_edge_mark_hash(Mesh *me, DerivedMesh *dm)
 {
 	EdgeHash *edge_hash= BLI_edgehash_new();
 	FreestyleEdge *fed;
@@ -3254,7 +3254,7 @@
 	medge = dm->getEdgeArray(dm);
 	totedge = dm->getNumEdges(dm);
 	index = dm->getEdgeDataArray(dm, CD_ORIGINDEX);
-	fed = dm->getEdgeDataArray(dm, CD_FREESTYLE_EDGE);
+	fed = CustomData_get_layer(&me->edata, CD_FREESTYLE_EDGE);
 	if (fed) {
 		if (!index) {
 			for (a = 0; a < totedge; a++) {
@@ -3436,7 +3436,7 @@
 			EdgeHash *edge_hash;
 
 			/* create a hash table of Freestyle edge marks */
-			edge_hash = make_freestyle_edge_mark_hash(dm);
+			edge_hash = make_freestyle_edge_mark_hash(me, dm);
 #endif
 
 			/* store customdata names, because DerivedMesh is freed */
@@ -3478,7 +3478,7 @@
 #ifdef WITH_FREESTYLE
 					index_mf_to_mpoly= dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 					index_mp_to_orig= dm->getPolyDataArray(dm, CD_ORIGINDEX);
-					ffa= dm->getPolyDataArray(dm, CD_FREESTYLE_FACE);
+					ffa= CustomData_get_layer(&((Mesh *)ob->data)->pdata, CD_FREESTYLE_FACE);
 #endif
 					
 					for (a=0; a<end; a++, mface++) {




More information about the Bf-blender-cvs mailing list