[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59144] branches/soc-2013-sketch_mesh: Now the deformation method does not require static vertices, only with the handles can solve the system.

Alexander Pinzon apinzonf at gmail.com
Thu Aug 15 01:29:55 CEST 2013


Revision: 59144
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59144
Author:   apinzonf
Date:     2013-08-14 23:29:55 +0000 (Wed, 14 Aug 2013)
Log Message:
-----------
Now the deformation method does not require static vertices, only with the handles can solve the system.

Modified Paths:
--------------
    branches/soc-2013-sketch_mesh/release/scripts/startup/bl_ui/properties_data_modifier.py
    branches/soc-2013-sketch_mesh/source/blender/makesdna/DNA_modifier_types.h
    branches/soc-2013-sketch_mesh/source/blender/makesrna/intern/rna_modifier.c
    branches/soc-2013-sketch_mesh/source/blender/modifiers/intern/MOD_laplaciandeform.c

Modified: branches/soc-2013-sketch_mesh/release/scripts/startup/bl_ui/properties_data_modifier.py
===================================================================
--- branches/soc-2013-sketch_mesh/release/scripts/startup/bl_ui/properties_data_modifier.py	2013-08-14 21:21:00 UTC (rev 59143)
+++ branches/soc-2013-sketch_mesh/release/scripts/startup/bl_ui/properties_data_modifier.py	2013-08-14 23:29:55 UTC (rev 59144)
@@ -374,10 +374,8 @@
             row.operator("object.hook_assign", text="Assign")
 
     def LAPLACIANDEFORM(self, layout, ob, md):
-        layout.label(text="Static Anchors Vertex Group:")
-        layout.prop_search(md, "vertex_group_s", ob, "vertex_groups", text="")
-        layout.label(text="Handler Anchors Vertex Group:")
-        layout.prop_search(md, "vertex_group_h", ob, "vertex_groups", text="")
+        layout.label(text="Anchors Vertex Group:")
+        layout.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
 
     def LAPLACIANSMOOTH(self, layout, ob, md):
         layout.prop(md, "iterations")

Modified: branches/soc-2013-sketch_mesh/source/blender/makesdna/DNA_modifier_types.h
===================================================================
--- branches/soc-2013-sketch_mesh/source/blender/makesdna/DNA_modifier_types.h	2013-08-14 21:21:00 UTC (rev 59143)
+++ branches/soc-2013-sketch_mesh/source/blender/makesdna/DNA_modifier_types.h	2013-08-14 23:29:55 UTC (rev 59144)
@@ -1224,8 +1224,7 @@
 
 typedef struct LaplacianDeformModifierData {
 	ModifierData modifier;
-	char defgrp_name_s[64]; /* MAX_VGROUP_NAME */
-	char defgrp_name_h[64]; /* MAX_VGROUP_NAME */
+	char defgrp_name[64]; /* MAX_VGROUP_NAME */
 	void * custom_data;
 } LaplacianDeformModifierData;
 

Modified: branches/soc-2013-sketch_mesh/source/blender/makesrna/intern/rna_modifier.c
===================================================================
--- branches/soc-2013-sketch_mesh/source/blender/makesrna/intern/rna_modifier.c	2013-08-14 21:21:00 UTC (rev 59143)
+++ branches/soc-2013-sketch_mesh/source/blender/makesrna/intern/rna_modifier.c	2013-08-14 23:29:55 UTC (rev 59144)
@@ -763,18 +763,12 @@
 	rna_object_uvlayer_name_set(ptr, value, umd->uvlayer_name, sizeof(umd->uvlayer_name));
 }
 
-static void rna_LaplacianDeformModifier_vgroup_s_set(PointerRNA *ptr, const char *value)
+static void rna_LaplacianDeformModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
 	LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)ptr->data;
-	rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name_s, sizeof(lmd->defgrp_name_s));
+	rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
 }
 
-static void rna_LaplacianDeformModifier_vgroup_h_set(PointerRNA *ptr, const char *value)
-{
-	LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)ptr->data;
-	rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name_h, sizeof(lmd->defgrp_name_h));
-}
-
 #else
 
 static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const char type[])
