[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38088] branches/soc-2011-avocado/blender: Some unused code removal and an attempt to call seam unwrap function from the autoseam operator .

shuvro sarker shuvro05 at gmail.com
Mon Jul 4 19:36:29 CEST 2011


Revision: 38088
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38088
Author:   shuvro
Date:     2011-07-04 17:36:29 +0000 (Mon, 04 Jul 2011)
Log Message:
-----------
Some unused code removal and an attempt to call seam unwrap function from the autoseam operator.

Modified Paths:
--------------
    branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp
    branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.h
    branches/soc-2011-avocado/blender/intern/autoseam/autoseam_C_API.cpp
    branches/soc-2011-avocado/blender/source/blender/editors/include/ED_uvedit.h
    branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.c
    branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.h
    branches/soc-2011-avocado/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c

Modified: branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp	2011-07-04 15:33:39 UTC (rev 38087)
+++ branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp	2011-07-04 17:36:29 UTC (rev 38088)
@@ -22,8 +22,7 @@
     threshold_value = min_value;
 }
 
-// TODO_SHUVRO: this should be renamed to is_adjacent to make the purpose clearer
-int AutoseamAdjacency::get(int row, int col)
+int AutoseamAdjacency::is_adjacent(int row, int col)
 {
     return m_adjacency(row, col) >  THRESHOLD_ZERO ? 1 : 0;
 }

Modified: branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.h
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.h	2011-07-04 15:33:39 UTC (rev 38087)
+++ branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.h	2011-07-04 17:36:29 UTC (rev 38088)
@@ -16,7 +16,7 @@
         
         void set_min_value(float min_value);
         void set(int row, int col, float value);
-        int get(int row, int col);
+        int is_adjacent(int row, int col);
         const Eigen::MatrixXd& getMatrix() const { return m_adjacency; }
         bool generate_seam();
         void clear_eigenspaces();

Modified: branches/soc-2011-avocado/blender/intern/autoseam/autoseam_C_API.cpp
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/autoseam_C_API.cpp	2011-07-04 15:33:39 UTC (rev 38087)
+++ branches/soc-2011-avocado/blender/intern/autoseam/autoseam_C_API.cpp	2011-07-04 17:36:29 UTC (rev 38088)
@@ -78,7 +78,7 @@
 int autoseam_is_adjacent(AUTOSEAM_Adjacency handle, int row, int col)
 {
     AutoseamAdjacency *adj = reinterpret_cast<AutoseamAdjacency*>(handle);
-    return adj->get(row, col)? 1 : 0;
+    return adj->is_adjacent(row, col)? 1 : 0;
 }
 
 float autoseam_get_value(AUTOSEAM_Adjacency handle, int row, int col)

Modified: branches/soc-2011-avocado/blender/source/blender/editors/include/ED_uvedit.h
===================================================================
--- branches/soc-2011-avocado/blender/source/blender/editors/include/ED_uvedit.h	2011-07-04 15:33:39 UTC (rev 38087)
+++ branches/soc-2011-avocado/blender/source/blender/editors/include/ED_uvedit.h	2011-07-04 17:36:29 UTC (rev 38088)
@@ -77,6 +77,7 @@
 
 /* single call up unwrap using scene settings, used for edge tag unwrapping */
 void ED_unwrap_lscm(struct Scene *scene, struct Object *obedit, const short sel);
+//int ED_uvedit_ensure_uvs(bContext *C, Scene *scene, Object *obedit);
 
 /* uvedit_draw.c */
 void draw_uvedit_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene, struct Object *obedit);

Modified: branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.c
===================================================================
--- branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.c	2011-07-04 15:33:39 UTC (rev 38087)
+++ branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.c	2011-07-04 17:36:29 UTC (rev 38088)
@@ -28,11 +28,8 @@
 
 #include "autoseam_tools.h"
 
-// TODO_SHUVRO: this should be removed since it is not used
-int get_sign(float number){
-    return number > 0.0 ? 1 : 2;
-}
 
