Revision: 43147
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43147
Author:   psy-fi
Date:     2012-01-04 22:59:12 +0000 (Wed, 04 Jan 2012)
Log Message:
-----------
Renaming to keep style consistent. Introduce storage for active island preview

Modified Paths:
--------------
    branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_draw.c
    
branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_intern.h
    
branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_smart_stitch.c

Modified: 
branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_draw.c
===================================================================
--- 
branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_draw.c    
    2012-01-04 22:14:23 UTC (rev 43146)
+++ 
branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_draw.c    
    2012-01-04 22:59:12 UTC (rev 43147)
@@ -869,39 +869,39 @@
 
                glEnable(GL_BLEND);
 
-               glVertexPointer(2, GL_FLOAT, 0, stitch_preview->previewTris);
+               glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_tris);
                glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
                UI_ThemeColor4(TH_STITCH_PREVIEW_FACE);
-               glDrawArrays(GL_TRIANGLES, 0, stitch_preview->numOfTris*3);
+               glDrawArrays(GL_TRIANGLES, 0, stitch_preview->num_tris*3);
                glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
                UI_ThemeColor4(TH_STITCH_PREVIEW_EDGE);
-               glDrawArrays(GL_TRIANGLES, 0, stitch_preview->numOfTris*3);
+               glDrawArrays(GL_TRIANGLES, 0, stitch_preview->num_tris*3);
                glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
                UI_ThemeColor4(TH_STITCH_PREVIEW_VERT);
-               glDrawArrays(GL_TRIANGLES, 0, stitch_preview->numOfTris*3);
+               glDrawArrays(GL_TRIANGLES, 0, stitch_preview->num_tris*3);
 
-               glVertexPointer(2, GL_FLOAT, 0, stitch_preview->previewQuads);
+               glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_quads);
                glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
                UI_ThemeColor4(TH_STITCH_PREVIEW_FACE);
-               glDrawArrays(GL_QUADS, 0, stitch_preview->numOfQuads*4);
+               glDrawArrays(GL_QUADS, 0, stitch_preview->num_quads*4);
                glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
                UI_ThemeColor4(TH_STITCH_PREVIEW_EDGE);
-               glDrawArrays(GL_QUADS, 0, stitch_preview->numOfQuads*4);
+               glDrawArrays(GL_QUADS, 0, stitch_preview->num_quads*4);
                glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
                UI_ThemeColor4(TH_STITCH_PREVIEW_VERT);
-               glDrawArrays(GL_QUADS, 0, stitch_preview->numOfQuads*4);
+               glDrawArrays(GL_QUADS, 0, stitch_preview->num_quads*4);
 
                glDisable(GL_BLEND);
 
                /* draw vert preview */
                glPointSize(pointsize*2.0);
                UI_ThemeColor4(TH_STITCH_PREVIEW_STITCHABLE);
-               glVertexPointer(2, GL_FLOAT, 0, 
stitch_preview->previewStitchable);
-               glDrawArrays(GL_POINTS, 0, stitch_preview->numOfStitchable);
+               glVertexPointer(2, GL_FLOAT, 0, 
stitch_preview->preview_stitchable);
+               glDrawArrays(GL_POINTS, 0, stitch_preview->num_stitchable);
 
                UI_ThemeColor4(TH_STITCH_PREVIEW_UNSTITCHABLE);
-               glVertexPointer(2, GL_FLOAT, 0, 
stitch_preview->previewUnstitchable);
-               glDrawArrays(GL_POINTS, 0, stitch_preview->numOfUnstitchable);
+               glVertexPointer(2, GL_FLOAT, 0, 
stitch_preview->preview_unstitchable);
+               glDrawArrays(GL_POINTS, 0, stitch_preview->num_unstitchable);
 
                glPopClientAttrib();
                glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

Modified: 
branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_intern.h
===================================================================
--- 
branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_intern.h  
    2012-01-04 22:14:23 UTC (rev 43146)
+++ 
branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_intern.h  
    2012-01-04 22:59:12 UTC (rev 43147)
