Revision: 41352
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41352
Author: psy-fi
Date: 2011-10-28 20:54:45 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
smart stitching
===================
*Optimization, store the uvelement that corresponds to an edges first uv to the
edge. Boundary edges (the ones that matter) are certain to have a 1-1
relationship with this uvelement. This makes it possible to avoid costly
lookups during selection storage and rotation calculation (coming soon)
Modified Paths:
--------------
branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c
Modified:
branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c
2011-10-28 20:36:40 UTC (rev 41351)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c
2011-10-28 20:54:45 UTC (rev 41352)
@@ -1279,6 +1279,8 @@
unsigned int uv2;
/* general use flag (Used to check if edge is boundary here, and
propagates to adjacency elements) */
char flag;
+ /* element that guarantees element->face has the face on
element->tfindex and element->tfindex+1 is the second uv */
+ UvElement *element;
}UvEdge;
#define STITCHNEW
@@ -1382,7 +1384,7 @@
}
-/* getter method */
+/* "getter method" */
StitchPreviewer *uv_get_stitch_previewer(void)
{
return _stitch_preview;
@@ -2417,13 +2419,15 @@
int nverts = efa->v4 ? 4 : 3;
for(i = 0; i < nverts; i++){
- int offset1, itmp1 =
get_uv_element(stitch_state->elementMap, efa, i) -
stitch_state->elementMap->buf;
+ UvElement *element =
get_uv_element(stitch_state->elementMap, efa, i);
+ int offset1, itmp1 = element -
stitch_state->elementMap->buf;
int offset2, itmp2 =
get_uv_element(stitch_state->elementMap, efa, (i+1)%nverts) -
stitch_state->elementMap->buf;
offset1 = stitch_state->map[itmp1];
offset2 = stitch_state->map[itmp2];
edges[counter].flag = 0;
+ edges[counter].element = element;
/* using an order policy, sort uvs according to
address space. This avoids
* Having two different UvEdges with the same
uvs on different positions */
if(offset1 < offset2){
@@ -2483,7 +2487,7 @@
stitch_state->selection_size = 0;
- /* Fill selection stack */
+ /***** Fill selection stack *******/
/* Load old selection if redoing operator with different settings */
if(RNA_property_is_set(op->ptr, "selection")){
@@ -2619,56 +2623,11 @@
RNA_int_set(&itemptr, "face_index",
element->face->tmp.l);
RNA_int_set(&itemptr, "element_index",
element->tfindex);
}else{
- char matchfound = 0;
UvEdge *edge = (UvEdge
*)stitch_state->selection_stack[i];
- UvElement *element1 =
stitch_state->uvs[edge->uv1];
- UvElement *element2 =
stitch_state->uvs[edge->uv2];
- UvElement *element_iter = element1;
+ UvElement *element = edge->element;
- do{
- UvElement *testElement;
- int nverts;
- int uniqueIndex;
- EditFace *efa = element_iter->face;
- nverts = efa->v4? 4 : 3;
-
- testElement =
get_uv_element(stitch_state->elementMap, efa, (element_iter->tfindex +
1)%nverts);
- uniqueIndex =
stitch_state->map[testElement - stitch_state->elementMap->buf];
- if(uniqueIndex == edge->uv2){
- RNA_int_set(&itemptr,
"face_index", element_iter->face->tmp.l);
- RNA_int_set(&itemptr,
"element_index", element_iter->tfindex);
- matchfound = 1;
- break;
- }
-
- element_iter = element_iter->next;
- }while(element_iter && !element_iter->separate);
-
- if(matchfound)
- continue;
-
- element_iter = element2;
- do{
- UvElement *testElement;
- int nverts;
- int uniqueIndex;
- EditFace *efa = element_iter->face;
- nverts = efa->v4? 4 : 3;
-
- testElement =
get_uv_element(stitch_state->elementMap, efa, (element_iter->tfindex +
1)%nverts);
- uniqueIndex =
stitch_state->map[testElement - stitch_state->elementMap->buf];
- if(uniqueIndex == edge->uv1){
- RNA_int_set(&itemptr,
"face_index", element_iter->face->tmp.l);
- RNA_int_set(&itemptr,
"element_index", element_iter->tfindex);
- matchfound = 1;
- break;
- }
-
- element_iter = element_iter->next;
- }while(element_iter && !element_iter->separate);
-
- if(!matchfound)
- printf("stitch error, can't find face
that includes selected edge\n");
+ RNA_int_set(&itemptr, "face_index",
element->face->tmp.l);
+ RNA_int_set(&itemptr, "element_index",
element->tfindex);
}
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs