[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39285] branches/soc-2011-onion/source/ blender/editors: more code for adjacency info initialization
Antony Riakiotakis
kalast at gmail.com
Thu Aug 11 03:24:14 CEST 2011
Revision: 39285
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39285
Author: psy-fi
Date: 2011-08-11 01:24:11 +0000 (Thu, 11 Aug 2011)
Log Message:
-----------
more code for adjacency info initialization
Modified Paths:
--------------
branches/soc-2011-onion/source/blender/editors/include/ED_mesh.h
branches/soc-2011-onion/source/blender/editors/mesh/editmesh_lib.c
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c
Modified: branches/soc-2011-onion/source/blender/editors/include/ED_mesh.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/include/ED_mesh.h 2011-08-11 00:36:54 UTC (rev 39284)
+++ branches/soc-2011-onion/source/blender/editors/include/ED_mesh.h 2011-08-11 01:24:11 UTC (rev 39285)
@@ -157,7 +157,6 @@
void EM_free_uv_vert_map(struct UvVertMap *vmap);
struct UvElementMap *EM_make_uv_element_map(struct EditMesh *em, int selected, int doIslands);
-//struct UvElement *EM_get_uv_map_vert_for_edge(struct UvElementMap *vmap, struct EditMesh *em, struct EditEdge *edge, int initVertexArray);
void EM_free_uv_element_map(struct UvElementMap *vmap);
void EM_add_data_layer(struct EditMesh *em, struct CustomData *data, int type, const char *name);
Modified: branches/soc-2011-onion/source/blender/editors/mesh/editmesh_lib.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/mesh/editmesh_lib.c 2011-08-11 00:36:54 UTC (rev 39284)
+++ branches/soc-2011-onion/source/blender/editors/mesh/editmesh_lib.c 2011-08-11 01:24:11 UTC (rev 39285)
@@ -2563,39 +2563,7 @@
return vmap;
}
-/* The function below is buggy, should check face first. correct before use */
-/* Will return the UV for which uvi and uvi+1 belong to given edge
-UvElement *EM_get_uv_map_vert_for_edge(UvVertMap2 *vmap, EditMesh *em, EditEdge *edge, int initVertexArray)
-{
- int i;
- EditVert *vert;
- UvElement *element;
- EditFace *efa;
- MTFace *mt;
- if(initVertexArray)
- {
- for(vert = em->verts.first, i = 0; vert; vert = vert->next, i++){
- vert->tmp.l = i;
- }
- }
- for(element = vmap->vert[edge->v1->tmp.l]; element; element = element->next){
- int nverts;
- efa = element->face;
- nverts = efa->v4 ? 4 : 3;
- if(*(&efa->v1 + (element->tfindex + 1)%nverts) == edge->v2)
- return element;
- }
- for(element = vmap->vert[edge->v2->tmp.l]; element; element = element->next){
- int nverts;
- efa = element->face;
- nverts = efa->v4 ? 4 : 3;
- if(*(&efa->v1 + (element->tfindex + 1)%nverts) == edge->v1)
- return element;
- }
- return NULL;
-}
-*/
UvMapVert *EM_get_uv_map_vert(UvVertMap *vmap, unsigned int v)
{
Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c 2011-08-11 00:36:54 UTC (rev 39284)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c 2011-08-11 01:24:11 UTC (rev 39285)
@@ -322,11 +322,14 @@
* to their coincident uvs */
UvAdjacencyElement *uv;
+ /* ...Is what it says */
+ int totalUniqueUvs;
+
/* Holds, for each UvElement in elementMap, a pointer to its unique uv.*/
int *uniqueUv;
/* Edges used for adjacency info, used with laplacian smoothing */
- UvAdjacencyEdge *uvedges;
+ GHash *uvedges;
/* Timer to be used for airbrush-type brush */
wmTimer *timer;
@@ -405,6 +408,16 @@
op->customdata = NULL;
}
+
+int get_uv_element_offset_from_face(UvElementMap *map, EditFace *efa, int index){
+ UvElement *element = map->vert[(*(&efa->v1 + index))->tmp.l];
+ for(;element; element = element->next){
+ if(element->face == efa)
+ return element - map->buf;
+ }
+ return -1;
+}
+
static SmoothBrushData *uv_smooth_stroke_init(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
@@ -420,6 +433,7 @@
* Unique Uvs are important because they help us make one UVAdjacencyEdge for a group
* of coincident UVs.*/
int numOfSeparators = 0, i;
+ EditFace *efa;
data->uvpaint = &ts->uvsmooth->paint;
data->elementMap = EM_make_uv_element_map(em, 0, 0);
@@ -442,6 +456,32 @@
uv_smooth_stroke_exit(C, op);
return NULL;
}
+
+ data->totalUniqueUvs = numOfSeparators;
+ /* So that we can use this as index for the UvElements*/
+ numOfSeparators = -1;
+ /* initialize the unique UVs */
+ for(i = 0; i < em->totvert; i++){
+ UvElement *element = data->elementMap->vert[i];
+ for(; element; element = element->next){
+ if(element->separate){
+ numOfSeparators++;
+ data->uv[numOfSeparators].element = data->elementMap->buf + i;
+ data->uv[numOfSeparators].flag = 0;
+ }
+ /* pointer arithmetic to the rescue, as always :)*/
+ data->uniqueUv[element - data->elementMap->buf] = numOfSeparators;
+ }
+ }
+
+ /* Now, to generate our uv connectivity data...Man, this is gonna be -slow-! */
+ for(efa = em->faces.first; efa; efa = efa->next){
+ int nverts = efa->v4 ? 4 : 3;
+ for(i = 0; i < nverts; i++){
+ int offset1 = get_uv_element_offset_from_face(data->elementMap, efa, i);
+ int offset2 = get_uv_element_offset_from_face(data->elementMap, efa, (i+1)%nverts);
+ }
+ }
}
return op->customdata;
More information about the Bf-blender-cvs
mailing list