@@ -45,19 +45,24 @@
 typedef struct StitchPreviewer {
        /* OpenGL requires different calls for Triangles and Quads.
         * here we'll store the quads of the mesh */
-       float *previewQuads;
+       float *preview_quads;
        /* ...and here we'll store the triangles*/
-       float *previewTris;
+       float *preview_tris;
        /* Preview data. These will be either the previewed vertices or edges 
depending on stitch mode settings */
-       float *previewStitchable;
-       float *previewUnstitchable;
+       float *preview_stitchable;
+       float *preview_unstitchable;
        /* here we'll store the number of triangles and quads to be drawn */
-       unsigned int numOfTris;
-       unsigned int numOfQuads;
-       unsigned int numOfStitchable;
-       unsigned int numOfUnstitchable;
-       /* vertex or edge preview. Store it here too because operator will not 
be available in draw code */
-       char mode;
+       unsigned int num_tris;
+       unsigned int num_quads;
+       unsigned int num_stitchable;
+       unsigned int num_unstitchable;
+
+       /* store static island Quads */
+       float *static_quads;
+       /* ...and here we'll store the triangles*/
+       float *static_tris;
+       unsigned int num_static_tris;
+       unsigned int num_static_quads;
 } StitchPreviewer;
 
 /* id can be from 0 to 3 */

Modified: 
branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_smart_stitch.c
===================================================================
--- 
branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_smart_stitch.c
        2012-01-04 22:14:23 UTC (rev 43146)
+++ 
branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_smart_stitch.c
        2012-01-04 22:59:12 UTC (rev 43147)
@@ -108,16 +108,16 @@
        /* use limit flag */
        char use_limit;
        /* limit to operator, same as original operator */
-       float limitDist;
+       float limit_dist;
        /* snap uv islands together during stitching */
-       char snapIslands;
+       char snap_islands;
        /* stich at midpoints or at islands */
        char midpoints;
        /* editmesh, cached for use in modal handler */
        EditMesh *em;
        /* element map for getting info about uv connectivity */
-       UvElementMap *elementMap;
-       /* Edge container */
+       UvElementMap *element_map;
+       /* edge container */
        UvEdge *uvedges;
        /* container of first of a group of coincident uvs, these will be 
operated upon */
        UvElement **uvs;
@@ -129,11 +129,13 @@
        int selection_size;
        /* island that stays in place */
        int static_island;
-       /* For fast edge lookup... */
+       /* for fast edge lookup... */
        GHash *edgeHash;
-       /* ...And actual edge storage */
+       /* ...and actual edge storage */
        UvEdge *edges;
        int total_edges;
+       /* */
+       unsigned int faces_per_island;
 } StitchState;
 
 
@@ -148,23 +150,22 @@
 
 #define STITCH_NO_PREVIEW -1
 
-/* Previewer stuff (see uvedit_intern.h for more info) */
+/* previewer stuff (see uvedit_intern.h for more info) */
 static StitchPreviewer *_stitch_preview;
 
 /* constructor */
 static StitchPreviewer * stitch_preview_init(void)
 {
        _stitch_preview = MEM_mallocN(sizeof(StitchPreviewer), 
"stitch_previewer");
-       _stitch_preview->previewQuads = NULL;
-       _stitch_preview->previewTris = NULL;
-       _stitch_preview->previewStitchable = NULL;
-       _stitch_preview->previewUnstitchable = NULL;
+       _stitch_preview->preview_quads = NULL;
+       _stitch_preview->preview_tris = NULL;
+       _stitch_preview->preview_stitchable = NULL;
+       _stitch_preview->preview_unstitchable = NULL;
 
-       _stitch_preview->numOfQuads = 0;
-       _stitch_preview->numOfTris = 0;
-       _stitch_preview->numOfStitchable = 0;
-       _stitch_preview->numOfUnstitchable = 0;
-       _stitch_preview->mode = 0;
+       _stitch_preview->num_quads = 0;
+       _stitch_preview->num_tris = 0;
+       _stitch_preview->num_stitchable = 0;
+       _stitch_preview->num_unstitchable = 0;
 
        return _stitch_preview;
 }
