[Bf-blender-cvs] [ce1a6c1] soc-2014-remesh: Exhaustive method for calculating the path of the flow line. More comparisons on the scale to avoid vector field calculation is performed. Method to compute a random point, P, uniformly from within triangle ABC, method given by Robert Osada, Thomas Funkhouser, Bernard Chazelle, and David Dobkin. 2002. Shape distributions. ACM Trans. Graph. 21, 4 (October 2002), 807-832. DOI=10.1145/571647.571648 http://doi.acm.org/10.1145/571647.571648

Alexander Pinzon Fernandez noreply at git.blender.org
Thu Jul 31 03:42:16 CEST 2014


Commit: ce1a6c1ca6908f2293afb81d84cf7c2f50639ad4
Author: Alexander Pinzon Fernandez
Date:   Wed Jul 30 20:38:06 2014 -0500
Branches: soc-2014-remesh
https://developer.blender.org/rBce1a6c1ca6908f2293afb81d84cf7c2f50639ad4

Exhaustive method for calculating the path of the flow line.
More comparisons on the scale to avoid vector field calculation is performed.
Method to compute a random point, P, uniformly from within triangle ABC, method given by Robert Osada, Thomas Funkhouser, Bernard Chazelle, and David Dobkin. 2002. Shape distributions. ACM Trans. Graph. 21, 4 (October 2002), 807-832. DOI=10.1145/571647.571648 http://doi.acm.org/10.1145/571647.571648

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

M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/editors/object/object_intern.h
M	source/blender/editors/object/object_modifier.c
M	source/blender/editors/object/object_ops.c
M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/intern/MOD_quadremesh.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 6abc195..6f78241 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -992,22 +992,29 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         row.prop(md, "threshold")
 
     def QUADREMESH(self, layout, ob, md):
-        is_bind = md.is_bind
-
+        is_computeflow = md.is_computeflow
+        is_remesh = md.is_remesh
+		
         row = layout.row()
-        row.active = not is_bind
+        row.active = not is_computeflow
         row.label(text="Features Vertex Group:")
 
         row = layout.row()
-        row.enabled = not is_bind
+        row.enabled = not is_computeflow
         row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
 
         layout.separator()
 
         row = layout.row()
         row.enabled = bool(md.vertex_group)
-        row.operator("object.quadremesh_bind", text="Unbind" if is_bind else "Bind")        
+        row.operator("object.quadremesh_computeflow", text="Recompute Flow" if is_computeflow else "Compute Flow")        
 
+        layout.separator()
+
+        row = layout.row()
+        row.enabled = is_computeflow
+        row.operator("object.quadremesh_remesh", text="Remesh" if is_remesh else "Remesh")        
+		
     @staticmethod
     def vertex_weight_mask(layout, ob, md):
         layout.label(text="Influence/Mask Options:")
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index fd479a6..537fb5e 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -175,7 +175,8 @@ void OBJECT_OT_skin_loose_mark_clear(struct wmOperatorType *ot);
 void OBJECT_OT_skin_radii_equalize(struct wmOperatorType *ot);
 void OBJECT_OT_skin_armature_create(struct wmOperatorType *ot);
 void OBJECT_OT_laplaciandeform_bind(struct wmOperatorType *ot);
-void OBJECT_OT_quadremesh_bind(struct wmOperatorType *ot);
+void OBJECT_OT_quadremesh_computeflow(struct wmOperatorType *ot);
+void OBJECT_OT_quadremesh_remesh(struct wmOperatorType *ot);
 
 /* object_constraint.c */
 void OBJECT_OT_constraint_add(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index eb5cdc4..d023c2f 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -2228,50 +2228,95 @@ void OBJECT_OT_laplaciandeform_bind(wmOperatorType *ot)
 }
 
 
-/************************ QuadRemesh bind operator *********************/
+/************************ QuadRemesh compute flow operator *********************/
 
 static int quadremesh_poll(bContext *C)
 {
 	return edit_modifier_poll_generic(C, &RNA_QuadRemeshModifier, 0);
 }
 
