[Bf-blender-cvs] [65e4095] soc-2013-sketch_mesh: I adjusted some variables names. The modifier sends a message on screen if the system not found a solution: (The Modifier not determines if a system is soluble, the numeric solver OpenNL Superlu notifies if solution was found.) Fix bugs: - Load file in a correct way. - Delete vertex co (float array) when the bind flag is false.

Alexander Pinzon Fernandez noreply at git.blender.org
Fri Nov 22 21:09:51 CET 2013


Commit: 65e409541c6f48b34d657b1c54ae94b4ca46d076
Author: Alexander Pinzon Fernandez
Date:   Fri Nov 22 15:04:11 2013 -0500
http://developer.blender.org/rB65e409541c6f48b34d657b1c54ae94b4ca46d076

I adjusted some variables names.
The modifier sends a message on screen if the system not found a solution: (The Modifier not determines if a system is soluble, the numeric solver OpenNL Superlu notifies if solution was found.)
Fix bugs:
- Load file in a correct way.
- Delete vertex co (float array) when the bind flag is false.

===================================================================

M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/modifiers/intern/MOD_laplaciandeform.c

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index d585573..872d0a0 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4823,13 +4823,13 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 				direct_link_curvemapping(fd, wmd->cmap_curve);
 		}
 		else if (md->type == eModifierType_LaplacianDeform) {
-			LaplacianDeformModifierData *wmd = (LaplacianDeformModifierData *)md;
+			LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md;
 			
-			wmd->vertexco = newdataadr(fd, wmd->vertexco);
+			lmd->vertexco = newdataadr(fd, lmd->vertexco);
 			if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
-				BLI_endian_switch_float_array(wmd->vertexco, wmd->total_verts*3);
+				BLI_endian_switch_float_array(lmd->vertexco, lmd->total_verts*3);
 			}
-			wmd->cacheSystem = NULL;
+			lmd->cacheSystem = NULL;
 		}
 	}
 }
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index ec98d8d..83346dc 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1475,9 +1475,9 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
 				write_curvemapping(wd, wmd->cmap_curve);
 		}
 		else if(md->type==eModifierType_LaplacianDeform) {
-			LaplacianDeformModifierData *ldmd = (LaplacianDeformModifierData*) md;
+			LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData*) md;
 			
-			writedata(wd, DATA, sizeof(float)*ldmd->total_verts*3, ldmd->vertexco);
+			writedata(wd, DATA, sizeof(float)*lmd->total_verts*3, lmd->vertexco);
 		}
 	}
 }
diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c
index 0bed3fd..0471539 100644
--- a/source/blender/modifiers/intern/MOD_laplaciandeform.c
+++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c
@@ -476,9 +476,9 @@ static void laplacianDeformPreview(LaplacianSystem *sys, float (*vertexCos)[3])
 		}
 		for (i = 0; i < na; i++) {
 			vid = sys->index_anchors[i];
-			nlRightHandSideSet(0, n + i, sys->co[vid][0]);
-			nlRightHandSideSet(1, n + i, sys->co[vid][1]);
-			nlRightHandSideSet(2, n + i, sys->co[vid][2]);
+			nlRightHandSideSet(0, n + i, vertexCos[vid][0]);
+			nlRightHandSideSet(1, n + i, vertexCos[vid][1]);
+			nlRightHandSideSet(2, n + i, vertexCos[vid][2]);
 			nlMatrixAdd(n + i, vid, 1.0f);
 		}
 		nlEnd(NL_MATRIX);
@@ -493,9 +493,9 @@ static void laplacianDeformPreview(LaplacianSystem *sys, float (*vertexCos)[3])
 
 				for (i = 0; i < na; i++) {
 					vid = sys->index_anchors[i];
-					nlRightHandSideSet(0, n + i, sys->co[vid][0]);
-					nlRightHandSideSet(1, n + i, sys->co[vid][1]);
-					nlRightHandSideSet(2, n + i, sys->co[vid][2]);
+					nlRightHandSideSet(0, n + i, vertexCos[vid][0]);
+					nlRightHandSideSet(1, n + i, vertexCos[vid][1]);
+					nlRightHandSideSet(2, n + i, vertexCos[vid][2]);
 				}
 
 				nlEnd(NL_MATRIX);
@@ -698,9 +698,9 @@ static void LaplacianDeformModifier_do(
 			sys = lmd->cacheSystem;
 			deleteLaplacianSystem(sys);
 			lmd->cacheSystem = NULL;
-			lmd->total_verts = 0;
-			MEM_SAFE_FREE(lmd->vertexco);
 		}
+		lmd->total_verts = 0;
+		MEM_SAFE_FREE(lmd->vertexco);
 		return;
 	}
 	if (lmd->cacheSystem) {
@@ -756,6 +756,9 @@ static void LaplacianDeformModifier_do(
 			}
 		}
 	}
+	if (sys->is_matrix_computed && !sys->has_solution) {
+		modifier_setError(&lmd->modifier, "The system not found a solution.");
+	}
 }




More information about the Bf-blender-cvs mailing list