@@ -3672,19 +3666,13 @@
 	RNA_def_struct_sdna(srna, "LaplacianDeformModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM);
 	
-	prop = RNA_def_property(srna, "vertex_group_s", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_sdna(prop, NULL, "defgrp_name_s");
-	RNA_def_property_ui_text(prop, "Vertex Group for Static Anchors",
-	                         "Name of Vertex Group which determines Static Anchors");
-	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LaplacianDeformModifier_vgroup_s_set");
+	prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+	RNA_def_property_ui_text(prop, "Vertex Group for Anchors",
+	                         "Name of Vertex Group which determines Anchors");
+	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LaplacianDeformModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
  
- 	prop = RNA_def_property(srna, "vertex_group_h", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_sdna(prop, NULL, "defgrp_name_h");
-	RNA_def_property_ui_text(prop, "Vertex Group for Handler Anchors",
-	                         "Name of Vertex Group which determines Handler Anchors");
-	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LaplacianDeformModifier_vgroup_h_set");
-	RNA_def_property_update(prop, 0, "rna_Modifier_update");
  
  
 }

Modified: branches/soc-2013-sketch_mesh/source/blender/modifiers/intern/MOD_laplaciandeform.c
===================================================================
--- branches/soc-2013-sketch_mesh/source/blender/modifiers/intern/MOD_laplaciandeform.c	2013-08-14 21:21:00 UTC (rev 59143)
+++ branches/soc-2013-sketch_mesh/source/blender/modifiers/intern/MOD_laplaciandeform.c	2013-08-14 23:29:55 UTC (rev 59144)
@@ -53,8 +53,8 @@
 
 #include "ONL_opennl.h"
 
-struct BStaticAnchors {
-	int numStatics;				/* Number of static anchors*/
+struct BAnchors {
+	int numAnchors;				/* Number of static anchors*/
 	int numVerts;				/* Number of verts*/
 	int * list_index;			/* Static vertex index list*/
 	float (*co)[3];				/* Original vertex coordinates*/
@@ -62,52 +62,40 @@
 	BMVert ** list_verts;		/* Vertex order by index*/
 	BMesh *bm;
 };
-typedef struct BStaticAnchors StaticAnchors;
+typedef struct BAnchors Anchors;
 
-struct BHandlerAnchors {
-	int numHandlers;			/* Number of handler anchors*/
-	int * list_handlers;		/* Static vertex index list*/
-};
-typedef struct BHandlerAnchors HandlerAnchors;
-
 struct BLaplacianSystem {
 	float (*delta)[3];			/* Differential Coordinates*/
 	int *list_uverts;			/* Unit vectors of projected edges onto the plane orthogonal to  n*/
 	/* Pointers to data*/
 	int numVerts;
-	int numHandlers;
-	int numStatics;
+	int numAnchors;
 	NLContext *context;			/* System for solve general implicit rotations*/
 };
 typedef struct BLaplacianSystem LaplacianSystem;
 
 enum {
 	LAP_STATE_INIT = 1,
-	LAP_STATE_HAS_STATIC,
-	LAP_STATE_HAS_HANDLER,
-	LAP_STATE_HAS_STATIC_AND_HANDLER,
+	LAP_STATE_HAS_ANCHORS,
 	LAP_STATE_HAS_L_COMPUTE,
 	LAP_STATE_UPDATE_REQUIRED
 };
 
 struct BSystemCustomData {
 	LaplacianSystem * sys;
-	StaticAnchors  * sa;
-	HandlerAnchors * shs;
+	Anchors  * achs;
 	int stateSystem;
 	bool update_required;
 };
 
 typedef struct BSystemCustomData SystemCustomData;
 
-static StaticAnchors * init_static_anchors(int numv, int nums);
-static HandlerAnchors * init_handler_anchors(int numh);
-static LaplacianSystem * init_laplacian_system(int numv, int nums, int numh);
+static Anchors * init_anchors(int numv, int numa);
+static LaplacianSystem * init_laplacian_system(int numv, int numa);
 static float cotan_weight(float *v1, float *v2, float *v3);
 static void compute_implict_rotations(SystemCustomData * data);
 static void delete_void_pointer(void *data);
-static void delete_static_anchors(StaticAnchors * sa);
-static void delete_handler_anchors(HandlerAnchors * sh);
+static void delete_anchors(Anchors * sa);
 static void delete_laplacian_system(LaplacianSystem *sys);
 static void init_laplacian_matrix( SystemCustomData * data);
 static void rotate_differential_coordinates(SystemCustomData * data);
@@ -122,13 +110,13 @@
 	}
 }
 
-static StaticAnchors * init_static_anchors(int numv, int nums)
+static Anchors * init_anchors(int numv, int numa)
 {
-	StaticAnchors * sa;
-	sa = (StaticAnchors *)MEM_callocN(sizeof(StaticAnchors), "LapStaticAnchors");
+	Anchors * sa;
+	sa = (Anchors *)MEM_callocN(sizeof(Anchors), "LapAnchors");
 	sa->numVerts = numv;
-	sa->numStatics = nums;
-	sa->list_index = (int *)MEM_callocN(sizeof(int)*(sa->numStatics), "LapListStatics");
+	sa->numAnchors = numa;
+	sa->list_index = (int *)MEM_callocN(sizeof(int)*(sa->numAnchors), "LapListAnchors");
 	sa->list_verts = (BMVert**)MEM_callocN(sizeof(BMVert*)*(sa->numVerts), "LapListverts");
 	sa->co = (float (*)[3])MEM_callocN(sizeof(float)*(sa->numVerts*3), "LapCoordinates");
 	sa->no = (float (*)[3])MEM_callocN(sizeof(float)*(sa->numVerts*3), "LapNormals");
@@ -136,17 +124,8 @@
 	return sa;
 }
 
-static HandlerAnchors * init_handler_anchors(int numh)
+static LaplacianSystem * init_laplacian_system(int numv, int numa)
 {
-	HandlerAnchors * sh;
-	sh = (HandlerAnchors *)MEM_callocN(sizeof(HandlerAnchors), "LapHandlerAnchors");
-	sh->numHandlers = numh;
-	sh->list_handlers = (int *)MEM_callocN(sizeof(int)*(sh->numHandlers), "LapListHandlers");
-	return sh;
-}
-
-static LaplacianSystem * init_laplacian_system(int numv, int nums, int numh)
-{
 	LaplacianSystem *sys;
 	int rows, cols;
 	sys = (LaplacianSystem *)MEM_callocN(sizeof(LaplacianSystem), "LapSystem");
@@ -154,9 +133,8 @@
 		return NULL;
 	}
 	sys->numVerts = numv;
-	sys->numStatics = nums;
-	sys->numHandlers = numh;
-	rows = (sys->numVerts + sys->numStatics + sys->numHandlers) * 3;
+	sys->numAnchors = numa;
+	rows = (sys->numVerts + sys->numAnchors) * 3;
 	cols = sys->numVerts * 3;
 	sys->list_uverts = (int *)MEM_callocN(sizeof(BMVert *) * sys->numVerts, "LapUverts");
 	sys->delta = (float (*)[3])MEM_callocN(sizeof(float) * sys->numVerts * 3, "LapDelta");
@@ -164,7 +142,7 @@
 	return sys;
 }
 