+
 /* ------------------------ Code from Andrea ------------------------ */
 static int find_index(int index, int* face_indices, int nindices)
 {
@@ -355,6 +352,7 @@
 
 static int generate_seam_exec(bContext *C, wmOperator *op)
 {
+    Scene *scene= CTX_data_scene(C);
     Object *obedit= CTX_data_edit_object(C);
     Mesh *me= ((Mesh *)obedit->data);
     BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
@@ -363,7 +361,11 @@
     //AUTOSEAM_Adjacency adj_big;
 	int maxdepth= RNA_int_get(op->ptr, "depth");
     int is_combinatorial = RNA_boolean_get(op->ptr, "is_combinatorial");
+    int method = RNA_enum_get(op->ptr, "method");
+	int fill_holes = RNA_boolean_get(op->ptr, "fill_holes");
+	int correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect");
 
+
     int num_faces;
         
     me->drawflag |= ME_DRAWSEAMS;
@@ -391,6 +393,23 @@
     /* This function will call the recusive function for each of the components of bmesh*/
     handle_separate_components(adj, num_faces, bm, maxdepth);
     
+    /* add uvs if they don't exist yet */
+//	if(!ED_uvedit_ensure_uvs(C, scene, obedit)) {
+//		return OPERATOR_CANCELLED;
+//	}
+    
+	/* remember last method for live unwrap */
+	scene->toolsettings->unwrapper = method;
+    
+	if(fill_holes)		scene->toolsettings->uvcalc_flag |=  UVCALC_FILLHOLES;
+	else				scene->toolsettings->uvcalc_flag &= ~UVCALC_FILLHOLES;
+    
+	if(correct_aspect)	scene->toolsettings->uvcalc_flag &= ~UVCALC_NO_ASPECT_CORRECT;
+	else				scene->toolsettings->uvcalc_flag |=  UVCALC_NO_ASPECT_CORRECT;
+
+    
+    //ED_unwrap_lscm(scene, obedit, TRUE);
+    
     //autoseam_delete_adjacency(adj_big);
     
     /*reset the min_value*/
@@ -405,6 +424,11 @@
 
 void MESH_OT_generate_seam(wmOperatorType *ot)
 {
+    static EnumPropertyItem method_items[] = {
+		{0, "ANGLE_BASED", 0, "Angle Based", ""},
+		{1, "CONFORMAL", 0, "Conformal", ""},
+		{0, NULL, 0, NULL, NULL}};
+    
 	/* identifiers */
 	ot->name= "Generate Seam";
 	ot->idname= "MESH_OT_generate_seam";
@@ -418,21 +442,16 @@
 	/* flags */
 	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 	
-	RNA_def_int(ot->srna, "depth", 2, 0, 6, "Recursion Depth", "Max. recursion depth", 0, 6);
+	RNA_def_int(ot->srna, "depth", 1, 0, 6, "Recursion Depth", "Max. recursion depth", 0, 6);
     RNA_def_boolean(ot->srna, "is_combinatorial", 1, "Calculate Combinatorial", "Store combinatorial edge distance in dual graph.");
+    RNA_def_enum(ot->srna, "method", method_items, 0, "Method", "Unwrapping method. Angle Based usually gives better results than Conformal, while being somewhat slower.");
+	RNA_def_boolean(ot->srna, "fill_holes", 1, "Fill Holes", "Virtual fill holes in mesh before unwrapping, to better avoid overlaps and preserve symmetry.");
+	RNA_def_boolean(ot->srna, "correct_aspect", 1, "Correct Aspect", "Map UV's taking image aspect ratio into account.");
 
 }
 
 
-/* TODO_SHUVRO: this should be removed as it is not used anymore */
-void calculate_eigen(float **dual_graph, int dimension, float **eigen_vectors, float *eigen_values)
-{
-    AUTOSEAM_UtilityClassHandle handle = autoseam_create_utility();
-    
-    autoseam_calculate_eigen(handle, dual_graph, dimension, eigen_vectors, eigen_values);
 
-	autoseam_delete_utility(handle);
-}
 
 
 

Modified: branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.h
===================================================================
--- branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.h	2011-07-04 15:33:39 UTC (rev 38087)
+++ branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.h	2011-07-04 17:36:29 UTC (rev 38088)
@@ -59,6 +59,7 @@
 #include "ED_screen.h"
 #include "MEM_guardedalloc.h"
 #include "WM_api.h"
+#include "ED_uvedit.h"
 
 #define INF 999999
 

Modified: branches/soc-2011-avocado/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c
===================================================================
--- branches/soc-2011-avocado/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c	2011-07-04 15:33:39 UTC (rev 38087)
+++ branches/soc-2011-avocado/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c	2011-07-04 17:36:29 UTC (rev 38088)
@@ -83,7 +83,7 @@
 #include "uvedit_intern.h"
 #include "uvedit_parametrizer.h"
 
-static int ED_uvedit_ensure_uvs(bContext *C, Scene *scene, Object *obedit)
+int ED_uvedit_ensure_uvs(bContext *C, Scene *scene, Object *obedit)
 {
 	BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh;
 	BMFace *efa;




More information about the Bf-blender-cvs mailing list