[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53750] trunk/blender/source/blender/ editors/uvedit/uvedit_unwrap_ops.c: minor speedup for construct_param_handle_subsurfed() break out of texface_from_original_index() early and dont get the offset for each vertex.

Campbell Barton ideasman42 at gmail.com
Sat Jan 12 20:46:27 CET 2013


Revision: 53750
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53750
Author:   campbellbarton
Date:     2013-01-12 19:46:27 +0000 (Sat, 12 Jan 2013)
Log Message:
-----------
minor speedup for construct_param_handle_subsurfed() break out of texface_from_original_index() early and dont get the offset for each vertex.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c

Modified: trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c
===================================================================
--- trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c	2013-01-12 19:39:03 UTC (rev 53749)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c	2013-01-12 19:46:27 UTC (rev 53750)
@@ -367,19 +367,17 @@
 }
 
 
-static void texface_from_original_index(BMFace *efa, int index, float **uv, ParamBool *pin, ParamBool *select, Scene *scene, BMEditMesh *em)
+static void texface_from_original_index(BMFace *efa, int index, float **uv, ParamBool *pin, ParamBool *select,
+                                        Scene *scene, BMEditMesh *em, const int cd_loop_uv_offset)
 {
 	BMLoop *l;
 	BMIter liter;
 	MLoopUV *luv;
 
-	const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
-
 	*uv = NULL;
 	*pin = 0;
 	*select = 1;
 
-
 	if (index == ORIGINDEX_NONE)
 		return;
 
@@ -389,6 +387,7 @@
 			*uv = luv->uv;
 			*pin = (luv->flag & MLOOPUV_PINNED) ? 1 : 0;
 			*select = (uvedit_uv_select_test(em, scene, l) != 0);
+			break;
 		}
 	}
 }
@@ -424,6 +423,8 @@
 	/* similar to the above, we need a way to map edges to their original ones */
 	BMEdge **edgeMap;
 
+	const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
+
 	handle = param_construct_begin();
 
 	if (correct_aspect) {
@@ -512,10 +513,10 @@
 		
 		/* This is where all the magic is done. If the vertex exists in the, we pass the original uv pointer to the solver, thus
 		 * flushing the solution to the edit mesh. */
-		texface_from_original_index(origFace, origVertIndices[face->v1], &uv[0], &pin[0], &select[0], scene, em);
-		texface_from_original_index(origFace, origVertIndices[face->v2], &uv[1], &pin[1], &select[1], scene, em);
-		texface_from_original_index(origFace, origVertIndices[face->v3], &uv[2], &pin[2], &select[2], scene, em);
-		texface_from_original_index(origFace, origVertIndices[face->v4], &uv[3], &pin[3], &select[3], scene, em);
+		texface_from_original_index(origFace, origVertIndices[face->v1], &uv[0], &pin[0], &select[0], scene, em, cd_loop_uv_offset);
+		texface_from_original_index(origFace, origVertIndices[face->v2], &uv[1], &pin[1], &select[1], scene, em, cd_loop_uv_offset);
+		texface_from_original_index(origFace, origVertIndices[face->v3], &uv[2], &pin[2], &select[2], scene, em, cd_loop_uv_offset);
+		texface_from_original_index(origFace, origVertIndices[face->v4], &uv[3], &pin[3], &select[3], scene, em, cd_loop_uv_offset);
 
 		param_face_add(handle, key, 4, vkeys, co, uv, pin, select);
 	}




More information about the Bf-blender-cvs mailing list