[Bf-blender-cvs] [6835ea72f26] sculpt-dev: Sculpt Poly Loop: Move poly loop code to its own file

Pablo Dobarro noreply at git.blender.org
Wed Mar 17 01:53:21 CET 2021


Commit: 6835ea72f26f0bf3d8caf4c6f8667490912d8694
Author: Pablo Dobarro
Date:   Wed Mar 17 00:07:41 2021 +0100
Branches: sculpt-dev
https://developer.blender.org/rB6835ea72f26f0bf3d8caf4c6f8667490912d8694

Sculpt Poly Loop: Move poly loop code to its own file

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

M	source/blender/editors/sculpt_paint/CMakeLists.txt
M	source/blender/editors/sculpt_paint/sculpt_face_set_topology.c
M	source/blender/editors/sculpt_paint/sculpt_intern.h
A	source/blender/editors/sculpt_paint/sculpt_poly_loop.c

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

diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt
index 3edaeb5456f..525385d0067 100644
--- a/source/blender/editors/sculpt_paint/CMakeLists.txt
+++ b/source/blender/editors/sculpt_paint/CMakeLists.txt
@@ -74,6 +74,7 @@ set(SRC
   sculpt_multiplane_scrape.c
   sculpt_paint_color.c
   sculpt_pose.c
+  sculpt_poly_loop.c
   sculpt_smooth.c
   sculpt_transform.c
   sculpt_undo.c
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set_topology.c b/source/blender/editors/sculpt_paint/sculpt_face_set_topology.c
index c0ab2acb6bb..7d1872e4555 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set_topology.c
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set_topology.c
@@ -150,8 +150,8 @@ static int sculpt_poly_loop_initial_edge_from_cursor(Object *ob) {
 
   int closest_vert_index = mesh->mloop[initial_poly->loopstart].v;
   for (int i = 0; i < initial_poly->totloop; i++) {
-    if (len_squared_v3v3(mvert[initial_poly->loopstart + i].co, ss->cursor_location) < len_squared_v3v3(mvert[closest_vert_index].co, ss->cursor_location)) {
-      closest_vert_index = initial_poly->loopstart + i;
+    if (len_squared_v3v3(mvert[ss->mloop[initial_poly->loopstart + i].v].co, ss->cursor_location) < len_squared_v3v3(mvert[closest_vert_index].co, ss->cursor_location)) {
+      closest_vert_index = ss->mloop[initial_poly->loopstart + i].v;
     }
   }
 
@@ -165,7 +165,8 @@ static int sculpt_poly_loop_initial_edge_from_cursor(Object *ob) {
       closest_vert_on_initial_edge_index = other_vert;
     }
   }
-  printf("INITIAL EDGE INDEX %d\n");
+  printf("CLOSEST VERT INDEX %d\n", closest_vert_index);
+  printf("INITIAL EDGE INDEX %d\n", initial_edge_index);
   return initial_edge_index;
 }
 
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 113d5e002ce..5671088c5ad 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -1420,6 +1420,11 @@ bool SCULPT_get_redraw_rect(struct ARegion *region,
                             Object *ob,
                             rcti *rect);
 
+
+/* Poly Loops. */
+BLI_bitmap * sculpt_poly_loop_from_cursor(struct Object *ob);
+
+
 /* Operators. */
 
 /* Face Set by Topology. */
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set_topology.c b/source/blender/editors/sculpt_paint/sculpt_poly_loop.c
similarity index 96%
copy from source/blender/editors/sculpt_paint/sculpt_face_set_topology.c
copy to source/blender/editors/sculpt_paint/sculpt_poly_loop.c
index c0ab2acb6bb..7d1872e4555 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set_topology.c
+++ b/source/blender/editors/sculpt_paint/sculpt_poly_loop.c
@@ -150,8 +150,8 @@ static int sculpt_poly_loop_initial_edge_from_cursor(Object *ob) {
 
   int closest_vert_index = mesh->mloop[initial_poly->loopstart].v;
   for (int i = 0; i < initial_poly->totloop; i++) {
-    if (len_squared_v3v3(mvert[initial_poly->loopstart + i].co, ss->cursor_location) < len_squared_v3v3(mvert[closest_vert_index].co, ss->cursor_location)) {
-      closest_vert_index = initial_poly->loopstart + i;
+    if (len_squared_v3v3(mvert[ss->mloop[initial_poly->loopstart + i].v].co, ss->cursor_location) < len_squared_v3v3(mvert[closest_vert_index].co, ss->cursor_location)) {
+      closest_vert_index = ss->mloop[initial_poly->loopstart + i].v;
     }
   }
 
@@ -165,7 +165,8 @@ static int sculpt_poly_loop_initial_edge_from_cursor(Object *ob) {
       closest_vert_on_initial_edge_index = other_vert;
     }
   }
-  printf("INITIAL EDGE INDEX %d\n");
+  printf("CLOSEST VERT INDEX %d\n", closest_vert_index);
+  printf("INITIAL EDGE INDEX %d\n", initial_edge_index);
   return initial_edge_index;
 }



More information about the Bf-blender-cvs mailing list