@@ -174,25 +175,25 @@
 {
        if(_stitch_preview)
        {
-               if(_stitch_preview->previewQuads)
+               if(_stitch_preview->preview_quads)
                {
-                       MEM_freeN(_stitch_preview->previewQuads);
-                       _stitch_preview->previewQuads = NULL;
+                       MEM_freeN(_stitch_preview->preview_quads);
+                       _stitch_preview->preview_quads = NULL;
                }
-               if(_stitch_preview->previewTris)
+               if(_stitch_preview->preview_tris)
                {
-                       MEM_freeN(_stitch_preview->previewTris);
-                       _stitch_preview->previewTris = NULL;
+                       MEM_freeN(_stitch_preview->preview_tris);
+                       _stitch_preview->preview_tris = NULL;
                }
-               if(_stitch_preview->previewStitchable)
+               if(_stitch_preview->preview_stitchable)
                {
-                       MEM_freeN(_stitch_preview->previewStitchable);
-                       _stitch_preview->previewStitchable = NULL;
+                       MEM_freeN(_stitch_preview->preview_stitchable);
+                       _stitch_preview->preview_stitchable = NULL;
                }
-               if(_stitch_preview->previewUnstitchable)
+               if(_stitch_preview->preview_unstitchable)
                {
-                       MEM_freeN(_stitch_preview->previewUnstitchable);
-                       _stitch_preview->previewUnstitchable = NULL;
+                       MEM_freeN(_stitch_preview->preview_unstitchable);
+                       _stitch_preview->preview_unstitchable = NULL;
                }
                MEM_freeN(_stitch_preview);
                _stitch_preview = NULL;
@@ -217,9 +218,9 @@
 
        if(sa) {
                sprintf(msg, str,
-                               stitch_state->snapIslands? "On" : "Off",
+                               stitch_state->snap_islands? "On" : "Off",
                                stitch_state->midpoints? "On": "Off",
-                               stitch_state->limitDist,
+                               stitch_state->limit_dist,
                                stitch_state->use_limit? "On" : "Off");
 
                ED_area_headerprint(sa, msg);
@@ -248,14 +249,14 @@
 }
 
 
-/* Calculate snapping for islands */
+/* calculate snapping for islands */
 static void stitch_calculate_island_snapping(StitchState *state, 
StitchPreviewer *preview, IslandStitchData *island_stitch_data, int final){
        int i;
        EditFace *efa;
        MTFace *mt;
        UvElement *element;
 
-       for(i = 0; i <  state->elementMap->totalIslands; i++){
+       for(i = 0; i <  state->element_map->totalIslands; i++){
                if(island_stitch_data[i].addedForPreview){
                        int numOfIslandUVs = 0, j;
                        /* check to avoid divide by 0 */
@@ -266,8 +267,8 @@
                        }
                        island_stitch_data[i].translation[0] /= 
island_stitch_data[i].numOfElements;
                        island_stitch_data[i].translation[1] /= 
island_stitch_data[i].numOfElements;
-                       numOfIslandUVs = getNumOfIslandUvs(state->elementMap, 
i);
-                       element = 
&state->elementMap->buf[state->elementMap->islandIndices[i]];
+                       numOfIslandUVs = getNumOfIslandUvs(state->element_map, 
i);
+                       element = 
&state->element_map->buf[state->element_map->islandIndices[i]];
                        for(j = 0; j < numOfIslandUVs; j++, element++){
                                /* stitchable uvs have already been processed, 
don't process */
                                if(!(element->flag & STITCH_PROCESSED)){
@@ -283,17 +284,17 @@
                                        else if(efa->tmp.l != 
STITCH_NO_PREVIEW){
                                                if(efa->v4){
                                                        if(0){
-                                                               
stitch_uv_rotate(island_stitch_data[i].rotation, 
island_stitch_data[i].medianPoint, &preview->previewQuads[efa->tmp.l + 
2*element->tfindex]);
+                                                               
stitch_uv_rotate(island_stitch_data[i].rotation, 
island_stitch_data[i].medianPoint, &preview->preview_quads[efa->tmp.l + 
2*element->tfindex]);
                                                        }
-                                                       
preview->previewQuads[efa->tmp.l + 2*element->tfindex] += 
island_stitch_data[i].translation[0];
-                                                       
preview->previewQuads[efa->tmp.l + 2*element->tfindex + 1] += 
island_stitch_data[i].translation[1];
+                                                       
preview->preview_quads[efa->tmp.l + 2*element->tfindex] += 
island_stitch_data[i].translation[0];
+                                                       
preview->preview_quads[efa->tmp.l + 2*element->tfindex + 1] += 
island_stitch_data[i].translation[1];
                                                }
                                                else {
                                                        if(0){

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to