-static int quadremesh_bind_exec(bContext *C, wmOperator *op)
+static int quadremesh_computeflow_exec(bContext *C, wmOperator *op)
 {
 	Object *ob = ED_object_active_context(C);
 	QuadRemeshModifierData *lmd = (QuadRemeshModifierData *)edit_modifier_property_get(op, ob, eModifierType_QuadRemesh);
 
 	if (!lmd)
 		return OPERATOR_CANCELLED;
-	if (lmd->flag & MOD_QUADREMESH_BIND) {
-		lmd->flag &= ~MOD_QUADREMESH_BIND;
+	if (lmd->flag & MOD_QUADREMESH_COMPUTE_FLOW) {
+		lmd->flag &= ~MOD_QUADREMESH_COMPUTE_FLOW;
 	}
 	else {
-		lmd->flag |= MOD_QUADREMESH_BIND;
+		lmd->flag |= MOD_QUADREMESH_COMPUTE_FLOW;
 	}
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 	WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
 	return OPERATOR_FINISHED;
 }
 
-static int quadremesh_bind_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
+static int quadremesh_computeflow_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 {
 	if (edit_modifier_invoke_properties(C, op))
-		return quadremesh_bind_exec(C, op);
+		return quadremesh_computeflow_exec(C, op);
 	else
 		return OPERATOR_CANCELLED;
 }
 
-void OBJECT_OT_quadremesh_bind(wmOperatorType *ot)
+void OBJECT_OT_quadremesh_computeflow(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name = "Quad Remesh Bind";
-	ot->description = "Bind mesh to system in Quad Remesh modifier";
-	ot->idname = "OBJECT_OT_quadremesh_bind";
+	ot->name = "Quad Remesh Compute Flow";
+	ot->description = "Compute gradient flow in Quad Remesh modifier";
+	ot->idname = "OBJECT_OT_quadremesh_computeflow";
 
 	/* api callbacks */
 	ot->poll = quadremesh_poll;
-	ot->invoke = quadremesh_bind_invoke;
-	ot->exec = quadremesh_bind_exec;
+	ot->invoke = quadremesh_computeflow_invoke;
+	ot->exec = quadremesh_computeflow_exec;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
+	edit_modifier_properties(ot);
+}
+
+/************************ QuadRemesh remesh operator *********************/
+
+static int quadremesh_remesh_exec(bContext *C, wmOperator *op)
+{
+	Object *ob = ED_object_active_context(C);
+	QuadRemeshModifierData *lmd = (QuadRemeshModifierData *)edit_modifier_property_get(op, ob, eModifierType_QuadRemesh);
+
+	if (!lmd)
+		return OPERATOR_CANCELLED;
+	if (lmd->flag & MOD_QUADREMESH_REMESH) {
+		lmd->flag &= ~MOD_QUADREMESH_REMESH;
+	}
+	else {
+		lmd->flag |= MOD_QUADREMESH_REMESH;
+	}
+	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+	WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
+	return OPERATOR_FINISHED;
+}
+
+static int quadremesh_remesh_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
+{
+	if (edit_modifier_invoke_properties(C, op))
+		return quadremesh_remesh_exec(C, op);
+	else
+		return OPERATOR_CANCELLED;
+}
+
+void OBJECT_OT_quadremesh_remesh(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Quad Remesh Remeshing";
+	ot->description = "Compute Remeshing modifier";
+	ot->idname = "OBJECT_OT_quadremesh_remesh";
+
+	/* api callbacks */
+	ot->poll = quadremesh_poll;
+	ot->invoke = quadremesh_remesh_invoke;
+	ot->exec = quadremesh_remesh_exec;
 
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 2d86ead..ede787e 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -247,7 +247,8 @@ void ED_operatortypes_object(void)
 	WM_operatortype_append(OBJECT_OT_lod_remove);
 
 	WM_operatortype_append(OBJECT_OT_vertex_random);
-	WM_operatortype_append(OBJECT_OT_quadremesh_bind);
+	WM_operatortype_append(OBJECT_OT_quadremesh_computeflow);
+	WM_operatortype_append(OBJECT_OT_quadremesh_remesh);
 }
 
 void ED_operatormacros_object(void)
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 5e2b0c0..1592059 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1372,7 +1372,8 @@ typedef struct QuadRemeshModifierData {
 
 /* QuadRemesh modifier flags */
 enum {
-	MOD_QUADREMESH_BIND = 1,
+	MOD_QUADREMESH_COMPUTE_FLOW = (1 << 1),
+	MOD_QUADREMESH_REMESH = (1 << 2)
 };
 
 
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index b4bd118..77eab61 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -608,10 +608,16 @@ static int rna_LaplacianDeformModifier_is_bind_get(PointerRNA *ptr)
 	return ((lmd->flag & MOD_LAPLACIANDEFORM_BIND) && (lmd->cache_system != NULL));
 }
 
-static int rna_QuadRemeshModifier_is_bind_get(PointerRNA *ptr)
+static int rna_QuadRemeshModifier_is_computeflow_get(PointerRNA *ptr)
 {
 	QuadRemeshModifierData *qmd = (QuadRemeshModifierData *)ptr->data;
-	return (qmd->flag & MOD_QUADREMESH_BIND);
+	return (qmd->flag & MOD_QUADREMESH_COMPUTE_FLOW);
+}
+
+static int rna_QuadRemeshModifier_is_remesh_get(PointerRNA *ptr)
+{
+	QuadRemeshModifierData *qmd = (QuadRemeshModifierData *)ptr->data;
+	return (qmd->flag & MOD_QUADREMESH_REMESH);
 }
 
 #else
@@ -3673,9 +3679,14 @@ static void rna_def_modifier_quadremesh(BlenderRNA *brna)
 		"Name of Vertex Group which determines feature points");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_QuadRemeshModifier_anchor_grp_name_set");
 
