[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15683] branches/soc-2008-jaguarandi/ source/blender/blenkernel/intern/shrinkwrap.c: Fixed a bug relative to editmode..

André Pinto andresusanopinto at gmail.com
Tue Jul 22 00:36:07 CEST 2008


Revision: 15683
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15683
Author:   jaguarandi
Date:     2008-07-22 00:36:05 +0200 (Tue, 22 Jul 2008)

Log Message:
-----------
Fixed a bug relative to editmode.. 
now its calling CDDM_calc_normals when receiving a mesh to deform,
since in edit mode the mesh doenst has normals calculated

Modified Paths:
--------------
    branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/shrinkwrap.c

Modified: branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/shrinkwrap.c
===================================================================
--- branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/shrinkwrap.c	2008-07-21 22:07:51 UTC (rev 15682)
+++ branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/shrinkwrap.c	2008-07-21 22:36:05 UTC (rev 15683)
@@ -1096,7 +1096,8 @@
 
 		if(calc.smd->cutPlane)
 		{
-			calc.target = (DerivedMesh *)calc.smd->cutPlane->derivedFinal;
+			//TODO currently we need a copy in case object_get_derived_final returns an emDM that does not defines getVertArray or getFace array
+			calc.target = CDDM_copy( object_get_derived_final(calc.smd->cutPlane, CD_MASK_BAREMESH) );
 
 			if(!calc.target)
 			{
@@ -1139,6 +1140,7 @@
 
 		//free memory
 		calc.final->release(calc.final);
+		calc.target->release(calc.target);
 	}	
 
 }
@@ -1164,6 +1166,8 @@
 		return dm;
 	}
 
+	CDDM_calc_normals(calc.final);	//Normals maybe not be calculated yet
+
 	//remove loop dependencies on derived meshs (TODO should this be done elsewhere?)
 	if(smd->target == ob) smd->target = NULL;
 	if(smd->cutPlane == ob) smd->cutPlane = NULL;
@@ -1219,7 +1223,7 @@
 				if(calc.moved)
 				{
 					//Adjust vertxs that didn't moved (project to cut plane)
-//					shrinkwrap_projectToCutPlane(&calc);
+					shrinkwrap_projectToCutPlane(&calc);
 
 					//Destroy faces, edges and stuff
 					shrinkwrap_removeUnused(&calc);
@@ -1552,9 +1556,10 @@
 
 		if(use_normal & MOD_SHRINKWRAP_ALLOW_DEFAULT_NORMAL)
 		{
-
+/*
 			if(limit_tree)
 				normal_projection_project_vertex(0, tmp_co, tmp_no, &local2cut, limit_tree, &hit, limit_callback, &limit_userdata);
+*/
 
 			if(normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, tmp_no, &calc->local2target, tree, &hit, callback, &userdata))
 				moved = TRUE;
@@ -1565,10 +1570,10 @@
 		{
 			float inv_no[3] = { -tmp_no[0], -tmp_no[1], -tmp_no[2] };
 
-
+/*
 			if(limit_tree)
 				normal_projection_project_vertex(0, tmp_co, inv_no, &local2cut, limit_tree, &hit, limit_callback, &limit_userdata);
-
+*/
 			if(normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, inv_no, &calc->local2target, tree, &hit, callback, &userdata))
 				moved = TRUE;
 		}





More information about the Bf-blender-cvs mailing list