-static void delete_static_anchors(StaticAnchors * sa)
+static void delete_anchors(Anchors * sa)
 {
 	if (!sa) return;
 	delete_void_pointer(sa->co);
@@ -176,14 +154,6 @@
 	sa = NULL;
 }
 
-static void delete_handler_anchors(HandlerAnchors * sh)
-{
-	if (!sh) return;
-	delete_void_pointer(sh->list_handlers);
-	delete_void_pointer(sh);
-	sh = NULL;
-}
-
 static void delete_laplacian_system(LaplacianSystem *sys)
 {
 	if (!sys) return;
@@ -199,28 +169,18 @@
 	if (!data) return;
 	switch(data->stateSystem) {
 		case LAP_STATE_INIT:
-			if (state == LAP_STATE_HAS_STATIC || state == LAP_STATE_HAS_HANDLER) {
+			if (state == LAP_STATE_HAS_ANCHORS) {
 				data->stateSystem = state;
 			}
 			break;
-		case LAP_STATE_HAS_STATIC:
-			if (state == LAP_STATE_HAS_HANDLER) {
-				data->stateSystem = LAP_STATE_HAS_STATIC_AND_HANDLER;
-			}
-			break;
-		case LAP_STATE_HAS_HANDLER:
-			if (state == LAP_STATE_HAS_STATIC)  {
-				data->stateSystem = LAP_STATE_HAS_STATIC_AND_HANDLER;
-			}
-			break;
-		case LAP_STATE_HAS_STATIC_AND_HANDLER:
+		case LAP_STATE_HAS_ANCHORS:
 			if (state == LAP_STATE_HAS_L_COMPUTE) {
 				data->stateSystem = LAP_STATE_HAS_L_COMPUTE;
 			} 
 			break;
 		case LAP_STATE_HAS_L_COMPUTE:
-			if (state == LAP_STATE_HAS_STATIC || state == LAP_STATE_HAS_HANDLER) {

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list