-	prop = RNA_def_property(srna, "is_bind", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_funcs(prop, "rna_QuadRemeshModifier_is_bind_get", NULL);
-	RNA_def_property_ui_text(prop, "Bound", "Whether geometry has been bound to anchors");
+	prop = RNA_def_property(srna, "is_computeflow", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_funcs(prop, "rna_QuadRemeshModifier_is_computeflow_get", NULL);
+	RNA_def_property_ui_text(prop, "Compute Flow", "Compute Gradient flow");
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+	prop = RNA_def_property(srna, "is_remesh", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_funcs(prop, "rna_QuadRemeshModifier_is_remesh_get", NULL);
+	RNA_def_property_ui_text(prop, "Remesh", "Apply the quatrilateral remeshing");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
diff --git a/source/blender/modifiers/intern/MOD_quadremesh.c b/source/blender/modifiers/intern/MOD_quadremesh.c
index 199659b..15e809b 100644
--- a/source/blender/modifiers/intern/MOD_quadremesh.c
+++ b/source/blender/modifiers/intern/MOD_quadremesh.c
@@ -1,4 +1,4 @@
-/*
+/*
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -29,6 +29,7 @@
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 #include "BLI_string.h"
+#include "BLI_rand.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -59,24 +60,25 @@ typedef struct LaplacianSystem {
 	int total_faces;
 	int total_features;
 	int total_gflines;
-	char features_grp_name[64];	/* Vertex Group name */
-	float(*co)[3];				/* Original vertex coordinates */
-	float(*no)[3];				/* Original face normal */
-	float(*gf1)[3];				/* Gradient Field g1 */
-	float(*gf2)[3];				/* Gradient Field g2 */
-	float *weights;				/* Feature points weights*/
-	float *U_field;				/* Initial scalar field*/
-	int *constraints;			/

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list