[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38465] branches/soc-2011-avocado/blender: Finished some of the tasks mentioned in the review of Brecht.
shuvro sarker
shuvro05 at gmail.com
Mon Jul 18 06:53:42 CEST 2011
Revision: 38465
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38465
Author: shuvro
Date: 2011-07-18 04:53:42 +0000 (Mon, 18 Jul 2011)
Log Message:
-----------
Finished some of the tasks mentioned in the review of Brecht. The review page link is http://wiki.blender.org/index.php/User_talk:Shuvro/soc2011
Modified Paths:
--------------
branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp
branches/soc-2011-avocado/blender/intern/autoseam/AutoseamEigenspace.cpp
branches/soc-2011-avocado/blender/intern/autoseam/CMakeLists.txt
branches/soc-2011-avocado/blender/intern/autoseam/autoseam_C_API.cpp
branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.c
branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.h
Modified: branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp 2011-07-18 04:01:57 UTC (rev 38464)
+++ branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp 2011-07-18 04:53:42 UTC (rev 38465)
@@ -26,9 +26,10 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#include "AutoseamAdjacency.h"
#include <stdio.h>
#include <fstream>
+#include "BKE_report.h"
+#include "AutoseamAdjacency.h"
#define THRESHOLD_ZERO 0.0005
AutoseamAdjacency::AutoseamAdjacency(int dimension)
Modified: branches/soc-2011-avocado/blender/intern/autoseam/AutoseamEigenspace.cpp
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/AutoseamEigenspace.cpp 2011-07-18 04:01:57 UTC (rev 38464)
+++ branches/soc-2011-avocado/blender/intern/autoseam/AutoseamEigenspace.cpp 2011-07-18 04:53:42 UTC (rev 38465)
@@ -25,8 +25,9 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+
+#include <fstream>
#include "AutoseamEigenspace.h"
-#include <fstream>
#define THRESHOLD_ZERO 0.0001
Modified: branches/soc-2011-avocado/blender/intern/autoseam/CMakeLists.txt
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/CMakeLists.txt 2011-07-18 04:01:57 UTC (rev 38464)
+++ branches/soc-2011-avocado/blender/intern/autoseam/CMakeLists.txt 2011-07-18 04:53:42 UTC (rev 38465)
@@ -27,6 +27,13 @@
set(INC
../../extern/Eigen3
../../source/blender/bmesh
+ ../../source/blender/blenkernel
+ ../../source/blender/blenloader
+ ../../source/blender/blenlib
+ ../../source/blender/makesdna
+ ../../source/blender/makesrna
+ ../../source/blender/windowmanager
+ ../guardedalloc
)
set(SRC
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-18 04:01:57 UTC (rev 38464)
+++ branches/soc-2011-avocado/blender/intern/autoseam/autoseam_C_API.cpp 2011-07-18 04:53:42 UTC (rev 38465)
@@ -26,12 +26,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <fstream>
#include "AutoseamUtility.h"
-#include "autoseam_C_API.h"
#include "AutoseamAdjacency.h"
+#include "autoseam_C_API.h"
-#include <fstream>
-
AUTOSEAM_UtilityClassHandle autoseam_create_utility()
{
AutoseamUtility *utility = new AutoseamUtility();
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-18 04:01:57 UTC (rev 38464)
+++ branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.c 2011-07-18 04:53:42 UTC (rev 38465)
@@ -26,15 +26,56 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#include "autoseam_tools.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "DNA_object_types.h"
+#include "RNA_types.h"
+#include "RNA_define.h"
+#include "RNA_access.h"
+
+
#include "BLI_array.h"
#include "BLI_math.h"
+#include "bmesh.h"
+
#include "bmesh_private.h"
+#include "WM_types.h"
+#include "BKE_material.h"
+#include "BKE_context.h"
+#include "BKE_customdata.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_cdderivedmesh.h"
+#include "BKE_depsgraph.h"
+#include "BKE_global.h"
+#include "BKE_mesh.h"
+#include "BKE_object.h"
+#include "BKE_bmesh.h"
+#include "BKE_report.h"
+#include "BKE_tessmesh.h"
+#include "BKE_main.h"
+#include "ED_screen.h"
+#include "ED_uvedit.h"
+#include "MEM_guardedalloc.h"
+#include "WM_api.h"
+#include "autoseam_C_API.h"
+#define INF 999999
+
+static float min_value = INF;
+enum GraphNodeColor { White, Gray, Black };
+static void autoseam_clear_seam(BMesh *bm);
+static int generate_seam_recursive(BMesh *bm, AUTOSEAM_Adjacency adj, AUTOSEAM_Adjacency adj_big, int recursion_depth, bContext *C, float stretch);
+static int find_element_in_array(int element, int *array, int num_array_element);
+
+
+
+
/* ------------------------ Code from Andrea ------------------------ */
static void autoseam_clear_seam(BMesh *bm)
{
@@ -96,7 +137,7 @@
}
}
-int find_element_in_array(int element, int *array, int num_array_element)
+static int find_element_in_array(int element, int *array, int num_array_element)
{
int i;
for(i = 0; i < num_array_element; i++)
@@ -163,7 +204,7 @@
}
}
-void depth_first_search(const AUTOSEAM_Adjacency adjacency, int u, enum GraphNodeColor state[], int* num_nodes, int *component, int *component_size, int *remaining_nodes)
+static void depth_first_search(const AUTOSEAM_Adjacency adjacency, int u, enum GraphNodeColor state[], int* num_nodes, int *component, int *component_size, int *remaining_nodes)
{
int v;
state[u] = Gray;
@@ -184,7 +225,7 @@
*component_size = *component_size + 1;
}
-int handle_separate_components(AUTOSEAM_Adjacency adj, int num_nodes, BMesh *bm, int recursion_depth, bContext *C)
+static int handle_separate_components(AUTOSEAM_Adjacency adj, int num_nodes, BMesh *bm, int recursion_depth, bContext *C)
{
int i, j, k;
int remaining_nodes = num_nodes;
@@ -253,7 +294,7 @@
/* It calculates stretch for a single triangulated mesh */
-float stretch_of_triangulated_face(BMLoop **looptris, BMesh *bm)
+static float stretch_of_triangulated_face(BMLoop **looptris, BMesh *bm)
{
int i;
float a,c,T, face_area;
@@ -277,7 +318,6 @@
return 1e10f;
w = 1.0f/(2.0f*face_area);
-
// compute derivatives
copy_v3_v3(Ps, v[0]);
@@ -316,7 +356,7 @@
}
-float total_stretch_of_mesh(bContext *C)
+static float total_stretch_of_mesh(bContext *C)
{
int i;
Scene *scene= CTX_data_scene(C);
@@ -340,14 +380,14 @@
return total_stretch;
}
-float average_stretch_of_mesh(bContext *C)
+static float average_stretch_of_mesh(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
return (float)(total_stretch_of_mesh(C)/em->tottri);
}
-float maximum_stretch_of_mesh(bContext *C)
+static float maximum_stretch_of_mesh(bContext *C)
{
int i;
float max_stretch = -FLT_MAX;
@@ -369,49 +409,49 @@
return max_stretch;
}
-int generate_seam_recursive(BMesh *bm, AUTOSEAM_Adjacency adj, AUTOSEAM_Adjacency adj_big, int recursion_depth, bContext *C, float stretch)
+static int generate_seam_recursive(BMesh *bm, AUTOSEAM_Adjacency adj, AUTOSEAM_Adjacency adj_big, int recursion_depth, bContext *C, float stretch)
{
int s;
int i, j;
int num_faces;
int *fplus, *fminus;
unsigned int nplus, nminus;
+ float local_stretch;
+
-
AUTOSEAM_Adjacency adj_plus;
AUTOSEAM_Adjacency adj_minus;
-
-
- if(stretch < 0.0){
- //stretch = stretch_of_mesh(C);
- stretch = FLT_MAX;
- }
- /* This is for total_stretch */
- else{
- float temp = total_stretch_of_mesh(C);
- /* stretch is increasing, so stop here*/
- if(temp > stretch) return 0;
- else stretch = temp;
- }
- /* This is for average stretch */
- // else{
- // float temp = average_stretch_of_mesh(C);
- // /* stretch is increasing, so stop here*/
- // if(temp > stretch) return 0;
- // else stretch = temp;
- // }
- //
- // /* This is for maximum stretch of the mesh */
- // else{
- // float temp = maximum_stretch_of_mesh(C);
- // /* stretch is increasing, so stop here*/
- // if(temp > stretch) return 0;
- // else stretch = temp;
- // }
-
-
-
-
+
+
+ if(stretch < 0.0){
+ //stretch = total_stretch_of_mesh(C);
+ //stretch = FLT_MAX;
+ local_stretch = FLT_MAX;
+ }
+ /* This is for total_stretch */
+ else{
+ float temp = total_stretch_of_mesh(C);
+ /* stretch is increasing, so stop here*/
+ if(temp > stretch) return 0;
+ else local_stretch = temp;
+ }
+ /* This is for average stretch */
+// else{
+// float temp = average_stretch_of_mesh(C);
+// /* stretch is increasing, so stop here*/
+// if(temp > stretch) return 0;
+// else stretch = temp;
+// }
+//
+// /* This is for maximum stretch of the mesh */
+// else{
+// float temp = maximum_stretch_of_mesh(C);
+// /* stretch is increasing, so stop here*/
+// if(temp > stretch) return 0;
+// else stretch = temp;
+// }
+
+
if(!recursion_depth) {
autoseam_delete_adjacency(adj);
return 0;
@@ -476,8 +516,9 @@
/* recursive calls for two parts of the mesh. */
if(nplus > 0){
- //can we construct PChart for this part and calculate strectch for that part?
+ //can we construct PChart for this part and calculate strectch for that part?
generate_seam_recursive(bm, adj_plus, adj_big, recursion_depth, C, stretch);
+
}
if(nminus > 0){
//same is applicable for this part.
@@ -485,8 +526,6 @@
}
autoseam_delete_adjacency(adj);
-
-
return 0;
}
@@ -577,7 +616,7 @@
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_int(ot->srna, "depth", 1, 0, 6, "Recursion Depth", "Max. recursion depth", 0, 6);
- RNA_def_boolean(ot->srna, "is_combinatorial", 0, "Calculate Combinatorial", "Store combinatorial edge distance in dual graph.");
+ RNA_def_boolean(ot->srna, "is_combinatorial", 0, "Combinatorial", "Consider actual face centers for calculation.");
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.");
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-18 04:01:57 UTC (rev 38464)
+++ branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.h 2011-07-18 04:53:42 UTC (rev 38465)
@@ -29,51 +29,9 @@
#ifndef AUTOSEAM_TOOLS_H
#define AUTOSEAM_TOOLS_H
-#include "bmesh.h"
-#include "autoseam_C_API.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list